summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--Makefile.in55
-rw-r--r--regress/Makefile6
-rw-r--r--regress/unittests/sshbuf/test_sshbuf.c6
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_fixed.c6
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_fuzz.c4
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_basic.c4
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_crypto.c4
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c4
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_misc.c4
-rw-r--r--regress/unittests/sshbuf/tests.c2
-rw-r--r--regress/unittests/test_helper/fuzz.c2
-rw-r--r--regress/unittests/test_helper/test_helper.c6
13 files changed, 96 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index acf986b23..6f8deb439 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -127,6 +127,18 @@
127 [regress/unittests/test_helper/test_helper.c] 127 [regress/unittests/test_helper/test_helper.c]
128 [regress/unittests/test_helper/test_helper.h] 128 [regress/unittests/test_helper/test_helper.h]
129 Import new unit tests from OpenBSD; not yet hooked up to build. 129 Import new unit tests from OpenBSD; not yet hooked up to build.
130 - (djm) [regress/Makefile Makefile.in]
131 [regress/unittests/sshbuf/test_sshbuf.c
132 [regress/unittests/sshbuf/test_sshbuf_fixed.c]
133 [regress/unittests/sshbuf/test_sshbuf_fuzz.c]
134 [regress/unittests/sshbuf/test_sshbuf_getput_basic.c]
135 [regress/unittests/sshbuf/test_sshbuf_getput_crypto.c]
136 [regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c]
137 [regress/unittests/sshbuf/test_sshbuf_misc.c]
138 [regress/unittests/sshbuf/tests.c]
139 [regress/unittests/test_helper/fuzz.c]
140 [regress/unittests/test_helper/test_helper.c]
141 Hook new unit tests into the build and "make tests"
130 142
13120140430 14320140430
132 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already 144 - (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
diff --git a/Makefile.in b/Makefile.in
index 53f0f1f72..16fb9ee8c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.357 2014/05/15 04:58:08 djm Exp $ 1# $Id: Makefile.in,v 1.358 2014/05/15 08:01:01 djm Exp $
2 2
3# uncomment if you run a non bourne compatable shell. Ie. csh 3# uncomment if you run a non bourne compatable shell. Ie. csh
4#SHELL = @SH@ 4#SHELL = @SH@
@@ -143,7 +143,7 @@ $(SSHOBJS): Makefile.in config.h
143$(SSHDOBJS): Makefile.in config.h 143$(SSHDOBJS): Makefile.in config.h
144 144
145.c.o: 145.c.o:
146 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< 146 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
147 147
148LIBCOMPAT=openbsd-compat/libopenbsd-compat.a 148LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
149$(LIBCOMPAT): always 149$(LIBCOMPAT): always
@@ -222,6 +222,10 @@ umac128.o: umac.c
222clean: regressclean 222clean: regressclean
223 rm -f *.o *.a $(TARGETS) logintest config.cache config.log 223 rm -f *.o *.a $(TARGETS) logintest config.cache config.log
224 rm -f *.out core survey 224 rm -f *.out core survey
225 rm -f regress/unittests/test_helper/*.a
226 rm -f regress/unittests/test_helper/*.o
227 rm -f regress/unittests/sshbuf/*.o
228 rm -f regress/unittests/sshbuf/test_sshbuf
225 (cd openbsd-compat && $(MAKE) clean) 229 (cd openbsd-compat && $(MAKE) clean)
226 230
227distclean: regressclean 231distclean: regressclean
@@ -230,6 +234,10 @@ distclean: regressclean
230 rm -f Makefile buildpkg.sh config.h config.status 234 rm -f Makefile buildpkg.sh config.h config.status
231 rm -f survey.sh openbsd-compat/regress/Makefile *~ 235 rm -f survey.sh openbsd-compat/regress/Makefile *~
232 rm -rf autom4te.cache 236 rm -rf autom4te.cache
237 rm -f regress/unittests/test_helper/*.a
238 rm -f regress/unittests/test_helper/*.o
239 rm -f regress/unittests/sshbuf/*.o
240 rm -f regress/unittests/sshbuf/test_sshbuf
233 (cd openbsd-compat && $(MAKE) distclean) 241 (cd openbsd-compat && $(MAKE) distclean)
234 if test -d pkg ; then \ 242 if test -d pkg ; then \
235 rm -fr pkg ; \ 243 rm -fr pkg ; \
@@ -402,21 +410,54 @@ uninstall:
402 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8 410 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
403 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 411 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
404 412
405regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c 413regress-prep:
406 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress 414 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress
415 [ -d `pwd`/regress/unitests ] || mkdir -p `pwd`/regress/unitests
416 [ -d `pwd`/regress/unitests/test_helper ] || \
417 mkdir -p `pwd`/regress/unitests/test_helper
418 [ -d `pwd`/regress/unitests/sshbuf ] || \
419 mkdir -p `pwd`/regress/unitests/sshbuf
407 [ -f `pwd`/regress/Makefile ] || \ 420 [ -f `pwd`/regress/Makefile ] || \
408 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile 421 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
422
423regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
409 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \ 424 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
410 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 425 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
411 426
412regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c 427regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
413 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress
414 [ -f `pwd`/regress/Makefile ] || \
415 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
416 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \ 428 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
417 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 429 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
418 430
419tests interop-tests: $(TARGETS) regress/modpipe$(EXEEXT) regress/setuid-allowed$(EXEEXT) 431UNITTESTS_TEST_HELPER_OBJS=\
432 regress/unittests/test_helper/test_helper.o \
433 regress/unittests/test_helper/fuzz.o
434
435regress/unittests/test_helper/libtest_helper.a: ${UNITTESTS_TEST_HELPER_OBJS}
436 $(AR) rv $@ $(UNITTESTS_TEST_HELPER_OBJS)
437 $(RANLIB) $@
438
439UNITTESTS_TEST_SSHBUF_OBJS=\
440 regress/unittests/sshbuf/tests.o \
441 regress/unittests/sshbuf/test_sshbuf.o \
442 regress/unittests/sshbuf/test_sshbuf_getput_basic.o \
443 regress/unittests/sshbuf/test_sshbuf_getput_crypto.o \
444 regress/unittests/sshbuf/test_sshbuf_misc.o \
445 regress/unittests/sshbuf/test_sshbuf_fuzz.o \
446 regress/unittests/sshbuf/test_sshbuf_getput_fuzz.o \
447 regress/unittests/sshbuf/test_sshbuf_fixed.o
448
449regress/unittests/sshbuf/test_sshbuf$(EXEEXT): ${UNITTESTS_TEST_SSHBUF_OBJS} \
450 regress/unittests/test_helper/libtest_helper.a
451 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHBUF_OBJS) \
452 -L regress/unittests/test_helper -ltest_helper \
453 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
454
455REGRESS_BINARIES=\
456 regress/modpipe$(EXEEXT) \
457 regress/setuid-allowed$(EXEEXT) \
458 regress/unittests/sshbuf/test_sshbuf$(EXEEXT)
459
460tests interop-tests: regress-prep $(TARGETS) $(REGRESS_BINARIES)
420 BUILDDIR=`pwd`; \ 461 BUILDDIR=`pwd`; \
421 TEST_SHELL="@TEST_SHELL@"; \ 462 TEST_SHELL="@TEST_SHELL@"; \
422 TEST_SSH_SCP="$${BUILDDIR}/scp"; \ 463 TEST_SSH_SCP="$${BUILDDIR}/scp"; \
diff --git a/regress/Makefile b/regress/Makefile
index 6e3b8d634..1e1f68dc3 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,6 +1,6 @@
1# $OpenBSD: Makefile,v 1.68 2014/01/25 04:35:32 dtucker Exp $ 1# $OpenBSD: Makefile,v 1.68 2014/01/25 04:35:32 dtucker Exp $
2 2
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t-exec 3REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t-exec
4tests: $(REGRESS_TARGETS) 4tests: $(REGRESS_TARGETS)
5 5
6# Interop tests are not run by default 6# Interop tests are not run by default
@@ -180,3 +180,7 @@ t-exec-interop: ${INTEROP_TESTS:=.sh}
180 180
181# Not run by default 181# Not run by default
182interop: ${INTEROP_TARGETS} 182interop: ${INTEROP_TARGETS}
183
184# Unit tests, built by top-level Makefile
185unit:
186 ${.OBJDIR}/unittests/sshbuf/test_sshbuf
diff --git a/regress/unittests/sshbuf/test_sshbuf.c b/regress/unittests/sshbuf/test_sshbuf.c
index 834dcd050..85eacd66f 100644
--- a/regress/unittests/sshbuf/test_sshbuf.c
+++ b/regress/unittests/sshbuf/test_sshbuf.c
@@ -5,6 +5,9 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#define SSHBUF_INTERNAL 1 /* access internals for testing */
9#include "includes.h"
10
8#include <sys/types.h> 11#include <sys/types.h>
9#include <sys/param.h> 12#include <sys/param.h>
10#include <stdio.h> 13#include <stdio.h>
@@ -12,10 +15,9 @@
12#include <stdlib.h> 15#include <stdlib.h>
13#include <string.h> 16#include <string.h>
14 17
15#include "test_helper.h" 18#include "../test_helper/test_helper.h"
16 19
17#include "ssherr.h" 20#include "ssherr.h"
18#define SSHBUF_INTERNAL 1 /* access internals for testing */
19#include "sshbuf.h" 21#include "sshbuf.h"
20 22
21void sshbuf_tests(void); 23void sshbuf_tests(void);
diff --git a/regress/unittests/sshbuf/test_sshbuf_fixed.c b/regress/unittests/sshbuf/test_sshbuf_fixed.c
index 62c815a2e..52dc84b6f 100644
--- a/regress/unittests/sshbuf/test_sshbuf_fixed.c
+++ b/regress/unittests/sshbuf/test_sshbuf_fixed.c
@@ -5,6 +5,9 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#define SSHBUF_INTERNAL 1 /* access internals for testing */
9#include "includes.h"
10
8#include <sys/types.h> 11#include <sys/types.h>
9#include <sys/param.h> 12#include <sys/param.h>
10#include <stdio.h> 13#include <stdio.h>
@@ -12,9 +15,8 @@
12#include <stdlib.h> 15#include <stdlib.h>
13#include <string.h> 16#include <string.h>
14 17
15#include "test_helper.h" 18#include "../test_helper/test_helper.h"
16 19
17#define SSHBUF_INTERNAL 1 /* access internals for testing */
18#include "sshbuf.h" 20#include "sshbuf.h"
19#include "ssherr.h" 21#include "ssherr.h"
20 22
diff --git a/regress/unittests/sshbuf/test_sshbuf_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_fuzz.c
index a014b048c..d902ac460 100644
--- a/regress/unittests/sshbuf/test_sshbuf_fuzz.c
+++ b/regress/unittests/sshbuf/test_sshbuf_fuzz.c
@@ -5,6 +5,8 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#include "includes.h"
9
8#include <sys/types.h> 10#include <sys/types.h>
9#include <sys/param.h> 11#include <sys/param.h>
10#include <stdio.h> 12#include <stdio.h>
@@ -12,7 +14,7 @@
12#include <stdlib.h> 14#include <stdlib.h>
13#include <string.h> 15#include <string.h>
14 16
15#include "test_helper.h" 17#include "../test_helper/test_helper.h"
16 18
17#include "ssherr.h" 19#include "ssherr.h"
18#include "sshbuf.h" 20#include "sshbuf.h"
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_basic.c b/regress/unittests/sshbuf/test_sshbuf_getput_basic.c
index 2d469ec11..cf4d0a343 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_basic.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_basic.c
@@ -5,6 +5,8 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#include "includes.h"
9
8#include <sys/types.h> 10#include <sys/types.h>
9#include <sys/param.h> 11#include <sys/param.h>
10#include <stdio.h> 12#include <stdio.h>
@@ -12,7 +14,7 @@
12#include <stdlib.h> 14#include <stdlib.h>
13#include <string.h> 15#include <string.h>
14 16
15#include "test_helper.h" 17#include "../test_helper/test_helper.h"
16#include "ssherr.h" 18#include "ssherr.h"
17#include "sshbuf.h" 19#include "sshbuf.h"
18 20
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
index d7d4dc378..53290a64c 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_crypto.c
@@ -5,6 +5,8 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#include "includes.h"
9
8#include <sys/types.h> 10#include <sys/types.h>
9#include <sys/param.h> 11#include <sys/param.h>
10#include <stdio.h> 12#include <stdio.h>
@@ -16,7 +18,7 @@
16#include <openssl/ec.h> 18#include <openssl/ec.h>
17#include <openssl/objects.h> 19#include <openssl/objects.h>
18 20
19#include "test_helper.h" 21#include "../test_helper/test_helper.h"
20#include "ssherr.h" 22#include "ssherr.h"
21#include "sshbuf.h" 23#include "sshbuf.h"
22 24
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
index a382ee154..eed2d6025 100644
--- a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
+++ b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
@@ -5,6 +5,8 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#include "includes.h"
9
8#include <sys/types.h> 10#include <sys/types.h>
9#include <sys/param.h> 11#include <sys/param.h>
10#include <stdio.h> 12#include <stdio.h>
@@ -16,7 +18,7 @@
16#include <openssl/ec.h> 18#include <openssl/ec.h>
17#include <openssl/objects.h> 19#include <openssl/objects.h>
18 20
19#include "test_helper.h" 21#include "../test_helper/test_helper.h"
20#include "ssherr.h" 22#include "ssherr.h"
21#include "sshbuf.h" 23#include "sshbuf.h"
22 24
diff --git a/regress/unittests/sshbuf/test_sshbuf_misc.c b/regress/unittests/sshbuf/test_sshbuf_misc.c
index a5b1ab2c9..a47f9f0bf 100644
--- a/regress/unittests/sshbuf/test_sshbuf_misc.c
+++ b/regress/unittests/sshbuf/test_sshbuf_misc.c
@@ -5,6 +5,8 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#include "includes.h"
9
8#include <sys/types.h> 10#include <sys/types.h>
9#include <sys/param.h> 11#include <sys/param.h>
10#include <stdio.h> 12#include <stdio.h>
@@ -12,7 +14,7 @@
12#include <stdlib.h> 14#include <stdlib.h>
13#include <string.h> 15#include <string.h>
14 16
15#include "test_helper.h" 17#include "../test_helper/test_helper.h"
16 18
17#include "sshbuf.h" 19#include "sshbuf.h"
18 20
diff --git a/regress/unittests/sshbuf/tests.c b/regress/unittests/sshbuf/tests.c
index 8397e4011..1557e4342 100644
--- a/regress/unittests/sshbuf/tests.c
+++ b/regress/unittests/sshbuf/tests.c
@@ -5,7 +5,7 @@
5 * Placed in the public domain 5 * Placed in the public domain
6 */ 6 */
7 7
8#include "test_helper.h" 8#include "../test_helper/test_helper.h"
9 9
10void sshbuf_tests(void); 10void sshbuf_tests(void);
11void sshbuf_getput_basic_tests(void); 11void sshbuf_getput_basic_tests(void);
diff --git a/regress/unittests/test_helper/fuzz.c b/regress/unittests/test_helper/fuzz.c
index b64af24ed..63b2370d2 100644
--- a/regress/unittests/test_helper/fuzz.c
+++ b/regress/unittests/test_helper/fuzz.c
@@ -17,6 +17,8 @@
17 17
18/* Utility functions/framework for fuzz tests */ 18/* Utility functions/framework for fuzz tests */
19 19
20#include "includes.h"
21
20#include <sys/types.h> 22#include <sys/types.h>
21 23
22#include <assert.h> 24#include <assert.h>
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index 8f0bbdec9..5881538ee 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -17,6 +17,8 @@
17 17
18/* Utility functions/framework for regress tests */ 18/* Utility functions/framework for regress tests */
19 19
20#include "includes.h"
21
20#include <sys/types.h> 22#include <sys/types.h>
21#include <sys/param.h> 23#include <sys/param.h>
22 24
@@ -30,7 +32,9 @@
30 32
31#include <openssl/bn.h> 33#include <openssl/bn.h>
32 34
33#include <vis.h> 35#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
36# include <vis.h>
37#endif
34 38
35#include "test_helper.h" 39#include "test_helper.h"
36 40