[SCM] CTDB repository - branch master updated - ctdb-1.13-232-g6616a57

Amitay Isaacs amitay at samba.org
Thu Jul 26 06:04:59 MDT 2012


The branch, master has been updated
       via  6616a5712b5d4db2b9ba6a88cec79378696c2184 (commit)
       via  7ef9916bd95ff2472359a412eac5489f1aad2dce (commit)
       via  3f268805c14c51f23024267916eae161bada8a0e (commit)
       via  8d17dacee415dd0b4268805a366a86f83e33f27c (commit)
       via  2fd0157382b42aa5c5212b8e743c6f589edc6662 (commit)
       via  47180dc75d15f3d61470705603565b718491c9f8 (commit)
       via  619af3e857c2ced3840abfd86135cc954796da97 (commit)
       via  6e7bd9685406ae024d413a5d9d8c6e0d89b15567 (commit)
       via  f02e501342112aab67aee95f253e29a670b29273 (commit)
      from  21a5cbf9518fafc610939f14874371a52b1dc8b3 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6616a5712b5d4db2b9ba6a88cec79378696c2184
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jul 20 17:00:12 2012 +1000

    tests/tool: Run ctdb_tool_* under $VALGRIND
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 7ef9916bd95ff2472359a412eac5489f1aad2dce
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jul 4 07:29:18 2012 +1000

    tests/eventscripts: Rewrite the testparm stub
    
    It currently needs the real testparm command installed even though it
    only uses limited features.  It is easy enough to fake up the
    functionality that 50.samba uses.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 3f268805c14c51f23024267916eae161bada8a0e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 3 13:05:58 2012 +1000

    tests/complex: Fix broken ctdb_test_check_real_cluster()
    
    It doesn't set $h at all...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 8d17dacee415dd0b4268805a366a86f83e33f27c
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 2 14:18:51 2012 +1000

    tests/simple: ctdb stop/continue tests weren't actually checking IPs
    
    The correct variable is $test_node_ips, not $ips.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 2fd0157382b42aa5c5212b8e743c6f589edc6662
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 2 14:06:35 2012 +1000

    tests: select_test_node_and_ips() should try to avoid failing
    
    Sometimes "ctdb sync" doesn't do its job, so we end up with unassigned
    IPs.
    
    If $test_node isn't set then this is bad.  However, try a few times to
    ensure it is set.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 47180dc75d15f3d61470705603565b718491c9f8
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jul 2 14:05:21 2012 +1000

    tests: simple tests against local daemons should check $TEST_LOCAL_DEAMONS
    
    Note the old $CTDB_TEST_REAL_CLUSTER - it doesn't exist anymore...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 619af3e857c2ced3840abfd86135cc954796da97
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 20 15:57:48 2012 +1000

    tests: run_tests should exit with $status with -e option
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 6e7bd9685406ae024d413a5d9d8c6e0d89b15567
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 14 19:37:39 2012 +1000

    tests/simple: ctdb reloadips test should use $test_ip
    
    There's no point recalculating this value.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit f02e501342112aab67aee95f253e29a670b29273
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 14 19:36:04 2012 +1000

    tests:  select_test_node_and_ips() should never select non-node -1
    
    Instead of selecting the 1st pnn found, select the 1st one that isn't -1.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 tests/complex/scripts/local.bash  |    3 +++
 tests/events.d/00.test            |    4 ++--
 tests/eventscripts/stubs/testparm |   31 +++++++++++++++++++++++--------
 tests/scripts/integration.bash    |   31 ++++++++++++++++++++++++-------
 tests/scripts/run_tests           |    2 +-
 tests/simple/11_ctdb_ip.sh        |    2 +-
 tests/simple/18_ctdb_reloadips.sh |   11 +++++------
 tests/simple/41_ctdb_stop.sh      |    2 +-
 tests/simple/42_ctdb_continue.sh  |    2 +-
 tests/tool/scripts/local.sh       |    2 +-
 10 files changed, 62 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/complex/scripts/local.bash b/tests/complex/scripts/local.bash
index 0976c3f..eb4c41c 100644
--- a/tests/complex/scripts/local.bash
+++ b/tests/complex/scripts/local.bash
@@ -132,6 +132,9 @@ ctdb_test_check_real_cluster ()
     [ -z "$TEST_LOCAL_DAEMONS" ] || \
 	die "ERROR: This test must be run against a real/virtual cluster, not local daemons."
 
+    local h=$(hostname)
+
+    local i
     for i in $(onnode -q all hostname) ; do
 	[ "$h" != "$i" ] || \
 	    die "ERROR: This test must not be run from a cluster node."
diff --git a/tests/events.d/00.test b/tests/events.d/00.test
index 51c0e11..e3e15eb 100755
--- a/tests/events.d/00.test
+++ b/tests/events.d/00.test
@@ -43,7 +43,7 @@ case $cmd in
 	ip=$2
 	maskbits=$3
 
-	[ -n "$CTDB_TEST_REAL_CLUSTER" ] && {
+	[ -n "$TEST_LOCAL_DAEMONS" ] || {
 	    /sbin/ip addr add $ip/$maskbits dev $iface || {
 		echo "Failed to add $ip/$maskbits on dev $iface"
 		exit 1
@@ -64,7 +64,7 @@ case $cmd in
 	iface=$1
 	ip=$2
 	maskbits=$3
-	[ -n "$CTDB_TEST_REAL_CLUSTER" ] && {
+	[ -n "$TEST_LOCAL_DAEMONS" ] || {
 	    /sbin/ip addr del $ip/$maskbits dev $iface || {
 		echo "Failed to del $ip on dev $iface"
 		exit 1
diff --git a/tests/eventscripts/stubs/testparm b/tests/eventscripts/stubs/testparm
index 83aa578..9e3747f 100755
--- a/tests/eventscripts/stubs/testparm
+++ b/tests/eventscripts/stubs/testparm
@@ -1,25 +1,40 @@
 #!/bin/sh
 
+not_implemented ()
+{
+    echo "testparm: option \"$1\" not implemented in stub" >&2
+    exit 2
+}
+
 # Ensure that testparm always uses our canned configuration instead of
-# the global one, unless some other file is specified.  This requires
-# testparm to be installed but is quicker than reimplementing all the
-# various command-line options.
+# the global one, unless some other file is specified. 
 
-file_specified=false
+file=""
+parameter=""
 for i ; do
     case "$i" in
+	--parameter-name=*) parameter="${i#--parameter-name=}" ;;
 	-*) : ;;
-	*) file_specified=true
+	*) file="$i" ;;
     esac
 done
 
-if $file_specified ; then
+# Just hard-code parameter requests for now.  Later on they could be
+# parsed out of the file.
+case "$parameter" in
+    security) echo "ADS" ; exit 0 ;;
+    smb*ports) echo "445 139" ; exit 0 ;;
+    ?*) not_implemented "--parameter-name=$parameter" ;;
+    # Fall through if $parameter not set
+esac
+
+if [ -n "$file" ] ; then
     # This should include the shares, since this is used when the
     # samba eventscript caches the output.
-    /usr/bin/testparm "$@"
+    cat "$file"
 else
     # We force our own smb.conf and add the shares.
-    /usr/bin/testparm "$@" "${CTDB_ETCDIR}/samba/smb.conf"
+    cat "${CTDB_ETCDIR}/samba/smb.conf"
 
     for i in $FAKE_SHARES ; do
 	bi=$(basename "$i")
diff --git a/tests/scripts/integration.bash b/tests/scripts/integration.bash
index 70308de..8b268b1 100644
--- a/tests/scripts/integration.bash
+++ b/tests/scripts/integration.bash
@@ -234,18 +234,17 @@ all_ips_on_node()
     try_command_on_node $node "$CTDB ip -Y -n all | cut -d ':' -f1-3 | sed -e '1d' -e 's@^:@@' -e 's@:@ @g'"
 }
 
-select_test_node_and_ips ()
+_select_test_node_and_ips ()
 {
     all_ips_on_node 0
 
-    # When selecting test_node we just want a node that has public
-    # IPs.  This will work and is economically semi-random.  :-)
-    local x
-    read x test_node <<<"$out"
-
+    test_node=""  # this matches no PNN
     test_node_ips=""
     local ip pnn
     while read ip pnn ; do
+	if [ -z "$test_node" -a "$pnn" != "-1" ] ; then
+	    test_node="$pnn"
+	fi
 	if [ "$pnn" = "$test_node" ] ; then
             test_node_ips="${test_node_ips}${test_node_ips:+ }${ip}"
 	fi
@@ -253,6 +252,24 @@ select_test_node_and_ips ()
 
     echo "Selected node ${test_node} with IPs: ${test_node_ips}."
     test_ip="${test_node_ips%% *}"
+
+    [ -n "$test_node" ] || return 1
+}
+
+select_test_node_and_ips ()
+{
+    local timeout=10
+    while ! _select_test_node_and_ips ; do
+	echo "Unable to find a test node with IPs assigned"
+	if [ $timeout -le 0 ] ; then
+	    echo "BAD: Too many attempts"
+	    return 1
+	fi
+	sleep_for 1
+	timeout=$(($timeout - 1))
+    done
+
+    return 0
 }
 
 #######################################
@@ -560,7 +577,7 @@ daemons_start_1 ()
     local node_ip=$(sed -n -e "$(($pnn + 1))p" "$CTDB_NODES")
     local ctdb_options="--reclock=${TEST_VAR_DIR}/rec.lock --nlist $CTDB_NODES --nopublicipcheck --node-ip=${node_ip} --event-script-dir=${TEST_VAR_DIR}/events.d --logfile=${TEST_VAR_DIR}/daemon.${pnn}.log -d 3 --dbdir=${TEST_VAR_DIR}/test.db --dbdir-persistent=${TEST_VAR_DIR}/test.db/persistent --dbdir-state=${TEST_VAR_DIR}/test.db/state"
 
-    if [ -z "$CTDB_TEST_REAL_CLUSTER" ]; then
+    if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
         ctdb_options="$ctdb_options --public-interface=lo"
     fi
 
diff --git a/tests/scripts/run_tests b/tests/scripts/run_tests
index 0d95774..50a578b 100755
--- a/tests/scripts/run_tests
+++ b/tests/scripts/run_tests
@@ -244,7 +244,7 @@ else
 fi
 
 if [ $tests_failed -gt 0 ] ; then
-    if $no_header ; then
+    if $no_header || $exit_on_fail ; then
 	exit $status
     else
 	exit 1
diff --git a/tests/simple/11_ctdb_ip.sh b/tests/simple/11_ctdb_ip.sh
index 2f39061..c1aec0e 100755
--- a/tests/simple/11_ctdb_ip.sh
+++ b/tests/simple/11_ctdb_ip.sh
@@ -41,7 +41,7 @@ machineout=$(echo "$out" | sed -r \
 	-e 's@[[:alpha:]]+\[@@g' \
 	-e 's@\]@@g')
 
-if [ -n "$CTDB_TEST_REAL_CLUSTER" ]; then
+if [ -z "$TEST_LOCAL_DAEMONS" ]; then
     while read ip pnn ; do
         try_command_on_node $pnn "ip addr show"
         if [ "${out/inet ${ip}\/}" != "$out" ] ; then
diff --git a/tests/simple/18_ctdb_reloadips.sh b/tests/simple/18_ctdb_reloadips.sh
index e7b4e4d..4822b93 100755
--- a/tests/simple/18_ctdb_reloadips.sh
+++ b/tests/simple/18_ctdb_reloadips.sh
@@ -83,24 +83,23 @@ try_command_on_node any $CTDB sync
 
 select_test_node_and_ips
 
-first_ip=${test_node_ips%% *}
-echo "Removing IP $first_ip from node $test_node"
+echo "Removing IP $test_ip from node $test_node"
 
-try_command_on_node $test_node "mv $addresses $backup && grep -v '^${first_ip}/' $backup >$addresses"
+try_command_on_node $test_node "mv $addresses $backup && grep -v '^${test_ip}/' $backup >$addresses"
 
 try_command_on_node any $CTDB reloadips -n all
 
 try_command_on_node $test_node $CTDB ip
 
-if grep "^${first_ip} " <<<"$out" ; then
+if grep "^${test_ip} " <<<"$out" ; then
     cat <<EOF
-BAD: node $test_node can still host IP $first_ip:
+BAD: node $test_node can still host IP $test_ip:
 $out
 EOF
     exit 1
 fi
 
 cat <<EOF
-GOOD: node $test_node is no longer hosting IP $first_ip:
+GOOD: node $test_node is no longer hosting IP $test_ip:
 $out
 EOF
diff --git a/tests/simple/41_ctdb_stop.sh b/tests/simple/41_ctdb_stop.sh
index 8f4d77b..1a45d8f 100755
--- a/tests/simple/41_ctdb_stop.sh
+++ b/tests/simple/41_ctdb_stop.sh
@@ -47,7 +47,7 @@ try_command_on_node 1 $CTDB stop -n $test_node
 
 wait_until_node_has_status $test_node stopped
 
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $ips ; then
+if wait_until_ips_are_on_nodeglob "[!${test_node}]" $test_node_ips ; then
     echo "All IPs moved."
 else
     echo "Some IPs didn't move."
diff --git a/tests/simple/42_ctdb_continue.sh b/tests/simple/42_ctdb_continue.sh
index e02a90d..381baf5 100755
--- a/tests/simple/42_ctdb_continue.sh
+++ b/tests/simple/42_ctdb_continue.sh
@@ -49,7 +49,7 @@ try_command_on_node 1 $CTDB stop -n $test_node
 
 wait_until_node_has_status $test_node stopped
 
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $ips ; then
+if wait_until_ips_are_on_nodeglob "[!${test_node}]" $test_node_ips ; then
     echo "All IPs moved."
 else
     echo "Some IPs didn't move."
diff --git a/tests/tool/scripts/local.sh b/tests/tool/scripts/local.sh
index dbff423..77c5f16 100644
--- a/tests/tool/scripts/local.sh
+++ b/tests/tool/scripts/local.sh
@@ -30,7 +30,7 @@ simple_test ()
 	OUT_FILTER='s@^[0-9/]+\ [0-9:\.]+\ \[[\ 0-9]+\]:@DATE\ TIME\ \[PID\]:@'
     fi
 
-    _out=$($test_prog "$@" 2>&1)
+    _out=$($VALGRIND $test_prog "$@" 2>&1)
 
     result_check
 }


-- 
CTDB repository


More information about the samba-cvs mailing list