1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

tests: Make run_tests -X more flexible - it now works with onnode

Hardcoding "sh -x" is suboptimal because some scripts, like onnode,
require bash.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 246809af64c03d26288abff5907ed46614e72b15)
This commit is contained in:
Martin Schwenke 2012-04-20 16:43:17 +10:00
parent 6764b7b33e
commit 6757ad62f4
4 changed files with 19 additions and 12 deletions

View File

@ -698,7 +698,11 @@ simple_test ()
_extra_header=$(_extra_header)
echo "Running eventscript \"$script $event${1:+ }$*\""
_out=$($TEST_COMMAND_TRACE "${CTDB_BASE}/events.d/$script" "$event" "$@" 2>&1)
_trace=""
if $TEST_COMMAND_TRACE ; then
_trace="sh -x"
fi
_out=$($_trace "${CTDB_BASE}/events.d/$script" "$event" "$@" 2>&1)
result_check "$_extra_header"
}

View File

@ -26,13 +26,11 @@ Examples:
Run only the specified tests.
* ONNODE="bash -x stubs/onnode-buggy-001" ../run_tests.sh ./0090.sh
ONNODE="bash -x ../../tools/onnode" ../run_tests.sh ./0090.sh
* ONNODE="stubs/onnode-buggy-001" ../run_tests.sh -X ./0090.sh
../run_tests.sh -X ./0090.sh
Debug the specified test or test failure. The test will fail
because the bash trace output will be included in the test output.
However, this at least makes it easy to trace onnode while running
the test...
Debug the specified test or test failure by tracing onnode with
"bash -x". The test will fail because the bash trace output will be
included in the test output.
To see if the test pases, the -x can be dropped... so command-line
editing can be kept to a minimum.
To see if the test pases, the -X can be dropped...

View File

@ -67,7 +67,12 @@ simple_test ()
_sort="sort"
fi
_out=$("$@" 2>&1)
if $TEST_COMMAND_TRACE ; then
_onnode=$(which "$1") ; shift
_out=$(bash -x "$_onnode" "$@" 2>&1)
else
_out=$("$@" 2>&1)
fi
_rc=$?
_out=$(echo "$_out" | $_sort )

View File

@ -35,7 +35,7 @@ exit_on_fail=false
no_header=false
export TEST_VERBOSE=false
export TEST_COMMAND_TRACE=""
export TEST_COMMAND_TRACE=false
export TEST_CAT_RESULTS_OPTS=""
export TEST_DIFF_RESULTS=false
export TEST_LOCAL_DAEMONS # No default, developer can "override"!
@ -55,7 +55,7 @@ while true ; do
-q) quiet=true ; shift ;;
-s) with_summary=true ; shift ;;
-v) TEST_VERBOSE=true ; shift ;;
-X) TEST_COMMAND_TRACE="sh -x" ; shift ;;
-X) TEST_COMMAND_TRACE=true ; shift ;;
-A) TEST_CAT_RESULTS_OPTS="-A" ; shift ;;
-D) TEST_DIFF_RESULTS=true ; shift ;;
-H) no_header=true ; shift ;;