diff options
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | configure.in | 12 | ||||
-rw-r--r-- | test/Makefile.in | 34 | ||||
-rw-r--r-- | test/compress.c | 5 | ||||
-rw-r--r-- | test/run-tests.sh | 32 |
5 files changed, 80 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in index 3f15ec1..dd82e6a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -161,6 +161,9 @@ install-config: neon-config neon.pc $(INSTALL) -d $(DESTDIR)$(pkgconfigdir) $(INSTALL_DATA) neon.pc $(DESTDIR)$(pkgconfigdir)/neon.pc +install-tests: install-lib + @cd test && make install + ChangeLog: svn log > $@ diff --git a/configure.in b/configure.in index 9d875ff..826ede9 100644 --- a/configure.in +++ b/configure.in @@ -117,6 +117,18 @@ if test x$enable_webdav != xno; then TESTS="$TESTS \$(DAV_TESTS)" fi +AC_ARG_ENABLE(tests-install, + AS_HELP_STRING([--enable-tests-install], + [enable installation of the test suite])) + +# If test suite installation is not required, it's more +# efficient to link the test programs using -no-install: +if test "$enable_tests_install" = "no"; then + TEST_LDFLAGS="-no-install" +fi + +AC_SUBST(TEST_LDFLAGS) + AC_CONFIG_FILES([neon-config], [chmod +x neon-config]) AC_CONFIG_FILES([Makefile src/Makefile test/Makefile neon.pc]) diff --git a/test/Makefile.in b/test/Makefile.in index 082e464..b1fbd75 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -23,7 +23,7 @@ BASIC_TESTS = uri-tests util-tests string-tests socket \ session request auth basic stubs redirect ZLIB_TESTS = compress ZLIB_HELPERS = file1.gz file2.gz trailing.gz badcsum.gz truncated.gz \ - corrupt1.gz corrupt2.gz empty.gz + corrupt1.gz corrupt2.gz empty.gz random.txt DAV_TESTS = xml xmlreq acl props lock SSL_TESTS = socket-ssl ssl SSL_HELPERS = ca-stamp @@ -40,9 +40,23 @@ LIBTEST = libtest.la LIBNEON = $(top_builddir)/src/libneon.la LIBTOOL = @LIBTOOL@ --silent -LINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -no-install +TEST_LDFLAGS = @TEST_LDFLAGS@ +LINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(TEST_LDFLAGS) COMPILE = $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ + +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL = @INSTALL@ + +INSTALL_HELPERS = $(HELPERS) server.key $(srcdir)/makekeys.sh \ + $(srcdir)/openssl.conf $(srcdir)/notvalid.pem \ + $(srcdir)/expired.pem + .SUFFIXES: .SUFFIXES: .lo .c @@ -65,6 +79,19 @@ grind: $(TESTS) $(HELPERS) lfs-check: largefile $(LFS_HELPERS) @SRCDIR=$(srcdir) $(SHELL) $(srcdir)/run.sh largefile +install: $(TESTS) $(HELPERS) + @$(INSTALL) -d $(DESTDIR)$(libdir)/neon-tests + @$(INSTALL) -d $(DESTDIR)$(libdir)/neon-tests/bin + @$(INSTALL) -d $(DESTDIR)$(libdir)/neon-tests/data + @for t in $(TESTS); do \ + $(LIBTOOL) --mode=install \ + $(INSTALL_PROGRAM) $$t $(DESTDIR)$(libdir)/neon-tests/bin; \ + done + @for h in $(INSTALL_HELPERS); do \ + $(INSTALL_DATA) $$h $(DESTDIR)$(libdir)/neon-tests/data; \ + done + @$(INSTALL_PROGRAM) $(srcdir)/run-tests.sh $(DESTDIR)$(libdir)/neon-tests + NEWS = $(top_srcdir)/NEWS file1.gz: $(NEWS) @@ -95,6 +122,9 @@ corrupt2.gz: empty.gz: touch $@ +random.txt: + cat $(NEWS) > $@ + # Dummy target to create the CA keys etc. makekeys stderr is redirected # since it changes for every invocation; not helpful for regression # testing. diff --git a/test/compress.c b/test/compress.c index af4edaf..2f15f93 100644 --- a/test/compress.c +++ b/test/compress.c @@ -35,13 +35,10 @@ static enum { f_partial = 0, f_mismatch, f_complete } failed; -static char *newsfn = "../NEWS"; +static const char *newsfn = "random.txt"; static int init(void) { - if (test_argc > 1) { - newsfn = ne_concat(test_argv[1], "/../NEWS", NULL); - } return lookup_localhost(); } diff --git a/test/run-tests.sh b/test/run-tests.sh new file mode 100644 index 0000000..2a9c1b2 --- /dev/null +++ b/test/run-tests.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# +# This script can be used to run the installed neon test suite +# against an installed copy of the neon library. +# + +# enable glibc malloc safety checks +MALLOC_CHECK_=2 +export MALLOC_CHECK_ + +cd data + +if test -x ../bin/ssl; then + rm -rf ca + + echo "INIT: generating SSL ceritifcates..." + if sh ./makekeys.sh 2> makekeys.out; then :; else + echo FAIL: could not generate SSL certificates + exit 2 + fi +fi + +for t in ../bin/*; do + if ${t}; then :; else + echo FAIL: ${t} + exit 1 + fi +done + +echo "PASS: all tests passed" + +exit 0 |