diff --git a/changes/testscripts b/changes/testscripts new file mode 100644 index 0000000000..d3ac79f521 --- /dev/null +++ b/changes/testscripts @@ -0,0 +1,6 @@ + o Testing: + - Use environment variables rather than autoconf substitutions to send + variables from the build system to the test scripts. This change should + be easier to maintain, and cause 'make distcheck' to work better than + before. Fixes bug 17148. + diff --git a/configure.ac b/configure.ac index 98f8d30ea7..798de27f82 100644 --- a/configure.ac +++ b/configure.ac @@ -1647,9 +1647,6 @@ AC_CONFIG_FILES([ src/config/torrc.minimal scripts/maint/checkOptionDocs.pl scripts/maint/updateVersions.pl - src/test/test_zero_length_keys.sh - src/test/test_ntor.sh - src/test/test_bt.sh ]) if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then diff --git a/src/test/include.am b/src/test/include.am index f7c0204832..0b64299f42 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -1,4 +1,9 @@ +export PYTHON=@PYTHON@ +export SHELL=@SHELL@ +export abs_top_srcdir +export builddir + TESTSCRIPTS = src/test/test_zero_length_keys.sh if USEPYTHON @@ -16,18 +21,11 @@ TEST_CHUTNEY_FLAVORS_IPV6 = bridges+ipv6-min ipv6-exit-min TEST_CHUTNEY_FLAVORS_MIXED = mixed ### This is a lovely feature, but it requires automake >= 1.12, and Tor -### doesn't require that yet. Below is a kludge to work around. +### doesn't require that yet. ### # TEST_EXTENSIONS = .sh # SH_LOG_COMPILER = $(SHELL) -check-am: set-test-permissions - -.PHONY: set-test-permissions -set-test-permissions: $(TESTSCRIPTS) - $(AM_V_at)chmod u+x $(TESTSCRIPTS) - - noinst_PROGRAMS+= src/test/bench if UNITTESTS_ENABLED noinst_PROGRAMS+= \ @@ -194,4 +192,6 @@ EXTRA_DIST += \ src/test/ntor_ref.py \ src/test/slownacl_curve25519.py \ src/test/zero_length_keys.sh \ - src/test/test_keygen.sh + src/test/test_keygen.sh \ + src/test/test_zero_length_keys.sh \ + src/test/test_ntor.sh src/test/test_bt.sh diff --git a/src/test/test_bt.sh b/src/test/test_bt.sh new file mode 100755 index 0000000000..15d16cb4a6 --- /dev/null +++ b/src/test/test_bt.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Test backtrace functionality. + +exitcode=0 + +${builddir:-.}/src/test/test-bt-cl assert | ${PYTHON:-python} "${abs_top_srcdir:-.}/src/test/bt_test.py" || exitcode=1 +${builddir:-.}/src/test/test-bt-cl crash | ${PYTHON:-python} "${abs_top_srcdir:-.}/src/test/bt_test.py" || exitcode=1 + +exit ${exitcode} diff --git a/src/test/test_bt.sh.in b/src/test/test_bt.sh.in deleted file mode 100644 index ca8be965d4..0000000000 --- a/src/test/test_bt.sh.in +++ /dev/null @@ -1,9 +0,0 @@ -#!@SHELL@ -# Test backtrace functionality. - -exitcode=0 - -@builddir@/src/test/test-bt-cl assert | @PYTHON@ @abs_top_srcdir@/src/test/bt_test.py || exitcode=1 -@builddir@/src/test/test-bt-cl crash | @PYTHON@ @abs_top_srcdir@/src/test/bt_test.py || exitcode=1 - -exit ${exitcode} diff --git a/src/test/test_ntor.sh b/src/test/test_ntor.sh new file mode 100755 index 0000000000..3d9ef7aaa9 --- /dev/null +++ b/src/test/test_ntor.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Validate Tor's ntor implementation. + +exitcode=0 + +${PYTHON:-python} "${abs_top_srcdir:-.}/src/test/ntor_ref.py" test-tor || exitcode=1 +${PYTHON:-python} "${abs_top_srcdir:-.}/src/test/ntor_ref.py" self-test || exitcode=1 + +exit ${exitcode} diff --git a/src/test/test_ntor.sh.in b/src/test/test_ntor.sh.in deleted file mode 100644 index be35384ddf..0000000000 --- a/src/test/test_ntor.sh.in +++ /dev/null @@ -1,9 +0,0 @@ -#!@SHELL@ -# Validate Tor's ntor implementation. - -exitcode=0 - -@PYTHON@ @abs_top_srcdir@/src/test/ntor_ref.py test-tor || exitcode=1 -@PYTHON@ @abs_top_srcdir@/src/test/ntor_ref.py self-test || exitcode=1 - -exit ${exitcode} diff --git a/src/test/test_zero_length_keys.sh b/src/test/test_zero_length_keys.sh new file mode 100755 index 0000000000..5471cc9120 --- /dev/null +++ b/src/test/test_zero_length_keys.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Check that tor regenerates keys when key files are zero-length + +exitcode=0 + +${SHELL:-sh} "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/or/tor" -z || exitcode=1 +${SHELL:-sh} "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/or/tor" -d || exitcode=1 +${SHELL:-sh} "${abs_top_srcdir:-.}/src/test/zero_length_keys.sh" "${builddir:-.}/src/or/tor" -e || exitcode=1 + +exit ${exitcode} diff --git a/src/test/test_zero_length_keys.sh.in b/src/test/test_zero_length_keys.sh.in deleted file mode 100644 index d1492d5e20..0000000000 --- a/src/test/test_zero_length_keys.sh.in +++ /dev/null @@ -1,10 +0,0 @@ -#!@SHELL@ -# Check that tor regenerates keys when key files are zero-length - -exitcode=0 - -@SHELL@ @abs_top_srcdir@/src/test/zero_length_keys.sh "@builddir@/src/or/tor" -z || exitcode=1 -@SHELL@ @abs_top_srcdir@/src/test/zero_length_keys.sh "@builddir@/src/or/tor" -d || exitcode=1 -@SHELL@ @abs_top_srcdir@/src/test/zero_length_keys.sh "@builddir@/src/or/tor" -e || exitcode=1 - -exit ${exitcode}