summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2016-01-17 12:23:05 -0600
committerNicolas Williams <nico@cryptonector.com>2016-01-17 12:45:01 -0600
commitc514368f98da1c9d1d59f6026061f81c22317eb7 (patch)
tree67529010e61534aa74c09b2c596badd6d9951990
parent062f86a625a2ec3dbf2a24a18fa5015fd8222674 (diff)
Make it possible to run tests with set -x
One can now run: make TRACE_TESTS=1 check to get detailed output
-rwxr-xr-xtests/jqtest2
-rwxr-xr-xtests/mantest2
-rwxr-xr-xtests/onigtest2
-rwxr-xr-xtests/optionaltest2
-rwxr-xr-xtests/setup4
-rwxr-xr-xtests/shtest2
6 files changed, 9 insertions, 5 deletions
diff --git a/tests/jqtest b/tests/jqtest
index 8df5f110..2420e037 100755
--- a/tests/jqtest
+++ b/tests/jqtest
@@ -1,5 +1,5 @@
#!/bin/sh
-. "${0%/*}/setup"
+. "${0%/*}/setup" "$@"
$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/jq.test
diff --git a/tests/mantest b/tests/mantest
index 46aae405..c5acf925 100755
--- a/tests/mantest
+++ b/tests/mantest
@@ -1,6 +1,6 @@
#!/bin/sh
-. "${0%/*}/setup"
+. "${0%/*}/setup" "$@"
# We set PAGER because there's a mantest for `env` that uses it.
(cd $JQBASEDIR/docs && rake mantests) |
diff --git a/tests/onigtest b/tests/onigtest
index 55c26bd2..f4521938 100755
--- a/tests/onigtest
+++ b/tests/onigtest
@@ -1,5 +1,5 @@
#!/bin/sh
-. "${0%/*}/setup"
+. "${0%/*}/setup" "$@"
$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/onig.test
diff --git a/tests/optionaltest b/tests/optionaltest
index b2444a40..1de0a495 100755
--- a/tests/optionaltest
+++ b/tests/optionaltest
@@ -1,5 +1,5 @@
#!/bin/sh
-. "${0%/*}/setup"
+. "${0%/*}/setup" "$@"
$VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/optional.test
diff --git a/tests/setup b/tests/setup
index d64ba29c..94bcf1eb 100755
--- a/tests/setup
+++ b/tests/setup
@@ -2,6 +2,10 @@
# This is meant to be included by each test's shell script driver.
+if [ -n "$TRACE_TESTS" ]; then
+ set -x
+fi
+
set -eu
JQTESTDIR=$(cd "$(dirname "$0")" && pwd)
diff --git a/tests/shtest b/tests/shtest
index 89ae6177..2614e900 100755
--- a/tests/shtest
+++ b/tests/shtest
@@ -1,6 +1,6 @@
#!/bin/sh
-. "${0%/*}/setup"
+. "${0%/*}/setup" "$@"
PATH=$JQBASEDIR:$PATH $JQBASEDIR/tests/jq-f-test.sh > /dev/null