The branch, master has been updated via 8b82d10 ctdb-tests: Fix a typo via 50150d7 ctdb-tests: Add a UNIT pseudo-test-suite via e17d02d ctdb-tests: Only use socket-wrapper for simple, local daemon tests via da3aaf9 ctdb-tests: Add timeout for individual tests, default is 10 minutes from 7ea5d38 libnmb: Move "read_packet" to nmbd
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 8b82d10856160d3b3f172bf7d45ac561002dbcac Author: Martin Schwenke <mar...@meltin.net> Date: Tue Jan 23 20:18:54 2018 +1100 ctdb-tests: Fix a typo This typo causes the script to be run with the default shell. If this is not bash then the shell will fail to parse integration.bash. This is a regression caused by commit c607989d91b64d837253aae794b1a3d6013eb3e0. Clearly nobody has run this test on Debian for a long time. :-( Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Wed Jan 24 10:28:52 CET 2018 on sn-devel-144 commit 50150d75814de6a1e2cb28fb7af72caa31d73e3c Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jan 22 19:48:02 2018 +1100 ctdb-tests: Add a UNIT pseudo-test-suite This runs all of the unit tests. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit e17d02d4039001563d189b33200c30e3906ce845 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jan 22 19:14:48 2018 +1100 ctdb-tests: Only use socket-wrapper for simple, local daemon tests The run_tests.sh -S option now takes the path to the socker-wrapper shared library. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit da3aaf972ab5b339b51ba1e802329b69885ccfe4 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jan 20 17:05:37 2018 +1100 ctdb-tests: Add timeout for individual tests, default is 10 minutes This will cause a hung test to time out and fail rather than letting a test run hang indefinitely. Some tests can take 5 minutes to run, so 10 minutes should be plenty. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/tests/run_tests.sh | 52 ++++++++++++++++++++-------- ctdb/tests/simple/14_ctdb_statistics.sh | 1 - ctdb/tests/simple/scripts/local_daemons.bash | 6 ++++ ctdb/wscript | 3 +- 4 files changed, 44 insertions(+), 18 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index ffc81d4..a2a44a1 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -14,7 +14,7 @@ Options: -H No headers - for running single test with other wrapper -N Don't print summary of tests results after running all tests -q Quiet - don't show tests being run (hint: use with -s) - -S Enable socket wrapper + -S <lib> Use socket wrapper library <lib> for local integration tests -v Verbose - print test output for non-failures (only some tests) -V <dir> Use <dir> as TEST_VAR_DIR -x Trace this script with the -x option @@ -36,7 +36,6 @@ with_desc=false quiet=false exit_on_fail=false no_header=false -socket_wrapper=false export TEST_VERBOSE=false export TEST_COMMAND_TRACE=false @@ -46,8 +45,10 @@ export TEST_LOCAL_DAEMONS [ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3 export TEST_VAR_DIR="" export TEST_CLEANUP=false +export TEST_TIMEOUT=600 +export TEST_SOCKET_WRAPPER_SO_PATH="" -temp=$(getopt -n "$prog" -o "AcCdDehHNqSvV:xX" -l help -- "$@") +temp=$(getopt -n "$prog" -o "AcCdDehHNqS:T:vV:xX" -l help -- "$@") [ $? != 0 ] && usage @@ -64,7 +65,8 @@ while true ; do -H) no_header=true ; shift ;; -N) with_summary=false ; shift ;; -q) quiet=true ; shift ;; - -S) socket_wrapper=true ; shift ;; + -S) TEST_SOCKET_WRAPPER_SO_PATH="$2" ; shift 2 ;; + -T) TEST_TIMEOUT="$2" ; shift 2 ;; -v) TEST_VERBOSE=true ; shift ;; -V) TEST_VAR_DIR="$2" ; shift 2 ;; -x) set -x; shift ;; @@ -114,6 +116,9 @@ ctdb_test_end () interp="PASSED" statstr="" echo "ALL OK: $*" + elif [ $status -eq 124 ] ; then + interp="TIMEOUT" + statstr=" (status $status)" else interp="FAILED" statstr=" (status $status)" @@ -137,7 +142,7 @@ ctdb_test_run () $no_header || ctdb_test_begin "$name" local status=0 - "$@" || status=$? + timeout $TEST_TIMEOUT "$@" || status=$? $no_header || ctdb_test_end "$name" "$status" "$*" @@ -247,20 +252,25 @@ mkdir -p "$TEST_VAR_DIR" TEST_VAR_DIR=$(cd "$TEST_VAR_DIR"; echo "$PWD") echo "TEST_VAR_DIR=$TEST_VAR_DIR" -if $socket_wrapper ; then - export SOCKET_WRAPPER_DIR="${TEST_VAR_DIR}/sw" - mkdir -p "$SOCKET_WRAPPER_DIR" -fi - export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts" +unit_tests=" + cunit + eventd + eventscripts + onnode + shellcheck + takeover + takeover_helper + tool +" + # If no tests specified then run some defaults if [ -z "$1" ] ; then - if [ -n "$TEST_LOCAL_DAEMONS" ] ; then - set -- onnode takeover takeover_helper tool eventscripts \ - cunit eventd shellcheck simple - else - set -- simple complex + if [ -n "$TEST_LOCAL_DAEMONS" ] ; then + set -- UNIT simple + else + set -- simple complex fi fi @@ -287,7 +297,19 @@ cleanup_handler () trap cleanup_handler SIGINT SIGTERM +declare -a tests +i=0 for f ; do + if [ "$f" = "UNIT" ] ; then + for t in $unit_tests ; do + tests[i++]="$t" + done + else + tests[i++]="$f" + fi +done + +for f in "${tests[@]}" ; do find_and_run_one_test "$f" if [ $status -eq 127 ] ; then diff --git a/ctdb/tests/simple/14_ctdb_statistics.sh b/ctdb/tests/simple/14_ctdb_statistics.sh index 3dd55e0..5ff22d7 100755 --- a/ctdb/tests/simple/14_ctdb_statistics.sh +++ b/ctdb/tests/simple/14_ctdb_statistics.sh @@ -1,4 +1,3 @@ - #!/bin/bash test_info() diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash index a0c8077..512d11f 100644 --- a/ctdb/tests/simple/scripts/local_daemons.bash +++ b/ctdb/tests/simple/scripts/local_daemons.bash @@ -17,6 +17,12 @@ fi export CTDB_NODES="${TEST_VAR_DIR}/nodes.txt" +if [ -n "$TEST_SOCKET_WRAPPER_SO_PATH" ] ; then + export LD_PRELOAD="$TEST_SOCKET_WRAPPER_SO_PATH" + export SOCKET_WRAPPER_DIR="${TEST_VAR_DIR}/sw" + mkdir -p "$SOCKET_WRAPPER_DIR" +fi + ####################################### config_from_environment () diff --git a/ctdb/wscript b/ctdb/wscript index 715ecb1..059ce3d 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -986,8 +986,7 @@ def test(ctx): def autotest(ctx): env = samba_utils.LOAD_ENVIRONMENT() - ld = 'LD_PRELOAD=%s' % env.SOCKET_WRAPPER_SO_PATH - cmd = '%s tests/run_tests.sh -e -S -C' % ld + cmd = 'tests/run_tests.sh -e -S %s -C' % env.SOCKET_WRAPPER_SO_PATH ret = samba_utils.RUN_COMMAND(cmd) if ret != 0: print('autotest exited with exit status %d' % ret) -- Samba Shared Repository