[PATCHSET] enable ctdb's selftest in autobuild
Michael Adam
obnox at samba.org
Mon Nov 25 09:29:37 MST 2013
Note that this implements not the samba+ctdb testing
but the selfcontained ctdb-selftest.
It is a step in the right direction.
The more complicated samba+ctdb selftest environment comes next...
Cheers - Michael
On 2013-11-25 at 17:21 +0100, Michael Adam wrote:
> Hi List,
>
> attached is a patchset, I have been pair- and
> ping-pong-programming with Martin and Amitay during
> the last week or so.
>
> It enables ctdb selftest in samba's autobuild.
> This was a little more subtle than originally
> anticipated because ctdb's "make test " assumed
> that there was only one test run at a time, and
> because we had to debug a few test cases failing
> in autobuild that were passing when called from
> the bash command line. The reason was different
> SIGPIPE handling in the interactive shell and
> python. So now with these tests passing, the
> test code is also closer to the realy world, since
> ctdbd also ignores SIGPIPE like python.
>
> Note: In order to run a ctdb autobuild without having
> to wait for the initial random sleep, you can do this:
>
> AUTOBUILD_RANDOM_SLEEP_OVERRIDE=1 TDB_NO_FSYNC=1 \
> ./script/autobuild.py --testbase=/some/path --tail --keeplogs ctdb
>
> Review and push appreciated.
>
> Cheers - Michael
>
>
> From 03e3cb8b52ff55b3c0385c60c806071e1ec43d5c Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Thu, 14 Nov 2013 20:36:52 +1100
> Subject: [PATCH 01/15] ctdb:tests/integration: Be more careful when killing
> ctdbd
>
> Also match $TEST_VAR_DIR in the socket name. This means that we'll
> only ever kill ctdbd process belong to our own test run.
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/scripts/integration.bash | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
> index 040a360..e3636e8 100644
> --- a/ctdb/tests/scripts/integration.bash
> +++ b/ctdb/tests/scripts/integration.bash
> @@ -514,7 +514,7 @@ daemons_stop ()
> echo "Sleeping for a while..."
> sleep_for 1
>
> - local pat="ctdbd --socket=.* --nlist .* --nopublicipcheck"
> + local pat="ctdbd --socket=${TEST_VAR_DIR}/.* --nlist .* --nopublicipcheck"
> if pgrep -f "$pat" >/dev/null ; then
> echo "Killing remaining daemons..."
> pkill -f "$pat"
> --
> 1.7.9.5
>
>
> From bb17a3098d4454fbdd71d3dc3195df27f22b186f Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Fri, 15 Nov 2013 12:22:05 +1100
> Subject: [PATCH 02/15] ctdb:tests: remove unused setup_nmap_output_filter()
>
> The tests that used it have gone.
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/eventscripts/scripts/local.sh | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
> index e6186a0..4c3f0b1 100644
> --- a/ctdb/tests/eventscripts/scripts/local.sh
> +++ b/ctdb/tests/eventscripts/scripts/local.sh
> @@ -200,11 +200,6 @@ ethtool_interfaces_up ()
> done
> }
>
> -setup_nmap_output_filter ()
> -{
> - OUT_FILTER="-e 's@^(DEBUG: # Nmap 5.21 scan initiated) .+ (as:)@\1 DATE \2@' -e 's@^(DEBUG: # Nmap done at) .+ (--)@\1 DATE \2@'"
> -}
> -
> dump_routes ()
> {
> echo "# ip rule show"
> --
> 1.7.9.5
>
>
> From 71d4e7972d8e23cc913ee39f044e3f3ef7009221 Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Fri, 15 Nov 2013 12:22:05 +1100
> Subject: [PATCH 03/15] ctdb:tests: Rework unit test result filtering
>
> Using a variable is too fragile, so use a function instead.
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/eventscripts/scripts/local.sh | 6 +-----
> ctdb/tests/scripts/unit.sh | 22 +++++++++++++++++-----
> ctdb/tests/takeover/scripts/local.sh | 3 ---
> ctdb/tests/tool/scripts/local.sh | 6 ------
> 4 files changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
> index 4c3f0b1..2b4bc92 100644
> --- a/ctdb/tests/eventscripts/scripts/local.sh
> +++ b/ctdb/tests/eventscripts/scripts/local.sh
> @@ -1012,11 +1012,7 @@ iterate_test ()
> _out=$($_shell "${CTDB_BASE}/events.d/$script" "$event" $args 2>&1)
> _rc=$?
>
> - if [ -n "$OUT_FILTER" ] ; then
> - _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
> - else
> - _fout="$_out"
> - fi
> + _fout=$(echo "$_out" | result_filter)
>
> if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
> _passed=true
> diff --git a/ctdb/tests/scripts/unit.sh b/ctdb/tests/scripts/unit.sh
> index c7c2b7a..f423db1 100644
> --- a/ctdb/tests/scripts/unit.sh
> +++ b/ctdb/tests/scripts/unit.sh
> @@ -113,17 +113,29 @@ EOF
> fi
> }
>
> +# Result filtering is (usually) used to replace the date/time/PID
> +# prefix on some CTDB tool/client log messages with the literal string
> +# "DATE TIME [PID]". This allows tests to loosely match this output,
> +# since it can't otherwise be matched.
> +result_filter_default ()
> +{
> + _date_time_pid='[0-9/][0-9/]*\ [0-9:\.][0-9:\.]*\ \[[\ 0-9][\ 0-9]*\]'
> + sed -e "s@^${_date_time_pid}:@DATE\ TIME\ \[PID\]:@"
> +}
> +
> +# Override this function to customise output filtering.
> +result_filter ()
> +{
> + result_filter_default
> +}
> +
> result_check ()
> {
> _rc=$?
>
> _extra_header="$1"
>
> - if [ -n "$OUT_FILTER" ] ; then
> - _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
> - else
> - _fout="$_out"
> - fi
> + _fout=$(echo "$_out" | result_filter)
>
> if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
> _passed=true
> diff --git a/ctdb/tests/takeover/scripts/local.sh b/ctdb/tests/takeover/scripts/local.sh
> index 3b69d14..b10d746 100644
> --- a/ctdb/tests/takeover/scripts/local.sh
> +++ b/ctdb/tests/takeover/scripts/local.sh
> @@ -17,9 +17,6 @@ define_test ()
>
> simple_test ()
> {
> - # Do some filtering of the output to replace date/time.
> - OUT_FILTER='s@^[^\]]*\]:@DATE\ TIME\ \[PID\]:@'
> -
> _out=$($VALGRIND $test_prog "$@" 2>&1)
>
> result_check "Algorithm: $CTDB_IP_ALGORITHM"
> diff --git a/ctdb/tests/tool/scripts/local.sh b/ctdb/tests/tool/scripts/local.sh
> index 385e2ad..6cad929 100644
> --- a/ctdb/tests/tool/scripts/local.sh
> +++ b/ctdb/tests/tool/scripts/local.sh
> @@ -44,12 +44,6 @@ setup_natgw ()
>
> simple_test ()
> {
> - # Most of the tests when the tool fails will have a date/time/pid
> - # prefix. Strip that because it isn't possible to match it.
> - if [ $required_rc -ne 0 ] ; then
> - OUT_FILTER='s@^[0-9/]+\ [0-9:\.]+\ \[[\ 0-9]+\]:@DATE\ TIME\ \[PID\]:@'
> - fi
> -
> _out=$($VALGRIND $test_prog "$@" 2>&1)
>
> result_check
> --
> 1.7.9.5
>
>
> From 8cfba24e8f90a28a652861e394262a3bf70941c5 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 14 Nov 2013 14:13:01 +0100
> Subject: [PATCH 04/15] autobuild: build the "ctdb" target with socket-wrapper
> enabled
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> script/autobuild.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/script/autobuild.py b/script/autobuild.py
> index 48fbc3b..97c46ab 100755
> --- a/script/autobuild.py
> +++ b/script/autobuild.py
> @@ -37,7 +37,7 @@ defaulttasks = [ "ctdb", "samba", "samba-ctdb", "samba-libs", "ldb", "tdb", "ntd
> tasks = {
> "ctdb" : [ ("random-sleep", "../script/random-sleep.sh 60 600", "text/plain"),
> ("autogen", "./autogen.sh", "text/plain"),
> - ("configure", "./configure ${PREFIX}", "text/plain"),
> + ("configure", "./configure ${PREFIX} --enable-socket-wrapper ", "text/plain"),
> ("make", "make all", "text/plain"),
> ("install", "make install", "text/plain"),
> ("check-clean-tree", "../script/clean-source-tree.sh", "text/plain"),
> --
> 1.7.9.5
>
>
> From e9e4955bda7fc9690cc0e00efec19a7a030ccf2a Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Thu, 21 Nov 2013 15:38:06 +1100
> Subject: [PATCH 05/15] ctdb:tests: Add -S option to support socket wrapper
>
> Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Signed-off-by: Amitay Isaacs <amitay at gmail.com>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/scripts/run_tests | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/ctdb/tests/scripts/run_tests b/ctdb/tests/scripts/run_tests
> index 171e819..92bf686 100755
> --- a/ctdb/tests/scripts/run_tests
> +++ b/ctdb/tests/scripts/run_tests
> @@ -16,6 +16,7 @@ Options:
> -X Trace certain scripts run by tests using -x (only some tests)
> -d Print descriptions of tests instead of filenames (dodgy!)
> -H No headers - for running single test with other wrapper
> + -S Enable socket wrapper
> -q Quiet - don't show tests being run (hint: use with -s)
> -x Trace this script with the -x option
> EOF
> @@ -35,6 +36,7 @@ with_desc=false
> quiet=false
> exit_on_fail=false
> no_header=false
> +socket_wrapper=false
>
> export TEST_VERBOSE=false
> export TEST_COMMAND_TRACE=false
> @@ -44,7 +46,7 @@ export TEST_LOCAL_DAEMONS # No default, developer can "override"!
> export TEST_VAR_DIR=""
> export TEST_CLEANUP=false
>
> -temp=$(getopt -n "$prog" -o "xdehlqsvV:XACDH" -l help -- "$@")
> +temp=$(getopt -n "$prog" -o "xdehlqsvV:XACDHS" -l help -- "$@")
>
> [ $? != 0 ] && usage
>
> @@ -65,6 +67,7 @@ while true ; do
> -C) TEST_CLEANUP=true ; shift ;;
> -D) TEST_DIFF_RESULTS=true ; shift ;;
> -H) no_header=true ; shift ;;
> + -S) socket_wrapper=true ; shift ;;
> --) shift ; break ;;
> *) usage ;;
> esac
> @@ -221,6 +224,11 @@ 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=$(dirname "$0")
>
> for f ; do
> --
> 1.7.9.5
>
>
> From 89cbb828726f4af4de398f008e5a21031ffcf4ab Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Thu, 14 Nov 2013 20:34:50 +1100
> Subject: [PATCH 06/15] ctdb:tests: New "autotest" Makefile.in target
>
> This needs to run with socket wrapper and needs to stop after the 1st
> error.
>
> Pair-Programmed-With: Michael Adam <obnox at samba.org>
> Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Signed-off-by: Michael Adam <obnox at samba.org>
> Signed-off-by: Amitay Isaacs <amitay at gmail.com>
> ---
> ctdb/Makefile.in | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/ctdb/Makefile.in b/ctdb/Makefile.in
> index 55b21b7..eb280f2 100755
> --- a/ctdb/Makefile.in
> +++ b/ctdb/Makefile.in
> @@ -389,6 +389,9 @@ install_pmda:
> install_tests: all
> tests/INSTALL --destdir=$(DESTDIR) --datarootdir=$(prefix)/share --libdir=$(libdir) --bindir=$(bindir) --etcdir=$(etcdir)
>
> +autotest: all
> + tests/run_tests.sh -e -S -C
> +
> test: all
> tests/run_tests.sh -V tests/var
>
> --
> 1.7.9.5
>
>
> From 7dfcd6c064636a1a93d700f3e408a2f89c73a646 Mon Sep 17 00:00:00 2001
> From: Amitay Isaacs <amitay at gmail.com>
> Date: Thu, 14 Nov 2013 17:38:29 +1100
> Subject: [PATCH 07/15] autobuild: Run ctdb regression tests
>
> Pair-Programmed-with: Michael Adam <obnox at samba.org>
>
> Signed-off-by: Amitay Isaacs <amitay at gmail.com>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> script/autobuild.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/script/autobuild.py b/script/autobuild.py
> index 97c46ab..41ba8a4 100755
> --- a/script/autobuild.py
> +++ b/script/autobuild.py
> @@ -40,6 +40,7 @@ tasks = {
> ("configure", "./configure ${PREFIX} --enable-socket-wrapper ", "text/plain"),
> ("make", "make all", "text/plain"),
> ("install", "make install", "text/plain"),
> + ("test", "make autotest", "text/plain"),
> ("check-clean-tree", "../script/clean-source-tree.sh", "text/plain"),
> ("clean", "make clean", "text/plain") ],
>
> --
> 1.7.9.5
>
>
> From 89985f4eff11da593dc7c73ff1077f44481332ee Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Thu, 21 Nov 2013 16:22:52 +1100
> Subject: [PATCH 08/15] ctdb:tests: run_tests should ignore bogus test
> directories
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/scripts/run_tests | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/ctdb/tests/scripts/run_tests b/ctdb/tests/scripts/run_tests
> index 92bf686..a037e81 100755
> --- a/ctdb/tests/scripts/run_tests
> +++ b/ctdb/tests/scripts/run_tests
> @@ -211,6 +211,8 @@ find_and_run_one_test ()
> break
> fi
> done
> + # No tests found? Not a tests directory! Not found...
> + [ -n "$status" ] || status=127
> elif [ -f "$_f" ] ; then
> run_one_test "$_f"
> else
> --
> 1.7.9.5
>
>
> From 79c2fb728f3e1ef4f5311c127f7e9d80f8f8d92b Mon Sep 17 00:00:00 2001
> From: Martin Schwenke <martin at meltin.net>
> Date: Thu, 21 Nov 2013 16:38:43 +1100
> Subject: [PATCH 09/15] ctdb:tests/simple: Nobody looks at /tmp/recloop.out so
> use /dev/null instead
>
> Otherwise this should use mktemp, something should look at the output
> and the file should be removed. :-)
>
> Signed-off-by: Martin Schwenke <martin at meltin.net>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/simple/54_ctdb_transaction_recovery.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ctdb/tests/simple/54_ctdb_transaction_recovery.sh b/ctdb/tests/simple/54_ctdb_transaction_recovery.sh
> index d796e94..e2d50f6 100755
> --- a/ctdb/tests/simple/54_ctdb_transaction_recovery.sh
> +++ b/ctdb/tests/simple/54_ctdb_transaction_recovery.sh
> @@ -36,7 +36,7 @@ recovery_loop()
>
> recovery_loop_start()
> {
> - recovery_loop > /tmp/recloop.out &
> + recovery_loop >/dev/null &
> RECLOOP_PID=$!
> ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1"
> }
> --
> 1.7.9.5
>
>
> From 8d339696d8285b8a47510540e5297f40e2e8474d Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 21 Nov 2013 08:39:25 +0100
> Subject: [PATCH 10/15] ctdb:test: remove old now unused script
> test/recover.sh
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/recover.sh | 107 -------------------------------------------------
> 1 file changed, 107 deletions(-)
> delete mode 100755 ctdb/tests/recover.sh
>
> diff --git a/ctdb/tests/recover.sh b/ctdb/tests/recover.sh
> deleted file mode 100755
> index c626441..0000000
> --- a/ctdb/tests/recover.sh
> +++ /dev/null
> @@ -1,107 +0,0 @@
> -#!/bin/sh
> -
> -killall -q ctdbd
> -
> -echo "Starting 4 ctdb daemons"
> -bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt
> -bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt --listen=127.0.0.2 --socket=/tmp/ctdb.socket.127.0.0.2
> -bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt --listen=127.0.0.3 --socket=/tmp/ctdb.socket.127.0.0.3
> -bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt --listen=127.0.0.4 --socket=/tmp/ctdb.socket.127.0.0.4
> -
> -echo
> -echo "Attaching to some databases"
> -bin/ctdb_control attach test1.tdb || exit 1
> -bin/ctdb_control attach test2.tdb || exit 1
> -bin/ctdb_control attach test3.tdb || exit 1
> -bin/ctdb_control attach test4.tdb || exit 1
> -
> -echo "Clearing all databases to make sure they are all empty"
> -bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^dbid://" -e "s/ .*$//" | while read DB; do
> - seq 0 3 | while read NODE; do
> - bin/ctdb_control cleardb $NODE $DB
> - done
> -done
> -
> -
> -echo
> -echo
> -echo "Printing all databases on all nodes. they should all be empty"
> -echo "============================================================="
> -bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^.*name://" -e "s/ .*$//" | while read DBNAME; do
> - seq 0 3 | while read NODE; do
> - echo "Content of DBNAME:$DBNAME NODE:$NODE :"
> - bin/ctdb_control catdb $DBNAME $NODE
> - done
> -done
> -
> -echo
> -echo
> -echo "Populating the databases"
> -./bin/ctdb_control writerecord 0 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control setdmaster 0 0x220c2a7b 1
> -
> -./bin/ctdb_control writerecord 1 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control writerecord 1 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control setdmaster 1 0x220c2a7b 2
> -
> -./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control setdmaster 2 0x220c2a7b 3
> -
> -./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
> -./bin/ctdb_control setdmaster 3 0x220c2a7b 3
> -
> -
> -echo
> -echo
> -echo "Printing all databases on all nodes. there should be a record there"
> -echo "============================================================="
> -bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^.*name://" -e "s/ .*$//" | while read DBNAME; do
> - seq 0 3 | while read NODE; do
> - echo "Content of DBNAME:$DBNAME NODE:$NODE :"
> - bin/ctdb_control catdb $DBNAME $NODE
> - done
> -done
> -
> -echo
> -echo
> -echo "killing off node #2"
> -echo "==================="
> -CTDBPID=`./bin/ctdb_control getpid 2 | sed -e "s/Pid://"`
> -kill $CTDBPID
> -sleep 1
> -
> -
> -echo
> -echo
> -echo "wait 3 seconds to let the recovery daemon do its job"
> -echo "===================================================="
> -sleep 3
> -
> -echo
> -echo
> -echo "Printing all databases on all nodes."
> -echo "The databases should be the same now on all nodes"
> -echo "and the record will have been migrated to node 0"
> -echo "================================================="
> -echo "Node 0:"
> -bin/ctdb_control catdb test4.tdb 0
> -echo "Node 1:"
> -bin/ctdb_control catdb test4.tdb 1
> -echo "Node 3:"
> -bin/ctdb_control catdb test4.tdb 3
> -echo "nodemap:"
> -bin/ctdb_control getnodemap 0
> -
> -echo
> -echo
> -echo "Traverse the cluster and dump the database"
> -bin/ctdb_control catdb test4.tdb
> -
> -
> -#leave the ctdb daemons running so one can look at the box in more detail
> -#killall -q ctdbd
> --
> 1.7.9.5
>
>
> From 022784747d97a2a280c6d81594eb9b0b32381e9f Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 21 Nov 2013 09:29:33 +0100
> Subject: [PATCH 11/15] ctdb:test: add path of ip command to extra output in
> the error case
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/eventscripts/scripts/local.sh | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
> index 2b4bc92..e8bf3c4 100644
> --- a/ctdb/tests/eventscripts/scripts/local.sh
> +++ b/ctdb/tests/eventscripts/scripts/local.sh
> @@ -889,6 +889,7 @@ _extra_header ()
> CTDB_BASE="$CTDB_BASE"
> CTDB_ETCDIR="$CTDB_ETCDIR"
> ctdb client is "$(which ctdb)"
> +ip command is "$(which ip)"
> EOF
> }
>
> --
> 1.7.9.5
>
>
> From 24a35d4ac768ddd15b3d6274e53fc02308c6d530 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 22 Nov 2013 00:35:35 +0100
> Subject: [PATCH 12/15] ctdb:test: ignore SIGPIPE in unit tests
>
> This makes scripts called in the unit tests behave like
> when called from ctdbd which ignodes SIGPIPE.
> This also makes the scrips behave the same when
> called from "make autotest" directly and via autobuild (python).
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/scripts/unit.sh | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/ctdb/tests/scripts/unit.sh b/ctdb/tests/scripts/unit.sh
> index f423db1..afa0c1f 100644
> --- a/ctdb/tests/scripts/unit.sh
> +++ b/ctdb/tests/scripts/unit.sh
> @@ -4,6 +4,8 @@
>
> # Common variables and functions for CTDB unit tests.
>
> +trap -- '' PIPE
> +
> # Set the required result for a test.
> # - Argument 1 is exit code.
> # - Argument 2, if present is the required test output but "--"
> --
> 1.7.9.5
>
>
> From d9eba30bc5d295ab958d7ff7fca433e445eea01a Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 22 Nov 2013 01:20:30 +0100
> Subject: [PATCH 13/15] ctdb:test: in the stub ip command for unit tests,
> redirect stderr to /dev/null
>
> This fixes running "make autotest" from autobuild, since
> it prevents irritating error output in delete_ip_from_iface()
> when calling ip addr list ... | grep -Fq "inet ..." .
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/eventscripts/stubs/ip | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip
> index 053da75..30cfd02 100755
> --- a/ctdb/tests/eventscripts/stubs/ip
> +++ b/ctdb/tests/eventscripts/stubs/ip
> @@ -166,7 +166,7 @@ ip_addr_show ()
> read local <"$pf"
> if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
> calc_brd
> - cat <<EOF
> + cat 2>/dev/null <<EOF
> inet ${local} brd ${brd} scope global ${dev}
> EOF
> fi
> @@ -175,14 +175,14 @@ EOF
> while read local ; do
> if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
> calc_brd
> - cat <<EOF
> + cat 2>/dev/null <<EOF
> inet ${local} brd ${brd} scope global secondary ${dev}
> EOF
> fi
> done <"$sf"
> fi
> if [ -z "$_to" ] ; then
> - cat <<EOF
> + cat 2>/dev/null <<EOF
> valid_lft forever preferred_lft forever
> EOF
> fi
> --
> 1.7.9.5
>
>
> From 1d79bddf482711f1f41e15cba349f2b225ba93eb Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 22 Nov 2013 01:45:06 +0100
> Subject: [PATCH 14/15] ctdb:tests: use TEST_VAR_DIR instead of /tmp in
> integration.bash
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/scripts/integration.bash | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
> index e3636e8..e486711 100644
> --- a/ctdb/tests/scripts/integration.bash
> +++ b/ctdb/tests/scripts/integration.bash
> @@ -814,7 +814,7 @@ ctdb_test_eventscript_file_create ()
> local pnn="$1"
> local type="$2"
>
> - try_command_on_node $pnn touch "/tmp/ctdb-test-${type}.${pnn}"
> + try_command_on_node $pnn touch "${TEST_VAR_DIR}/ctdb-test-${type}.${pnn}"
> }
>
> ctdb_test_eventscript_file_remove ()
> @@ -822,7 +822,7 @@ ctdb_test_eventscript_file_remove ()
> local pnn="$1"
> local type="$2"
>
> - try_command_on_node $pnn rm -f "/tmp/ctdb-test-${type}.${pnn}"
> + try_command_on_node $pnn rm -f "${TEST_VAR_DIR}/ctdb-test-${type}.${pnn}"
> }
>
> ctdb_test_eventscript_file_exists ()
> @@ -830,7 +830,7 @@ ctdb_test_eventscript_file_exists ()
> local pnn="$1"
> local type="$2"
>
> - try_command_on_node $pnn test -f "/tmp/ctdb-test-${type}.${pnn}" >/dev/null 2>&1
> + try_command_on_node $pnn test -f "${TEST_VAR_DIR}/ctdb-test-${type}.${pnn}" >/dev/null 2>&1
> }
>
>
> @@ -885,11 +885,11 @@ ctdb_test_eventscript_install ()
> out=$(ctdb pnn)
> pnn="${out#PNN:}"
>
> -rm -vf "/tmp/ctdb-test-flag-${1}.${pnn}"
> +rm -vf "${TEST_VAR_DIR}/ctdb-test-flag-${1}.${pnn}"
>
> -trigger="/tmp/ctdb-test-unhealthy-trigger.${pnn}"
> -detected="/tmp/ctdb-test-unhealthy-detected.${pnn}"
> -timeout_trigger="/tmp/ctdb-test-${1}-timeout.${pnn}"
> +trigger="${TEST_VAR_DIR}/ctdb-test-unhealthy-trigger.${pnn}"
> +detected="${TEST_VAR_DIR}/ctdb-test-unhealthy-detected.${pnn}"
> +timeout_trigger="${TEST_VAR_DIR}/ctdb-test-${1}-timeout.${pnn}"
> case "$1" in
> monitor)
> if [ -e "$trigger" ] ; then
> --
> 1.7.9.5
>
>
> From 033747755c24fca10aff70031b6e5e805edd8fe1 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Fri, 22 Nov 2013 01:45:49 +0100
> Subject: [PATCH 15/15] ctdb:tests: use TEST_VAR_DIR instead of /tmp in
> 76_ctdb_pdb_recovery.sh
>
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
> ctdb/tests/simple/76_ctdb_pdb_recovery.sh | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
> index 096b9d5..42fc776 100755
> --- a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
> +++ b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
> @@ -47,8 +47,8 @@ try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb wipedb $TESTDB
> # and update values
> for value in value1 value2 value3 value4 value5 ; do
> echo "store key(test1) data($value)"
> - try_command_on_node -q 0 "(echo -ne $value > /tmp/test_data)"
> - try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb pstore $TESTDB test1 /tmp/test_data
> + try_command_on_node -q 0 "(echo -ne $value > ${TEST_VAR_DIR}/test_data)"
> + try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb pstore $TESTDB test1 ${TEST_VAR_DIR}/test_data
> done
>
> # Delete record
> @@ -63,8 +63,8 @@ wait_until_node_has_status 1 stopped
>
> # Add a record key=test1 data=value2
> echo "store key(test1) data(newvalue1)"
> -try_command_on_node -q 0 "(echo -ne newvalue1 > /tmp/test_data)"
> -try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb pstore $TESTDB test1 /tmp/test_data
> +try_command_on_node -q 0 "(echo -ne newvalue1 > ${TEST_VAR_DIR}/test_data)"
> +try_command_on_node -q 0 $CTDB_TEST_WRAPPER ctdb pstore $TESTDB test1 ${TEST_VAR_DIR}/test_data
>
> # Continue node
> echo "contine node 1"
> --
> 1.7.9.5
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 215 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20131125/339ed1bb/attachment.pgp>
More information about the samba-technical
mailing list