[PATCHSET] enable ctdb's selftest in autobuild

Michael Adam obnox at samba.org
Wed Nov 27 15:35:33 MST 2013


Update.

On 2013-11-27 at 18:56 +0100, Michael Adam wrote:
> On 2013-11-27 at 10:22 +0100, Michael Adam wrote:
> > On 2013-11-27 at 17:25 +1100, Martin Schwenke wrote:
> > > 
> > >   That said, can we please defer the following fix (and, therefore, the
> > >   whole patchset) for a few days?
> > > 
> > >     ctdb:tests: use TEST_VAR_DIR instead of /tmp in 76_ctdb_pdb_recovery.sh
> > > 
> > >   For the statd-callout rewrite we added a "ctdb ptrans" command that
> > >   reads data from stdin.  This solves the remote temporary file problem
> > >   by completely avoiding it.  Amitay is going to push those patches
> > >   very soon and then we could fix this properly by using "ctdb ptrans".
> > 
> > Sure. Sounds good.
> 
> Did it , see my master-ctdb branch, but it fails
> autobuild for me currently (pfetch fails with
> empty record). will look later...

Got it working. :-)

Please consider the patches in my master-ctdb branch.

Attached for the record and for convenience.

Cheers - Michael

-------------- next part --------------
From a220b4516549fe444c95cf35be7c7a92f4b1e241 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 01/10] ctdb:tests: 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 6b87da82f45501f38640016c5ffcf7615f375e15 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 02/10] ctdb:tests: 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 7742a1879b4dc12876a853cf214ca9940b64042e 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 03/10] ctdb:tests: 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 3f6cf834e514007161866118e03fc6f184b77bfb Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 27 Nov 2013 12:13:40 +0100
Subject: [PATCH 04/10] ctdb:tests: in the stub ip command, avoid broken pipe
 by using echo instead of cat

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 |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip
index 053da75..d4c9d8a 100755
--- a/ctdb/tests/eventscripts/stubs/ip
+++ b/ctdb/tests/eventscripts/stubs/ip
@@ -166,25 +166,19 @@ ip_addr_show ()
 	    read local <"$pf"
 	    if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
 		calc_brd
-		cat <<EOF
-    inet ${local} brd ${brd} scope global ${dev}
-EOF
+		echo "    inet ${local} brd ${brd} scope global ${dev}"
 	    fi
 	fi
 	if $secondary && [ -r "$sf" ] ; then
 	    while read local ; do
 		if [ -z "$_to" -o "${_to%/*}" = "${local%/*}" ] ; then
 		    calc_brd
-		    cat <<EOF
-    inet ${local} brd ${brd} scope global secondary ${dev}
-EOF
+		    echo "    inet ${local} brd ${brd} scope global secondary ${dev}"
 		fi
 	    done <"$sf"
 	fi
 	if [ -z "$_to" ] ; then
-	    cat <<EOF
-       valid_lft forever preferred_lft forever
-EOF
+	    echo "       valid_lft forever preferred_lft forever"
 	fi
     }
     n=1
-- 
1.7.9.5


From d55a4434deef01e97d407399a69a63f7d234149c Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 27 Nov 2013 11:40:53 +0100
Subject: [PATCH 05/10] ctdb:tests:76_ctdb_pdb_recovery: fix a typo in a
 message

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/tests/simple/76_ctdb_pdb_recovery.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
index 9890e87..03c4d33 100755
--- a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
+++ b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
@@ -92,7 +92,7 @@ do_test
 if try_command_on_node 0 $CTDB pfetch $TESTDB test1 ; then
 	echo "GOOD: Record was not deleted (recovery by RSN worked)"
 else
-	echo "BAD: Record was not deleted"
+	echo "BAD: Record was deleted"
 	status=1
 fi
 
-- 
1.7.9.5


From baf3396c91952d038fbd6a3ae958b96b70493b19 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 27 Nov 2013 23:28:24 +0100
Subject: [PATCH 06/10] ctdb:tests:76_ctdb_pdb_recovery: fix a typo in a
 message

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/tests/simple/76_ctdb_pdb_recovery.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
index 03c4d33..959ef7d 100755
--- a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
+++ b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
@@ -102,7 +102,7 @@ try_command_on_node all $CTDB setvar RecoverPDBBySeqNum 1
 
 do_test
 if try_command_on_node 0 $CTDB pfetch $TESTDB test1 ; then
-	echo "GOOD: Record was not deleted (recovery by sequnce number worked)"
+	echo "GOOD: Record was not deleted (recovery by sequence number worked)"
 else
 	echo "BAD: Record was deleted"
 	status=1
-- 
1.7.9.5


From 1f68e3bdc582fb15479d8d4282d57d1af78a54be Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 27 Nov 2013 11:42:28 +0100
Subject: [PATCH 07/10] ctdb:tests:76_ctdb_pdb_recovery: change from using
 ctdb pstore to ctdb ptrans.

This removes the requirement to create a temporary file
and hence makes this test runnable against local daemons
and against a real cluster without further changes.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/tests/simple/76_ctdb_pdb_recovery.sh |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
index 959ef7d..1c897c2 100755
--- a/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
+++ b/ctdb/tests/simple/76_ctdb_pdb_recovery.sh
@@ -47,8 +47,7 @@ try_command_on_node 0 $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 0 "(echo -ne $value > /tmp/test_data)"
-	try_command_on_node 0 $CTDB pstore $TESTDB test1 /tmp/test_data
+	echo "\"test1\" \"$value\"" | try_command_on_node -i 0 $CTDB ptrans "$TESTDB"
 done
 
 # Delete record
@@ -63,8 +62,7 @@ wait_until_node_has_status 1 stopped
 
 # Add a record   key=test1 data=value2
 echo "store key(test1) data(newvalue1)"
-try_command_on_node 0 "(echo -ne newvalue1 > /tmp/test_data)"
-try_command_on_node 0 $CTDB pstore $TESTDB test1 /tmp/test_data
+echo '"test1" "newvalue1"' | try_command_on_node -i 0 $CTDB ptrans "$TESTDB"
 
 # Continue node
 echo "contine node 1"
-- 
1.7.9.5


From 3058f97370922792a7e58e84aa26b67c371deca0 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Wed, 27 Nov 2013 22:28:06 +0100
Subject: [PATCH 08/10] ctdb:test: remove unused ip2ipmask from
 integration.bash

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/tests/scripts/integration.bash |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 88161c1..c98d511 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -497,13 +497,6 @@ wait_until_node_has_some_ips ()
     wait_until 60 node_has_some_ips "$@"
 }
 
-ip2ipmask ()
-{
-    _ip="$1"
-
-    ip addr show to "$_ip" | awk '$1 == "inet" { print $2 }'
-}
-
 #######################################
 
 daemons_stop ()
-- 
1.7.9.5


From 854a7b7aba8bfaafa1dbc16b33d8c512371df892 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 09/10] 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 59a07b662fe75544ac4943c6a1500a688a597e84 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 10/10] 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

-------------- 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/20131127/bc36bb5a/attachment.pgp>


More information about the samba-technical mailing list