Add new keyword to dump the log file after any test fails. Can be useful
for remote analysis of test failures.
Signed-off-by: David Sterba <dsterba@suse.com>
# EXTRA_CFLAGS additional compiler flags
# EXTRA_LDFLAGS additional linker flags
#
# EXTRA_CFLAGS additional compiler flags
# EXTRA_LDFLAGS additional linker flags
#
+# Testing-specific options (see also tests/README.md):
+# TEST=GLOB run test(s) from directories matching GLOB
+# TEST_LOG=tty print name of a command run via the execution helpers
+# TEST_LOG=dump dump testing log file when a test fails
+#
# Static checkers:
# CHECKER static checker binary to be called (default: sparse)
# CHECKER_FLAGS flags to pass to CHECKER, can override CFLAGS
# Static checkers:
# CHECKER static checker binary to be called (default: sparse)
# CHECKER_FLAGS flags to pass to CHECKER, can override CFLAGS
-Setting the variable `TEST_LOG=tty` will print all commands executed by some of
-the wrappers (`run_check` etc), other commands are not printed to the terminal
-(but the full output is in the log).
+* `TEST_LOG=tty` -- setting the variable will print all commands executed by
+ some of the wrappers (`run_check` etc), other commands are not printed to the
+ terminal (but the full output is in the log)
+
+* `TEST_LOG=dump` -- dump the entire testing log when a test fails
+
+Multiple values can be separated by `,`.
echo " [TEST/cli] $name"
./test.sh
if [ $? -ne 0 ]; then
echo " [TEST/cli] $name"
./test.sh
if [ $? -ne 0 ]; then
+ if [[ $TEST_LOG =~ dump ]]; then
+ cat "$RESULTS"
+ fi
_fail "test failed for case $(basename $i)"
fi
fi
_fail "test failed for case $(basename $i)"
fi
fi
./test.sh
if [ $? -ne 0 ]; then
_fail "test failed for case $testname"
./test.sh
if [ $? -ne 0 ]; then
_fail "test failed for case $testname"
+ if [[ $TEST_LOG =~ dump ]]; then
+ cat "$RESULTS"
+ fi
fi
else
_fail "custom test script not found"
fi
else
_fail "custom test script not found"
# Type 2
./test.sh
if [ $? -ne 0 ]; then
# Type 2
./test.sh
if [ $? -ne 0 ]; then
+ if [[ $TEST_LOG =~ dump ]]; then
+ cat "$RESULTS"
+ fi
_fail "test failed for case $(basename $testname)"
fi
else
_fail "test failed for case $(basename $testname)"
fi
else
echo " [TEST/fuzz] $name"
./test.sh
if [ $? -ne 0 ]; then
echo " [TEST/fuzz] $name"
./test.sh
if [ $? -ne 0 ]; then
+ if [[ $TEST_LOG =~ dump ]]; then
+ cat "$RESULTS"
+ fi
_fail "test failed for case $(basename $i)"
fi
fi
_fail "test failed for case $(basename $i)"
fi
fi
if [ -x test.sh ]; then
./test.sh
if [ $? -ne 0 ]; then
if [ -x test.sh ]; then
./test.sh
if [ $? -ne 0 ]; then
+ if [[ $TEST_LOG =~ dump ]]; then
+ cat "$RESULTS"
+ fi
_fail "test failed for case $(basename $i)"
fi
fi
_fail "test failed for case $(basename $i)"
fi
fi
if [ -x test.sh ]; then
./test.sh
if [ $? -ne 0 ]; then
if [ -x test.sh ]; then
./test.sh
if [ $? -ne 0 ]; then
+ if [[ $TEST_LOG =~ dump ]]; then
+ cat "$RESULTS"
+ fi
_fail "test failed for case $(basename $i)"
fi
fi
_fail "test failed for case $(basename $i)"
fi
fi