The branch, master has been updated via 97e8b56 idmap_cache: Use gencache_parse via 89013af idmap_cache: Use an fstring instead of talloc_asprintf via 051fb91 messaging3: Do not go through messages.tdb for self-sends via 549b70e torture: enum snapshots after FSRVP creation via 29b730a test: add fake_snap.pl for snapshot simulation via b0bbb59 ctdb:tests: update README via 3c81066 ctdb/tests/scripts: Promote scripts/run_tests via 318f2cf ctdb/tests/scripts: Simplify the top-level test scripts via bbd46e8 ctdb/tests/scripts: Sort command-line options via f67a104 ctdb/tests/integration: Decentralise the daemon restart code via f05db5e ctdb/tests/integration: Update daemons shutdown pseudo-test via 6b15fe2 ctdb/tests/simple: Local daemons version of setup_ctdb() overrides via 85a711f ctdb/tests/integration: Remove some unused functions via a3fd8dd ctdb/tests/integration: Remove the time logging code via 28acce2 ctdb/tests/simple: Move the local daemons code to its own file via ef0e8cc ctdb/tests/integration: Update NFS tickles test and supporting code from de55856 lib/replace remove orphaned code
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 97e8b56250f30e73ad4bdcae292fe5c0df65e69a Author: Volker Lendecke <v...@samba.org> Date: Wed Dec 4 15:37:21 2013 +0000 idmap_cache: Use gencache_parse This avoids a few tallocs and brings down user CPU a bit more Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> Autobuild-User(master): Michael Adam <ob...@samba.org> Autobuild-Date(master): Thu Dec 5 03:06:10 CET 2013 on sn-devel-104 commit 89013af15aa45311510318b517de8986580f4e2f Author: Volker Lendecke <v...@samba.org> Date: Wed Dec 4 15:14:03 2013 +0000 idmap_cache: Use an fstring instead of talloc_asprintf In a test doing one million uid2sid calls this brings down user CPU from 1.3 seconds to 0.9 seconds. And it saves a few code lines. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 051fb9155642a8c74f892df3547203a55826d2b9 Author: Volker Lendecke <v...@samba.org> Date: Tue Dec 3 13:20:38 2013 +0000 messaging3: Do not go through messages.tdb for self-sends Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 549b70eb434889ba54d83776f3773f2eac513ba3 Author: David Disseldorp <dd...@samba.org> Date: Tue Dec 3 14:45:50 2013 +0100 torture: enum snapshots after FSRVP creation Issue an SMB2 ENUM_SNAPSHOTS ioctl following FSRVP snapshot creation to cover Explorer previous file version use-cases. This test will fail against Windows Server 2012, as FSRVP created snapshots are not exposed via the ENUM_SNAPSHOTS ioctl. Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 29b730a4487410e4bdb42d970dc21fe235dce654 Author: David Disseldorp <dd...@samba.org> Date: Tue Dec 3 14:45:49 2013 +0100 test: add fake_snap.pl for snapshot simulation The script simulates snapshots by simply copying file data from the base path to a snapshot path located under .snapshots/@GMT-%Y.%m.%d-%H.%M.%S/ Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit b0bbb59c49bd068a0a8feea76b2564da8cfabb11 Author: Michael Adam <ob...@samba.org> Date: Fri Nov 29 10:15:20 2013 +0100 ctdb:tests: update README explain how to run individual tests and test collections and remove mention of tests/scripts/run_tests which does not exist any more. Signed-off-by: Michael Adam <ob...@samba.org> Reviewed-by: Martin Schwenke <mar...@meltin.net> commit 3c81066105b70921a616feede33e7327c0f49c61 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Dec 2 15:39:48 2013 +1100 ctdb/tests/scripts: Promote scripts/run_tests The wrapper is not needed anymore. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit 318f2cf9123875acdef39d170cdbc6683a79e896 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Dec 2 15:37:18 2013 +1100 ctdb/tests/scripts: Simplify the top-level test scripts At the moment run_tests.sh has quite fragile argument processing. It needs that annoying "--" between options and tests. The random default (mktemp -d) for TEST_VAR_DIR is wrong and is worked around in various places. Instead: * Change the default behaviour to print a summary, add new option -N to turn off summary, and remove old -s option. * Change the default behaviour to run integration tests with local daemons, add new options -c to run on a cluster, remove old -l option. * Make $testdir/var the default if the tests are not installed, and $(mktemp -d ) the default if tests are installed. * Move the default tests for local/cluster into scripts/run_tests. run_tests.sh (and the run_cluster_tests.sh symlink) should behave as before but with slightly more reasonable defaults. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit bbd46e8634f5db7631ce80a4b81781adf507a383 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Dec 2 15:30:29 2013 +1100 ctdb/tests/scripts: Sort command-line options Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit f67a1043b381f623ec9c97ac137568ca7ab6cd8a Author: Martin Schwenke <mar...@meltin.net> Date: Fri Nov 29 14:07:43 2013 +1100 ctdb/tests/integration: Decentralise the daemon restart code Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit f05db5edc434da61bc7cd7233c5b9cb61cd888bf Author: Martin Schwenke <mar...@meltin.net> Date: Fri Nov 29 14:05:49 2013 +1100 ctdb/tests/integration: Update daemons shutdown pseudo-test Don't scatter the TEST_LOCAL_DAEMONS logic around the code. Limit it to the local daemons file. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit 6b15fe247c4c026064a8f412011d484d3b74bfc7 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Nov 28 17:27:06 2013 +1100 ctdb/tests/simple: Local daemons version of setup_ctdb() overrides setup_ctdb() doesn't need to do anything on a cluster. To avoid a conditional, just override it for local daemons. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit 85a711f5a8e9aaea42595cc53998a250b0ff6469 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Nov 28 17:26:09 2013 +1100 ctdb/tests/integration: Remove some unused functions This was the start of some refactorisation that was never completed. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit a3fd8ddf3586f5e255df181d9b4e998f3c85e928 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Nov 28 17:11:03 2013 +1100 ctdb/tests/integration: Remove the time logging code This hasn't been required for a long time and is probably broken. If it is needed in future then we know where to find it. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit 28acce28626d17c27af831240a5ea593e0410616 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Nov 28 17:08:43 2013 +1100 ctdb/tests/simple: Move the local daemons code to its own file This is just a straight move. The clever stuff will follow. :-) Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> commit ef0e8cc1928dbd12c862a5e96710471ce3b4d023 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Nov 28 16:43:55 2013 +1100 ctdb/tests/integration: Update NFS tickles test and supporting code This currently requires an eventscript to be dynamically installed. This eventscript is only used to help determine when a monitor event has occurred. This code is horrible and fragile. A better way is to just monitor the output of "ctdb scriptstatus". When changes it changes then a monitor event has occurred. Also remove the old code that checks for tickle information in shared storage. CTDB hasn't done things this way for a long time. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Michael Adam <ob...@samba.org> ----------------------------------------------------------------------- Summary of changes: ctdb/tests/README | 28 ++- ctdb/tests/complex/31_nfs_tickle.sh | 28 +-- ctdb/tests/run_tests.sh | 335 +++++++++++++++++++--- ctdb/tests/scripts/integration.bash | 405 ++------------------------ ctdb/tests/scripts/run_tests | 283 ------------------ ctdb/tests/simple/00_ctdb_onnode.sh | 9 - ctdb/tests/simple/99_daemons_shutdown.sh | 6 +- ctdb/tests/simple/scripts/local.bash | 3 + ctdb/tests/simple/scripts/local_daemons.bash | 135 +++++++++ source3/lib/idmap_cache.c | 97 ++++--- source3/lib/messages_local.c | 54 ++++ source3/script/tests/fake_snap.pl | 70 +++++ source4/torture/rpc/fsrvp.c | 102 +++++++- 13 files changed, 771 insertions(+), 784 deletions(-) delete mode 100755 ctdb/tests/scripts/run_tests create mode 100644 ctdb/tests/simple/scripts/local.bash create mode 100644 ctdb/tests/simple/scripts/local_daemons.bash create mode 100755 source3/script/tests/fake_snap.pl Changeset truncated at 500 lines: diff --git a/ctdb/tests/README b/ctdb/tests/README index 1c9983b..92b637a 100644 --- a/ctdb/tests/README +++ b/ctdb/tests/README @@ -19,12 +19,30 @@ also pass options, which are then passed to run_tests. However, if you just try to pass options to run_tests then you lose the default list of tests that are run. You can't have everything... -scripts/run_tests ------------------ +tests/run_tests.sh +------------------ -The above scripts invoke tests/scripts/run_tests. This script has a -lot of command-line switches. Some of the more useful options -include: +This script can be used to manually run all or selected unit tests and +simple integration tests against local daemons. Test selection is done +by specifying optional call parameters. If no parameter is given, +all unit tests and simple integration tests are run. + +This runs all unit tests of the "tool" category: + + ./tests/run_tests.sh tool + +In order to run a single test, one simply specifies the path of the +test script to run as the last parameter, e.g.: + + ./tests/run_tests.sh ./tests/eventscripts/00.ctdb.monitor.001 + ./tests/run_tests.sh ./tests/simple/76_ctdb_pdb_recovery.sh + +One can also specify multiple test suites and tests: + + ./tests/run_tests.sh eventscripts tool ./tests/onnode/0001.sh + +The script also has number of command-line switches. +Some of the more useful options include: -s Print a summary of tests results after running all tests diff --git a/ctdb/tests/complex/31_nfs_tickle.sh b/ctdb/tests/complex/31_nfs_tickle.sh index ce4ae81..b5ed47e 100755 --- a/ctdb/tests/complex/31_nfs_tickle.sh +++ b/ctdb/tests/complex/31_nfs_tickle.sh @@ -52,11 +52,7 @@ cluster_is_healthy # Reset configuration ctdb_restart_when_done -ctdb_test_exit_hook_add ctdb_test_eventscript_uninstall - -ctdb_test_eventscript_install - -# We need this for later, so we know how long to sleep. +# We need this for later, so we know how long to run nc for. try_command_on_node any $CTDB getvar MonitorInterval monitor_interval="${out#*= }" #echo "Monitor interval on node $test_node is $monitor_interval seconds." @@ -81,27 +77,7 @@ echo "Sleeping until tickles are synchronised across nodes..." try_command_on_node $test_node $CTDB getvar TickleUpdateInterval sleep_for "${out#*= }" -if try_command_on_node any "test -r /etc/ctdb/events.d/61.nfstickle" ; then - echo "Trying to determine NFS_TICKLE_SHARED_DIRECTORY..." - if [ -f /etc/sysconfig/nfs ]; then - f="/etc/sysconfig/nfs" - elif [ -f /etc/default/nfs ]; then - f="/etc/default/nfs" - elif [ -f /etc/ctdb/sysconfig/nfs ]; then - f="/etc/ctdb/sysconfig/nfs" - fi - try_command_on_node -v any "[ -r $f ] && sed -n -e s@^NFS_TICKLE_SHARED_DIRECTORY=@@p $f" || true - - nfs_tickle_shared_directory="${out:-/gpfs/.ctdb/nfs-tickles}" - - try_command_on_node $test_node hostname - test_hostname=$out - - try_command_on_node -v any cat "${nfs_tickle_shared_directory}/$test_hostname/$test_ip" -else - echo "That's OK, we'll use \"ctdb gettickles\", which is newer..." - try_command_on_node -v any "ctdb -Y gettickles $test_ip $test_port" -fi +try_command_on_node -v any "ctdb -Y gettickles $test_ip $test_port" if [ "${out/${src_socket}/}" != "$out" ] ; then echo "GOOD: NFS connection tracked OK." diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index 5fcd89d..2ff11ff 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -1,46 +1,311 @@ -#!/bin/sh +#!/bin/bash -test_dir=$(dirname "$0") +usage() { + cat <<EOF +Usage: $0 [OPTIONS] [TESTS] + +Options: + -A Use "cat -A" to print test output (only some tests) + -c Run integration tests on a cluster + -C Clean up - kill daemons and remove TEST_VAR_DIR when done + -d Print descriptions of tests instead of filenames (dodgy!) + -D Show diff between failed/expected test output (some tests only) + -e Exit on the first test failure + -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 + -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 + -X Trace certain scripts run by tests using -x (only some tests) +EOF + exit 1 +} + +# Print a message and exit. +die () +{ + echo "$1" >&2 ; exit ${2:-1} +} + +###################################################################### + +with_summary=true +with_desc=false +quiet=false +exit_on_fail=false +no_header=false +socket_wrapper=false + +export TEST_VERBOSE=false +export TEST_COMMAND_TRACE=false +export TEST_CAT_RESULTS_OPTS="" +export TEST_DIFF_RESULTS=false +export TEST_LOCAL_DAEMONS +[ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3 +export TEST_VAR_DIR="" +export TEST_CLEANUP=false + +temp=$(getopt -n "$prog" -o "AcCdDehHNqSvV:xX" -l help -- "$@") + +[ $? != 0 ] && usage + +eval set -- "$temp" + +while true ; do + case "$1" in + -A) TEST_CAT_RESULTS_OPTS="-A" ; shift ;; + -c) TEST_LOCAL_DAEMONS="" ; shift ;; + -C) TEST_CLEANUP=true ; shift ;; + -d) with_desc=true ; shift ;; # 4th line of output is description + -D) TEST_DIFF_RESULTS=true ; shift ;; + -e) exit_on_fail=true ; shift ;; + -H) no_header=true ; shift ;; + -N) with_summary=false ; shift ;; + -q) quiet=true ; shift ;; + -S) socket_wrapper=true ; shift ;; + -v) TEST_VERBOSE=true ; shift ;; + -V) TEST_VAR_DIR="$2" ; shift 2 ;; + -x) set -x; shift ;; + -X) TEST_COMMAND_TRACE=true ; shift ;; + --) shift ; break ;; + *) usage ;; + esac +done case $(basename "$0") in *run_cluster_tests*) - # Running on a cluster: - # * print summary, run any integration tests against cluster - # * default to running: all integration tests, no unit tests - opts="-s" - tests="simple complex" + # Running on a cluster... same as -c + TEST_LOCAL_DAEMONS="" ;; - *) - # Running on local machine: - # * print summary, run any integration tests against local daemons - # * default to running: all unit tests, simple integration tests - opts="-s -l" - tests="onnode takeover tool eventscripts simple" - # If running in the source tree then use a fixed TEST_VAR_DIR. - # If this script is installed using the INSTALL script then - # TEST_BIN_DIR will be set, so use this as the test. - if [ -z "$TEST_BIN_DIR" ] ; then - opts="${opts} -V ${test_dir}/var" - fi esac -# Allow options to be passed to this script. However, if any options -# are passed there must be a "--" between the options and the tests. -# This makes it easy to handle options that take arguments. -case "$1" in - -*) - while [ -n "$1" ] ; do - case "$1" in - --) shift ; break ;; - *) opts="$opts $1" ; shift ;; - esac +if $quiet ; then + show_progress() { cat >/dev/null ; } +else + show_progress() { cat ; } +fi + +###################################################################### + +ctdb_test_begin () +{ + local name="$1" + + teststarttime=$(date '+%s') + testduration=0 + + echo "--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--" + echo "Running test $name ($(date '+%T'))" + echo "--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--" +} + +ctdb_test_end () +{ + local name="$1" ; shift + local status="$1" ; shift + # "$@" is command-line + + local interp="SKIPPED" + local statstr=" (reason $*)" + if [ -n "$status" ] ; then + if [ $status -eq 0 ] ; then + interp="PASSED" + statstr="" + echo "ALL OK: $*" + else + interp="FAILED" + statstr=" (status $status)" + fi + fi + + testduration=$(($(date +%s)-$teststarttime)) + + echo "==========================================================================" + echo "TEST ${interp}: ${name}${statstr} (duration: ${testduration}s)" + echo "==========================================================================" + +} + +ctdb_test_run () +{ + local name="$1" ; shift + + [ -n "$1" ] || set -- "$name" + + $no_header || ctdb_test_begin "$name" + + local status=0 + "$@" || status=$? + + $no_header || ctdb_test_end "$name" "$status" "$*" + + return $status +} + +###################################################################### + +tests_total=0 +tests_passed=0 +tests_failed=0 +summary="" + +if ! which mktemp >/dev/null 2>&1 ; then + # Not perfect, but it will do... + mktemp () + { + _dir=false + if [ "$1" = "-d" ] ; then + _dir=true + fi + _t="${TMPDIR:-/tmp}/tmp.$$.$RANDOM" + ( + umask 077 + if $_dir ; then + mkdir "$_t" + else + >"$_t" + fi + ) + echo "$_t" + } +fi + +tf=$(mktemp) +sf=$(mktemp) + +set -o pipefail + +run_one_test () +{ + _f="$1" + + [ -x "$_f" ] || die "test \"$_f\" is not executable" + tests_total=$(($tests_total + 1)) + + ctdb_test_run "$_f" | tee "$tf" | show_progress + status=$? + if [ $status -eq 0 ] ; then + tests_passed=$(($tests_passed + 1)) + else + tests_failed=$(($tests_failed + 1)) + fi + if $with_summary ; then + if [ $status -eq 0 ] ; then + _t=" PASSED " + else + _t="*FAILED*" + fi + if $with_desc ; then + desc=$(tail -n +4 $tf | head -n 1) + _f="$desc" + fi + echo "$_t $_f" >>"$sf" + fi +} + +find_and_run_one_test () +{ + _t="$1" + _dir="$2" + + _f="${_dir}${_dir:+/}${_t}" + + if [ -d "$_f" ] ; then + for _i in $(ls "${_f%/}/"*".sh" 2>/dev/null) ; do + run_one_test "$_i" + if $exit_on_fail && [ $status -ne 0 ] ; then + break + fi done -esac + # No tests found? Not a tests directory! Not found... + [ -n "$status" ] || status=127 + elif [ -f "$_f" ] ; then + run_one_test "$_f" + else + status=127 + fi +} + +# Following 2 lines may be modified by installation script +export CTDB_TESTS_ARE_INSTALLED=false +test_dir=$(dirname "$0") + +if [ -z "$TEST_VAR_DIR" ] ; then + if $CTDB_TESTS_ARE_INSTALLED ; then + TEST_VAR_DIR=$(mktemp -d) + else + TEST_VAR_DIR="${test_dir}/var" + fi +fi +mkdir -p "$TEST_VAR_DIR" + +# Must be absolute +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="${test_dir}/scripts" + +# If no tests specified then run some defaults +if [ -z "$1" ] ; then + if [ -n "$TEST_LOCAL_DAEMONS" ] ; then + set -- onnode takeover tool eventscripts simple + else + set -- simple complex + fi +fi + +for f ; do + find_and_run_one_test "$f" + + if [ $status -eq 127 ] ; then + # Find the the top-level tests directory + tests_dir=$(dirname $(cd $TEST_SCRIPTS_DIR; echo $PWD)) + # Strip off current directory from beginning, if there, just + # to make paths more friendly. + tests_dir=${tests_dir#$PWD/} + find_and_run_one_test "$f" "$tests_dir" + fi + + if [ $status -eq 127 ] ; then + die "test \"$f\" is not recognised" + fi + + if $exit_on_fail && [ $status -ne 0 ] ; then + break + fi +done + +rm -f "$tf" + +if $with_summary ; then + echo + cat "$sf" + echo + echo "${tests_passed}/${tests_total} tests passed" +fi + +rm -f "$sf" -# If no tests are specified, then run the defaults. -[ -n "$1" ] || set -- $tests +echo -"${test_dir}/scripts/run_tests" $opts "$@" || exit 1 +if $TEST_CLEANUP ; then + echo "Removing TEST_VAR_DIR=$TEST_VAR_DIR" + rm -rf "$TEST_VAR_DIR" +else + echo "Not cleaning up TEST_VAR_DIR=$TEST_VAR_DIR" +fi -echo "All OK" -exit 0 +if $no_header || $exit_on_fail ; then + exit $status +elif [ $tests_failed -gt 0 ] ; then + exit 1 +else + exit 0 +fi diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index c98d511..665fc7d 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -2,24 +2,6 @@ . "${TEST_SCRIPTS_DIR}/common.sh" -# If we're not running on a real cluster then we need a local copy of -# ctdb (and other stuff) in $PATH and we will use local daemons. -if [ -n "$TEST_LOCAL_DAEMONS" ] ; then - export CTDB_NODES_SOCKETS="" - for i in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do - CTDB_NODES_SOCKETS="${CTDB_NODES_SOCKETS}${CTDB_NODES_SOCKETS:+ }${TEST_VAR_DIR}/sock.${i}" - done - - # Use in-tree binaries if running against local daemons. - # Otherwise CTDB need to be installed on all nodes. - if [ -n "$ctdb_dir" -a -d "${ctdb_dir}/bin" ] ; then - PATH="${ctdb_dir}/bin:${PATH}" - export CTDB_LOCK_HELPER="${ctdb_dir}/bin/ctdb_lock_helper" - fi - - export CTDB_NODES="${TEST_VAR_DIR}/nodes.txt" -fi - ###################################################################### export CTDB_TIMEOUT=60 @@ -41,54 +23,6 @@ PATH="${TEST_SCRIPTS_DIR}:${PATH}" ###################################################################### -ctdb_check_time_logs () -{ - local threshold=20 - - local jump=false - local prev="" - local ds_prev="" - local node="" - - out=$(onnode all tail -n 20 "${TEST_VAR_DIR}/ctdb.test.time.log" 2>&1) - - if [ $? -eq 0 ] ; then - local line - while read line ; do - case "$line" in - \>\>\ NODE:\ *\ \<\<) - node="${line#>> NODE: }" - node=${node% <<*} - ds_prev="" - ;; - *\ *) - set -- $line - ds_curr="$1${2:0:1}" - if [ -n "$ds_prev" ] && \ - [ $(($ds_curr - $ds_prev)) -ge $threshold ] ; then - echo "Node $node had time jump of $(($ds_curr - $ds_prev))ds between $(date +'%T' -d @${ds_prev%?}) and $(date +'%T' -d @${ds_curr%?})" - jump=true - fi - prev="$line" - ds_prev="$ds_curr" -- Samba Shared Repository