Merge remote branch 'martins/master'
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 18 Apr 2012 03:48:43 +0000 (13:48 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 18 Apr 2012 03:48:43 +0000 (13:48 +1000)
(This used to be ctdb commit abe7ebe6c531f912efe4ebc1daade4d2af67574c)

147 files changed:
ctdb/tests/eventscripts/10.interface.init.001.sh [moved from ctdb/tests/eventscripts/simple/10.interface.init.001.sh with 83% similarity]
ctdb/tests/eventscripts/10.interface.init.002.sh [moved from ctdb/tests/eventscripts/simple/10.interface.init.002.sh with 66% similarity]
ctdb/tests/eventscripts/10.interface.monitor.001.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.001.sh with 77% similarity]
ctdb/tests/eventscripts/10.interface.monitor.002.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.002.sh with 66% similarity]
ctdb/tests/eventscripts/10.interface.monitor.003.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.003.sh with 83% similarity]
ctdb/tests/eventscripts/10.interface.monitor.004.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.004.sh with 77% similarity]
ctdb/tests/eventscripts/10.interface.monitor.005.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.005.sh with 83% similarity]
ctdb/tests/eventscripts/10.interface.monitor.006.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.006.sh with 84% similarity]
ctdb/tests/eventscripts/10.interface.monitor.007.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.007.sh with 75% similarity]
ctdb/tests/eventscripts/10.interface.monitor.008.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.008.sh with 89% similarity]
ctdb/tests/eventscripts/10.interface.monitor.009.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.009.sh with 86% similarity]
ctdb/tests/eventscripts/10.interface.monitor.010.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.010.sh with 89% similarity]
ctdb/tests/eventscripts/10.interface.monitor.011.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.011.sh with 87% similarity]
ctdb/tests/eventscripts/10.interface.monitor.012.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.012.sh with 90% similarity]
ctdb/tests/eventscripts/10.interface.monitor.013.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.013.sh with 84% similarity]
ctdb/tests/eventscripts/10.interface.monitor.014.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.014.sh with 84% similarity]
ctdb/tests/eventscripts/10.interface.monitor.015.sh [moved from ctdb/tests/eventscripts/simple/10.interface.monitor.015.sh with 92% similarity]
ctdb/tests/eventscripts/10.interface.multi.001.sh [moved from ctdb/tests/eventscripts/multievent/10.interface.001.sh with 83% similarity]
ctdb/tests/eventscripts/10.interface.releaseip.001.sh [moved from ctdb/tests/eventscripts/simple/10.interface.releaseip.001.sh with 81% similarity]
ctdb/tests/eventscripts/10.interface.releaseip.002.sh [moved from ctdb/tests/eventscripts/simple/10.interface.releaseip.002.sh with 88% similarity]
ctdb/tests/eventscripts/10.interface.startup.001.sh [moved from ctdb/tests/eventscripts/simple/10.interface.startup.001.sh with 77% similarity]
ctdb/tests/eventscripts/10.interface.startup.002.sh [moved from ctdb/tests/eventscripts/simple/10.interface.startup.002.sh with 66% similarity]
ctdb/tests/eventscripts/10.interface.takeip.001.sh [moved from ctdb/tests/eventscripts/simple/10.interface.takeip.001.sh with 81% similarity]
ctdb/tests/eventscripts/10.interface.takeip.002.sh [moved from ctdb/tests/eventscripts/simple/10.interface.takeip.002.sh with 76% similarity]
ctdb/tests/eventscripts/10.interface.takeip.003.sh [moved from ctdb/tests/eventscripts/simple/10.interface.takeip.003.sh with 93% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.001.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.001.sh with 83% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.002.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.002.sh with 52% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.003.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.003.sh with 90% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.004.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.004.sh with 90% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.005.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.005.sh with 94% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.006.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.006.sh with 93% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.007.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.007.sh with 94% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.008.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.008.sh with 94% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.009.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.009.sh with 95% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.010.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.010.sh with 96% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.011.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.011.sh with 95% similarity]
ctdb/tests/eventscripts/13.per_ip_routing.012.sh [moved from ctdb/tests/eventscripts/multievent/13.per_ip_routing.012.sh with 95% similarity]
ctdb/tests/eventscripts/40.vsftpd.monitor.001.sh [moved from ctdb/tests/eventscripts/simple/40.vsftpd.monitor.001.sh with 70% similarity]
ctdb/tests/eventscripts/41.httpd.monitor.001.sh [moved from ctdb/tests/eventscripts/simple/41.httpd.monitor.001.sh with 69% similarity]
ctdb/tests/eventscripts/50.samba.monitor.001.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.001.sh with 69% similarity]
ctdb/tests/eventscripts/50.samba.monitor.050.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.050.sh with 84% similarity]
ctdb/tests/eventscripts/50.samba.monitor.051.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.051.sh with 86% similarity]
ctdb/tests/eventscripts/50.samba.monitor.101.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.101.sh with 62% similarity]
ctdb/tests/eventscripts/50.samba.monitor.102.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.102.sh with 77% similarity]
ctdb/tests/eventscripts/50.samba.monitor.103.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.103.sh with 78% similarity]
ctdb/tests/eventscripts/50.samba.monitor.104.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.104.sh with 78% similarity]
ctdb/tests/eventscripts/50.samba.monitor.105.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.105.sh with 81% similarity]
ctdb/tests/eventscripts/50.samba.monitor.106.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.106.sh with 83% similarity]
ctdb/tests/eventscripts/50.samba.monitor.107.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.107.sh with 89% similarity]
ctdb/tests/eventscripts/50.samba.monitor.108.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.108.sh with 86% similarity]
ctdb/tests/eventscripts/50.samba.monitor.109.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.109.sh with 95% similarity]
ctdb/tests/eventscripts/50.samba.monitor.110.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.110.sh with 95% similarity]
ctdb/tests/eventscripts/50.samba.monitor.111.sh [moved from ctdb/tests/eventscripts/simple/50.samba.monitor.111.sh with 90% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.001.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.001.sh with 69% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.100.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.100.sh with 90% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.101.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.101.sh with 67% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.111.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.111.sh with 72% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.112.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.112.sh with 88% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.121.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.121.sh with 91% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.122.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.122.sh with 91% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.131.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.131.sh with 79% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.132.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.132.sh with 88% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.141.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.141.sh with 88% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.142.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.142.sh with 87% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.151.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.151.sh with 73% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.152.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.152.sh with 93% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.153.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.153.sh with 90% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.161.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.161.sh with 81% similarity]
ctdb/tests/eventscripts/60.nfs.monitor.162.sh [moved from ctdb/tests/eventscripts/simple/60.nfs.monitor.162.sh with 83% similarity]
ctdb/tests/eventscripts/60.nfs.multi.001.sh [moved from ctdb/tests/eventscripts/multievent/60.nfs.001.sh with 87% similarity]
ctdb/tests/eventscripts/60.nfs.multi.002.sh [moved from ctdb/tests/eventscripts/multievent/60.nfs.002.sh with 92% similarity]
ctdb/tests/eventscripts/60.nfs.multi.003.sh [moved from ctdb/tests/eventscripts/multievent/60.nfs.003.sh with 91% similarity]
ctdb/tests/eventscripts/60.nfs.multi.004.sh [moved from ctdb/tests/eventscripts/multievent/60.nfs.004.sh with 92% similarity]
ctdb/tests/eventscripts/60.nfs.multi.005.sh [moved from ctdb/tests/eventscripts/multievent/60.nfs.005.sh with 92% similarity]
ctdb/tests/eventscripts/60.nfs.multi.006.sh [moved from ctdb/tests/eventscripts/multievent/60.nfs.006.sh with 88% similarity]
ctdb/tests/eventscripts/etc-ctdb/interface_modify.sh [deleted symlink]
ctdb/tests/eventscripts/run_tests.sh [deleted file]
ctdb/tests/eventscripts/scripts/local.sh [moved from ctdb/tests/eventscripts/common.sh with 83% similarity]
ctdb/tests/eventscripts/stubs/ctdb
ctdb/tests/onnode/0001.sh
ctdb/tests/onnode/0002.sh
ctdb/tests/onnode/0003.sh
ctdb/tests/onnode/0004.sh
ctdb/tests/onnode/0005.sh
ctdb/tests/onnode/0006.sh
ctdb/tests/onnode/0070.sh
ctdb/tests/onnode/0071.sh
ctdb/tests/onnode/0072.sh
ctdb/tests/onnode/0075.sh
ctdb/tests/onnode/0080.sh
ctdb/tests/onnode/0081.sh
ctdb/tests/onnode/0090.sh
ctdb/tests/onnode/0091.sh
ctdb/tests/onnode/common.sh [deleted file]
ctdb/tests/onnode/run_tests.sh [deleted file]
ctdb/tests/onnode/scripts/local.sh [new file with mode: 0644]
ctdb/tests/scripts/common.sh [new file with mode: 0644]
ctdb/tests/scripts/ctdb_test_env
ctdb/tests/scripts/ctdb_test_functions.bash
ctdb/tests/scripts/run_tests
ctdb/tests/scripts/unit.sh [new file with mode: 0644]
ctdb/tests/simple/00_ctdb_onnode.sh
ctdb/tests/takeover/common.sh [deleted file]
ctdb/tests/takeover/lcp2.001.sh [moved from ctdb/tests/takeover/testcases/lcp2.001.sh with 92% similarity]
ctdb/tests/takeover/lcp2.002.sh [moved from ctdb/tests/takeover/testcases/lcp2.002.sh with 92% similarity]
ctdb/tests/takeover/lcp2.003.sh [moved from ctdb/tests/takeover/testcases/lcp2.003.sh with 92% similarity]
ctdb/tests/takeover/lcp2.004.sh [moved from ctdb/tests/takeover/testcases/lcp2.004.sh with 95% similarity]
ctdb/tests/takeover/lcp2.005.sh [moved from ctdb/tests/takeover/testcases/lcp2.005.sh with 99% similarity]
ctdb/tests/takeover/lcp2.006.sh [moved from ctdb/tests/takeover/testcases/lcp2.006.sh with 92% similarity]
ctdb/tests/takeover/lcp2.007.sh [moved from ctdb/tests/takeover/testcases/lcp2.007.sh with 92% similarity]
ctdb/tests/takeover/lcp2.008.sh [moved from ctdb/tests/takeover/testcases/lcp2.008.sh with 92% similarity]
ctdb/tests/takeover/lcp2.009.sh [moved from ctdb/tests/takeover/testcases/lcp2.009.sh with 92% similarity]
ctdb/tests/takeover/lcp2.010.sh [moved from ctdb/tests/takeover/testcases/lcp2.010.sh with 95% similarity]
ctdb/tests/takeover/lcp2.011.sh [new file with mode: 0755]
ctdb/tests/takeover/lcp2.012.sh [new file with mode: 0755]
ctdb/tests/takeover/lcp2.013.sh [new file with mode: 0755]
ctdb/tests/takeover/nondet.001.sh [moved from ctdb/tests/takeover/testcases/nondet.001.sh with 91% similarity]
ctdb/tests/takeover/nondet.002.sh [moved from ctdb/tests/takeover/testcases/nondet.002.sh with 91% similarity]
ctdb/tests/takeover/nondet.003.sh [moved from ctdb/tests/takeover/testcases/nondet.003.sh with 92% similarity]
ctdb/tests/takeover/run_tests.sh [deleted file]
ctdb/tests/takeover/scripts/local.sh [new file with mode: 0644]
ctdb/tests/takeover/simulation/README [moved from ctdb/tests/takeover/README with 100% similarity]
ctdb/tests/takeover/simulation/ctdb_takeover.py [moved from ctdb/tests/takeover/ctdb_takeover.py with 99% similarity]
ctdb/tests/takeover/simulation/hey_jude.py [new file with mode: 0755]
ctdb/tests/takeover/simulation/ip_groups1.py [moved from ctdb/tests/takeover/ip_groups1.py with 100% similarity]
ctdb/tests/takeover/simulation/ip_groups2.py [moved from ctdb/tests/takeover/ip_groups2.py with 100% similarity]
ctdb/tests/takeover/simulation/ip_groups3.py [moved from ctdb/tests/takeover/ip_groups3.py with 100% similarity]
ctdb/tests/takeover/simulation/ip_groups4.py [moved from ctdb/tests/takeover/ip_groups4.py with 100% similarity]
ctdb/tests/takeover/simulation/ip_groups5.py [moved from ctdb/tests/takeover/ip_groups5.py with 100% similarity]
ctdb/tests/takeover/simulation/mgmt_simple.py [moved from ctdb/tests/takeover/mgmt_simple.py with 100% similarity]
ctdb/tests/takeover/simulation/node_group.py [moved from ctdb/tests/takeover/node_group.py with 100% similarity]
ctdb/tests/takeover/simulation/node_group_extra.py [moved from ctdb/tests/takeover/node_group_extra.py with 100% similarity]
ctdb/tests/takeover/simulation/node_group_simple.py [moved from ctdb/tests/takeover/node_group_simple.py with 100% similarity]
ctdb/tests/takeover/simulation/nondet_path_01.py [moved from ctdb/tests/takeover/nondet_path_01.py with 100% similarity]
ctdb/tests/tool/common.sh [deleted file]
ctdb/tests/tool/func.parse_nodestring.001.sh [moved from ctdb/tests/tool/testcases/func.parse_nodestring.001.sh with 89% similarity]
ctdb/tests/tool/func.parse_nodestring.002.sh [moved from ctdb/tests/tool/testcases/func.parse_nodestring.002.sh with 89% similarity]
ctdb/tests/tool/func.parse_nodestring.003.sh [moved from ctdb/tests/tool/testcases/func.parse_nodestring.003.sh with 89% similarity]
ctdb/tests/tool/run_tests.sh [deleted file]
ctdb/tests/tool/scripts/local.sh [new file with mode: 0644]
ctdb/tests/tool/stubby.nodestatus.001.sh [moved from ctdb/tests/tool/testcases/stubby.nodestatus.001.sh with 92% similarity]
ctdb/tests/tool/stubby.nodestatus.002.sh [moved from ctdb/tests/tool/testcases/stubby.nodestatus.002.sh with 92% similarity]
ctdb/tests/tool/stubby.nodestatus.003.sh [moved from ctdb/tests/tool/testcases/stubby.nodestatus.003.sh with 93% similarity]
ctdb/tests/tool/stubby.nodestatus.004.sh [moved from ctdb/tests/tool/testcases/stubby.nodestatus.004.sh with 93% similarity]
ctdb/tests/tool/stubby.nodestatus.005.sh [new file with mode: 0755]
ctdb/tests/tool/stubby.status.001.sh [moved from ctdb/tests/tool/testcases/stubby.status.001.sh with 94% similarity]
ctdb/tests/tool/stubby.status.002.sh [moved from ctdb/tests/tool/testcases/stubby.status.002.sh with 94% similarity]

similarity index 83%
rename from ctdb/tests/eventscripts/simple/10.interface.init.001.sh
rename to ctdb/tests/eventscripts/10.interface.init.001.sh
index 5a61ab3efddd463f9e1af2680ca5248c2b3e1f3f..fae1a78d50684771d84853142de889cb535c03fd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "no public addresses"
 
similarity index 66%
rename from ctdb/tests/eventscripts/simple/10.interface.init.002.sh
rename to ctdb/tests/eventscripts/10.interface.init.002.sh
index 43bacd5231e0a3a382a0cc25e3e52fd7ef72c4f2..ba33f927c3f8d494ac7fb919ac39244d01095f53 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all interfaces up"
 
similarity index 77%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.001.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.001.sh
index 411355f1052c36319455fb4291691cdfc5c94880..42ef42d81b4298a11569e608babf712ee244a99b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "no public addresses"
 
similarity index 66%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.002.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.002.sh
index 43bacd5231e0a3a382a0cc25e3e52fd7ef72c4f2..ba33f927c3f8d494ac7fb919ac39244d01095f53 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all interfaces up"
 
similarity index 83%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.003.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.003.sh
index 5dd432816b28dd97d705bedabd0b2f99965d42e2..1eb7916b932f5e2934e50c2927592ebf2800f5dd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 interface down"
 
similarity index 77%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.004.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.004.sh
index d215c400194050376386f73a532e08a480c28bfa..69ffbd00cd5b320356791b62c7337b79e776d5e7 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all interfaces up, 1 is a bond"
 
similarity index 83%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.005.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.005.sh
index 00db01fe63e7240a4456b91e51130936d65de37f..8cf7bbc9c0a0eb47749aa7cf8a4b42d310d52905 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 bond, no active slaves"
 
similarity index 84%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.006.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.006.sh
index 862a972373094711d46efd01cff4431e02bc787d..3c483a3516f3e937c4740ce5223050d263516cf2 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 bond, active slaves, link down"
 
similarity index 75%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.007.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.007.sh
index 004247ef67f6585c9acec7714f79383f0c30c80c..c45900e3b2e00c1dcd02a204581e2cf7af7dbd05 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "unknown interface, up"
 
similarity index 89%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.008.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.008.sh
index aa59151c2a78a9fd698c1a5b70b736221377da84..f73302b30daebd2420fe3b0bb06956b69cf96ae1 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "unknown interface, down, up"
 
similarity index 86%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.009.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.009.sh
index ab890f34422cc4b9df6e6b63313ab63d078c416d..1b785ffdc80f2ba3b6340f31f7cf4e43fc86bb3f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "CTDB_PARTIALLY_ONLINE_INTERFACES, 1 down"
 
similarity index 89%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.010.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.010.sh
index 476d2c9f69b743acba992cc1880e7b963fcf1b13..4d233193fb6fce103ae4c21f96082caf2cfa0fb4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "CTDB_PARTIALLY_ONLINE_INTERFACES, all down"
 
similarity index 87%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.011.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.011.sh
index 3e5ba34acecae9131242f694ad8989a29806eb88..21775d41ce5354aef56d8272f0d219ed166a0f82 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "CTDB_PARTIALLY_ONLINE_INTERFACES, 1 bond down"
 
similarity index 90%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.012.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.012.sh
index d27c423e4424752b7a03488e9dff0ecbe259166e..dbe84b7729669906cd5d6ee43c9c4dbd36f6b333 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "CTDB_PARTIALLY_ONLINE_INTERFACES, 1 bond down"
 
similarity index 84%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.013.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.013.sh
index 88e884dc84db9448a324f69a64d7e50b09c48485..0fcdcd8d15bdabc7ea8ea4c08df7a185416932aa 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 bond, active slaves, link down"
 
similarity index 84%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.014.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.014.sh
index 97cf253c3b775adbae218e3d9c2a62d1e87db1b4..ab23d307c29163c91ec270f2f6ddfa6060a36885 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "spurious addresses on interface, no action"
 
similarity index 92%
rename from ctdb/tests/eventscripts/simple/10.interface.monitor.015.sh
rename to ctdb/tests/eventscripts/10.interface.monitor.015.sh
index 6810733b5416625de0bb9875d8b32b2723a50a0e..ff54b69d9befa2190e30c32a5b137eebba874ef3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "spurious addresses on interface, delete them"
 
similarity index 83%
rename from ctdb/tests/eventscripts/multievent/10.interface.001.sh
rename to ctdb/tests/eventscripts/10.interface.multi.001.sh
index 5ef254c536ffe2be35d717f66f1fd591962e9481..da8dcf188df8ae14ab9abd46cf4f60001c2d99ec 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "takeip, removeip"
 
similarity index 81%
rename from ctdb/tests/eventscripts/simple/10.interface.releaseip.001.sh
rename to ctdb/tests/eventscripts/10.interface.releaseip.001.sh
index cd38cff67ca7ff73b1048c11e63073e45f299cc9..934b3dc30ec07d91c1cf6a3fff697245f850b68c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "error - no args given"
 
similarity index 88%
rename from ctdb/tests/eventscripts/simple/10.interface.releaseip.002.sh
rename to ctdb/tests/eventscripts/10.interface.releaseip.002.sh
index d08d27c7e00561db69897b3fd5af8b608aad50bc..9bcb7f11d67b9571f874c326c44221cedc666e09 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "error - remove a non-existent ip"
 
similarity index 77%
rename from ctdb/tests/eventscripts/simple/10.interface.startup.001.sh
rename to ctdb/tests/eventscripts/10.interface.startup.001.sh
index 411355f1052c36319455fb4291691cdfc5c94880..42ef42d81b4298a11569e608babf712ee244a99b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "no public addresses"
 
similarity index 66%
rename from ctdb/tests/eventscripts/simple/10.interface.startup.002.sh
rename to ctdb/tests/eventscripts/10.interface.startup.002.sh
index 43bacd5231e0a3a382a0cc25e3e52fd7ef72c4f2..ba33f927c3f8d494ac7fb919ac39244d01095f53 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all interfaces up"
 
similarity index 81%
rename from ctdb/tests/eventscripts/simple/10.interface.takeip.001.sh
rename to ctdb/tests/eventscripts/10.interface.takeip.001.sh
index cd38cff67ca7ff73b1048c11e63073e45f299cc9..934b3dc30ec07d91c1cf6a3fff697245f850b68c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "error - no args given"
 
similarity index 76%
rename from ctdb/tests/eventscripts/simple/10.interface.takeip.002.sh
rename to ctdb/tests/eventscripts/10.interface.takeip.002.sh
index 9ee361a326640988a4ff69c5a519d42d38c15cf4..8960b08997d6df5aee9b572b9f103ca2eed51eb3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "add an ip"
 
similarity index 93%
rename from ctdb/tests/eventscripts/simple/10.interface.takeip.003.sh
rename to ctdb/tests/eventscripts/10.interface.takeip.003.sh
index ce78be90b024f88dbb91675801b11523df55eb52..203cff05be13254a80cd343d7afb5e99e13f815b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "error - add same IP twice"
 
similarity index 83%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.001.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.001.sh
index 0bcf8e3055c2cd0c6375aa2d000b8dc3192840d5..3d22864edfbc06076b0e91e6d84cab8dde74dd4a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "not configured"
 
similarity index 52%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.002.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.002.sh
index 9a32df09f1a483fe277be84c0034d1221586450c..3198ef36ed6aa139de5cee9350cee266a64a8fc3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "missing config, no takeip, ipreallocated"
 
@@ -8,7 +8,7 @@ setup_ctdb
 setup_ctdb_policy_routing
 
 required_result 1 <<EOF
-error: CTDB_PER_IP_ROUTING_CONF=/home/martins/samba/ctdb/tests/eventscripts/etc-ctdb/policy_routing file not found
+error: CTDB_PER_IP_ROUTING_CONF=${TEST_SUBDIR}/etc-ctdb/policy_routing file not found
 EOF
 
 simple_test_event "ipreallocated"
similarity index 90%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.003.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.003.sh
index 832101f91df5f18173888af411ca9d19ec4c2e4b..c1e0d01294d8164bbaa2834c3b02b0d7fface551 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "empty config, ipreallocated"
 
similarity index 90%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.004.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.004.sh
index 49d2b4efa1af8eb365116c44c788b6618c0f13dc..88ffac369cbb3c0362468d432b8520158b9272d7 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "empty config, takeip"
 
similarity index 94%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.005.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.005.sh
index 3ebacbedbb7754593b51e877fb3802258c1a39bd..822f39f044d903ae498e9d2d6b147b62c73a4f2c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 IP configured, takeip"
 
similarity index 93%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.006.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.006.sh
index d4585563723a1d67d1b34212d7815289e79f1bcf..ed9df846fe75bfae27fd11874c003a742e9654cd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 IP configured, takeip, releaseip"
 
similarity index 94%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.007.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.007.sh
index 53e9d3866ac87cf39bb6161ea6e53b2e44bf1ff5..f7332ac50b990ea258f5c600a4d92caa6fdf0d7b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 IP configured, ipreallocated"
 
similarity index 94%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.008.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.008.sh
index 282ec073648d4d90ef37fb4ad27a5b4d208ba064..db37cbb2411825295030c757238d0c39fb0b7dc3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 IP configured, takeip twice"
 
similarity index 95%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.009.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.009.sh
index 771651e94a895cebd10a23574569716fbb5aa73f..3e33e903c2b0c66770e6d61d3eb0cc360ab8a8d4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "All IPs configured, takeip"
 
similarity index 96%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.010.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.010.sh
index f7caf1c98da9ba9262c7bbeae1dfd69414a7358d..4704b9f04c7b890bdee18aebf27f4a7e173bde44 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "All IPs configured, takeip all on node"
 
similarity index 95%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.011.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.011.sh
index 18b51d4b783da81b28f3d073bc5774efa01ed2fa..65adbb5d5a59c4e553ef28e8de9d22abdb39c118 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "__auto_link_local__, takeip all on node"
 
similarity index 95%
rename from ctdb/tests/eventscripts/multievent/13.per_ip_routing.012.sh
rename to ctdb/tests/eventscripts/13.per_ip_routing.012.sh
index c2720646d6123026c364746fdc24c4d8bb68b0c9..198551f877f13506c626103ed51e8912675c325f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "1 IP configured, takeip, releaseip, ipreallocated"
 
similarity index 70%
rename from ctdb/tests/eventscripts/simple/40.vsftpd.monitor.001.sh
rename to ctdb/tests/eventscripts/40.vsftpd.monitor.001.sh
index 0f8b1a53c63eeda3678d3510b8a852c15780ff46..fdad12ae9a6c7071a22f3ef3cfcc5ba2d906fd39 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "not managed, check no-op"
 
similarity index 69%
rename from ctdb/tests/eventscripts/simple/41.httpd.monitor.001.sh
rename to ctdb/tests/eventscripts/41.httpd.monitor.001.sh
index 0a9ceac428eecc87206dcef6c40a1b25d3100d0a..f400eaa89b4e8a023aa05e4726db2ca59c4a95c9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "not managed, check no-op"
 
similarity index 69%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.001.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.001.sh
index 77fc2eb8523c87f10bb06b33ff142277416ca666..ac3708f5fd498849b653c20d761ae5432672b689 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "not managed, check no-op"
 
similarity index 84%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.050.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.050.sh
index 7a1b422bd2ffdb66aecee1b083afd1b2a09be2df..f4b00bb8573dddb7917b62af6ef591905e2ea8d3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "auto-start, simple"
 
similarity index 86%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.051.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.051.sh
index 3a53ac8aaabeb80b1fefc9a3698e109ffe0d34c8..c9f1a96bc0872c342c11686a1206e4dd809ff6ab 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "auto-stop, simple"
 
similarity index 62%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.101.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.101.sh
index d4b80bbf8fff5de7bec0d9869075e8c9e425ae6e..cf3b53a8f17eb54e03aa14c5498bbecdbff03e6f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all OK"
 
similarity index 77%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.102.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.102.sh
index 2f1f446fe8cb8a76335bddc61828181cca4723aa..a2263f3c6036de4444d83ca2454ce0942c6f2a88 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "winbind down"
 
similarity index 78%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.103.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.103.sh
index 8854780cadebf015a1846bcf438f1eed89b4917d..6f71a96760a39aa6e00db73592d94d04c8b9fb1a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 445 down"
 
similarity index 78%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.104.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.104.sh
index a29e7838b3a60e145a727b4352e6830eb1bf882e..9de022376be94a8768f12b3431ede5cb48ee4ded 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 139 down"
 
similarity index 81%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.105.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.105.sh
index 624c4a502cd561e1068a58a6f2e080f13572bb39..9936eff806491bebb6f90c69c1194cabf94062e8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "non-existent share path"
 
similarity index 83%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.106.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.106.sh
index f54cc06c68448f5baddb52b46f23a981145d6270..8fabfb33b6d9743a5156943adbb56fdfb2063af4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "non-existent share - not checked"
 
similarity index 89%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.107.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.107.sh
index e4151f374325c03570b8ada69f9e374fd7ba3976..4c776ac8aa66f00ce05b4993e7bea84b94d74d40 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 139 down, default tcp checker, debug"
 
similarity index 86%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.108.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.108.sh
index d06a16f90a49af411730c8494e223aea8d04dcdf..fcd5d279604cee46fa06be62232c072252c8e2bf 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 139 down, ctdb checktcpport not implemented"
 
similarity index 95%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.109.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.109.sh
index 4bc854b623e6f7d8f9133a1e5354e3cd9e6db7a5..f90ba629dbe7242914518461c3740b66f5bfde89 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 139 down, ctdb checktcpport not implemented, debug"
 
similarity index 95%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.110.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.110.sh
index 80264cc24e301486951ca42a41bf80f971183923..639cc515fe49025fe57149f2254f2c0b9c98d91e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 139 down, ctdb checktcpport/nmap not implemented, debug"
 
similarity index 90%
rename from ctdb/tests/eventscripts/simple/50.samba.monitor.111.sh
rename to ctdb/tests/eventscripts/50.samba.monitor.111.sh
index 4651290663a6d8a94dea6273631f5c8c6b41c15b..c7f924cd7f84a4f90e738723d8587652a7698f1c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "port 139 down, ctdb checktcpport/nmap/netstat not implemented"
 
similarity index 69%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.001.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.001.sh
index 5b260ac6fbdaf76879c2502a6e598afed5f4bec8..c62e5cf87896c463ecb3f98705b6660d807090e6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "not managed, check no-op"
 
similarity index 90%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.100.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.100.sh
index 95f4dc6fb62af2562d3f8093d4e7a6b73ba58cbb..e846d827355dfeda1134ecc6ee5b461012df65ca 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "get RPC service fail limits/actions"
 
similarity index 67%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.101.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.101.sh
index 657db97a0719efa3ef6bb02f58ff1c575ff6740d..1a68927810696f131226368a191837cd27776fcd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all services available"
 
similarity index 72%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.111.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.111.sh
index 8dcde029dd06c5cc22b74b601792262e490c65e1..414fcc8066b013a7fe2e283d306603d113dcbe1b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "knfsd down, 1 iteration"
 
similarity index 88%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.112.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.112.sh
index de796ebd07d3e7d4a3fcc648468606c1326e3756..666a38aaaf62e2e43a79674e06f18810ef048db6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "knfsd down, 6 iterations"
 
similarity index 91%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.121.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.121.sh
index 062c3f6f5c430785234fd73387bb834ce7fd0d94..6d27f60b27abaf4c040867e2db90a8baaf66613d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "lockd down, 15 iterations"
 
similarity index 91%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.122.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.122.sh
index b93dba7b978ce397ad661fd57b345329ea151baf..fc5cea87c75586f76451f44d36a2f97bb2388b6d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "lockd down, 15 iterations, back up after 10"
 
similarity index 79%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.131.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.131.sh
index 84d20b761ce2f9d5b0b0cb8f36d0103692d252be..1cf72a92844c81d90953cfced04af451169f50fe 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "rquotad down, 5 iterations"
 
similarity index 88%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.132.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.132.sh
index fad9a4c59037163b5780b8ae5e83e2d03a1570f5..b8f3f2b0411cf985cf5459c197218c7fe7f25aa8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "rquotad down, 5 iterations, back up after 1"
 
similarity index 88%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.141.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.141.sh
index 377de6e229e72e7fcbb2e2e4c788a132f2df18a1..c77b1a7b052c73f80a763d91ff0cbda484c09f35 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "statd down, 6 iterations"
 
similarity index 87%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.142.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.142.sh
index 3ca3cf64a78f7342d759d8b47eab07af6ac6e1f0..4373d8d6426abc09180966c9a66a01c7ae11de3c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "statd down, 8 iterations, back up after 2"
 
similarity index 73%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.151.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.151.sh
index af2dd26f5d28da8e053791d08881cf33c3774c22..ea9aa7830ec410e98db6f3eee9dc53544d8976b0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "mountd down, 1 iteration"
 
similarity index 93%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.152.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.152.sh
index 9aad819b749274756ee0287a2ecc880597e019b0..c4eb4194ae2bb8c5cd76ef2ef59b142333988745 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "mountd down, 10 iterations"
 
similarity index 90%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.153.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.153.sh
index 6b2750c82c84e1e6777d06ba3d5fb8d93c3019b4..cf33e39bbc82f90c1b2c4b343aa5e30ed8ffaa9f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "mountd down, 10 iterations, back up after 5"
 
similarity index 81%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.161.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.161.sh
index 4abe68eaba7848ea5dbbdc73ccb2269ce47058fb..1e07c181c2e6faab57187282baf8f28f5cf7b7d1 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "2nd share missing"
 
similarity index 83%
rename from ctdb/tests/eventscripts/simple/60.nfs.monitor.162.sh
rename to ctdb/tests/eventscripts/60.nfs.monitor.162.sh
index 865b1c635a6b031bfcb2c0f0eea1282c4b6412c8..ccd4ca84ea1a6b9858e20e8bbc18d7d2b8afe05d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "2nd share missing, skipping share checks"
 
similarity index 87%
rename from ctdb/tests/eventscripts/multievent/60.nfs.001.sh
rename to ctdb/tests/eventscripts/60.nfs.multi.001.sh
index a6608db83e2f66b3178ff24de34dffefe01bf55e..e578c56c326d71aefcfdbab3ac932d6164c471e5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "takeip, ipreallocated -> reconfigure"
 
similarity index 92%
rename from ctdb/tests/eventscripts/multievent/60.nfs.002.sh
rename to ctdb/tests/eventscripts/60.nfs.multi.002.sh
index 93f645a6185fc55bba150731bf07cee08b629ec3..0c203cdf25782a2a6ad87cd8c744eada91372470 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "takeip, monitor -> reconfigure"
 
similarity index 91%
rename from ctdb/tests/eventscripts/multievent/60.nfs.003.sh
rename to ctdb/tests/eventscripts/60.nfs.multi.003.sh
index 929eaf2ae535f1bb94c6e5499b09e1ec6f08b738..31867b27898215e0a31b36afbb07e32dd9415e20 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "takeip, monitor -> reconfigure, replay error"
 
similarity index 92%
rename from ctdb/tests/eventscripts/multievent/60.nfs.004.sh
rename to ctdb/tests/eventscripts/60.nfs.multi.004.sh
index addbf44c9c713b44d9f6f2e233e80386f21567f5..6220ad346ce4aace5eca487ae4c41a20ec51ce6d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "takeip, monitor -> reconfigure, replay timedout"
 
similarity index 92%
rename from ctdb/tests/eventscripts/multievent/60.nfs.005.sh
rename to ctdb/tests/eventscripts/60.nfs.multi.005.sh
index 9e652013ca8918092d93fe14af485b46bdde905d..1a8200c9fc2ad6f63735addb5cb1d580eeb5759b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "takeip, monitor -> reconfigure, replay disabled"
 
similarity index 88%
rename from ctdb/tests/eventscripts/multievent/60.nfs.006.sh
rename to ctdb/tests/eventscripts/60.nfs.multi.006.sh
index 35f8b836e12400de1ec428a7af3876b271be69c6..21beaadceafae7fb0001c4d4c5e939bf28e07022 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${EVENTSCRIPTS_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "reconfigure (synthetic), twice"
 # This checks that the lock is released...
diff --git a/ctdb/tests/eventscripts/etc-ctdb/interface_modify.sh b/ctdb/tests/eventscripts/etc-ctdb/interface_modify.sh
deleted file mode 120000 (symlink)
index 94f555c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../config/interface_modify.sh
\ No newline at end of file
diff --git a/ctdb/tests/eventscripts/run_tests.sh b/ctdb/tests/eventscripts/run_tests.sh
deleted file mode 100755 (executable)
index 406689a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-
-# Eventscript unit test harness.
-
-cd $(dirname "$0")
-export EVENTSCRIPTS_TESTS_DIR=$(pwd)
-
-test_dir=$(dirname "$EVENTSCRIPTS_TESTS_DIR")
-
-export EVENTSCRIPT_TESTS_CAT_RESULTS_OPTS=""
-export EVENTSCRIPT_TESTS_DIFF_RESULTS=false
-
-opts="-d"
-
-for i ; do
-    case "$i" in
-       -v)
-           export EVENTSCRIPT_TESTS_VERBOSE="yes"
-           shift
-           ;;
-       -T)
-           # This will cause tests to fail but is good for debugging
-           # individual tests when they fail.
-           export EVENTSCRIPTS_TESTS_TRACE="sh -x"
-           shift
-           ;;
-       -A)
-           # Useful for detecting whitespace differences in results
-           export EVENTSCRIPT_TESTS_CAT_RESULTS_OPTS="-A"
-           shift
-           ;;
-       -D)
-           # Useful for detecting whitespace differences in results
-           export EVENTSCRIPT_TESTS_DIFF_RESULTS=true
-           shift
-           ;;
-       -*)
-           opts="$opts $i"
-           shift
-           ;;
-       *)
-           break
-    esac
-done
-
-tests=""
-if [ -z "$*" ] ; then
-    tests=$(ls simple/[0-9][0-9].*.*.[0-9][0-9][0-9].sh simple/[0-9][0-9].*.*.[0-9][0-9][0-9]/run_test.sh 2>/dev/null)
-fi
-
-"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1
-
-exit 0
similarity index 83%
rename from ctdb/tests/eventscripts/common.sh
rename to ctdb/tests/eventscripts/scripts/local.sh
index 44c975e03409389b4e6402cdea18522274d845de..6d7de894651515e3eb8516af795ecd19d469be14 100644 (file)
@@ -1,8 +1,5 @@
 # Hey Emacs, this is a -*- shell-script -*- !!!  :-)
 
-# Print a message and exit.
-die () { echo "$@" >&2 ; exit 1 ; }
-
 # Augment PATH with relevant stubs/ directories.  We do this by actually
 # setting PATH, and also by setting $EVENTSCRIPTS_PATH and then
 # prepending that to $PATH in rc.local to avoid the PATH reset in
@@ -10,45 +7,29 @@ die () { echo "$@" >&2 ; exit 1 ; }
 
 EVENTSCRIPTS_PATH=""
 
-if [ -d "${EVENTSCRIPTS_TESTS_DIR}/stubs" ] ; then
-    EVENTSCRIPTS_PATH="${EVENTSCRIPTS_TESTS_DIR}/stubs"
-fi
-
-export EVENTSCRIPTS_TESTCASE_DIR=$(dirname "$0")
-if [ $(basename "$EVENTSCRIPTS_TESTCASE_DIR") = "eventscripts" ] ; then
-    # Just a test script, no testcase subdirectory.
-    EVENTSCRIPTS_TESTCASE_DIR="$EVENTSCRIPTS_TESTS_DIR"
-else
-    if [ -d "${EVENTSCRIPTS_TESTCASE_DIR}/stubs" ] ; then
-       EVENTSCRIPTS_PATH="${EVENTSCRIPTS_TESTCASE_DIR}/stubs:${EVENTSCRIPTS_PATH}"
-    fi
+if [ -d "${TEST_SUBDIR}/stubs" ] ; then
+    EVENTSCRIPTS_PATH="${TEST_SUBDIR}/stubs"
 fi
 
 export EVENTSCRIPTS_PATH
 
 PATH="${EVENTSCRIPTS_PATH}:${PATH}"
 
-if [ -d "${EVENTSCRIPTS_TESTCASE_DIR}/etc" ] ; then
-    CTDB_ETCDIR="${EVENTSCRIPTS_TESTCASE_DIR}/etc"
-elif [ -d "${EVENTSCRIPTS_TESTS_DIR}/etc" ] ; then
-    CTDB_ETCDIR="${EVENTSCRIPTS_TESTS_DIR}/etc"
+if [ -d "${TEST_SUBDIR}/etc" ] ; then
+    CTDB_ETCDIR="${TEST_SUBDIR}/etc"
 else
     die "Unable to set \$CTDB_ETCDIR"
 fi
 export CTDB_ETCDIR
 
-if [ -d "${EVENTSCRIPTS_TESTCASE_DIR}/etc-ctdb" ] ; then
-    CTDB_BASE="${EVENTSCRIPTS_TESTCASE_DIR}/etc-ctdb"
-elif [ -d "${EVENTSCRIPTS_TESTCASE_DIR}/etc/ctdb" ] ; then
-    CTDB_BASE="${EVENTSCRIPTS_TESTCASE_DIR}/etc/ctdb"
-elif [ -d "${EVENTSCRIPTS_TESTS_DIR}/etc-ctdb" ] ; then
-    CTDB_BASE="${EVENTSCRIPTS_TESTS_DIR}/etc-ctdb"
+if [ -d "${TEST_SUBDIR}/etc-ctdb" ] ; then
+    CTDB_BASE="${TEST_SUBDIR}/etc-ctdb"
 else
     die "Unable to set \$CTDB_BASE"
 fi
 export CTDB_BASE
 
-export EVENTSCRIPTS_TESTS_VAR_DIR="${EVENTSCRIPTS_TESTS_DIR}/var"
+export EVENTSCRIPTS_TESTS_VAR_DIR="${TEST_SUBDIR}/var"
 if [ "$EVENTSCRIPTS_TESTS_VAR_DIR" != "/var" ] ; then
     rm -r "$EVENTSCRIPTS_TESTS_VAR_DIR"
 fi
@@ -57,7 +38,7 @@ export CTDB_VARDIR="$EVENTSCRIPTS_TESTS_VAR_DIR/ctdb"
 
 ######################################################################
 
-if [ "$EVENTSCRIPT_TESTS_VERBOSE" = "yes" ] ; then
+if "$TEST_VERBOSE" ; then
     debug () { echo "$@" ; }
 else
     debug () { : ; }
@@ -86,6 +67,11 @@ setup_generic ()
     for i in $(seq 1 3) ; do
        _s="${EVENTSCRIPTS_TESTS_VAR_DIR}/shares/${i}_existing"
        mkdir -p "$_s"
+       # Shares must begin with /
+       case "$_s" in
+           /*) : ;;
+           *) _s="${PWD}/$_s"
+       esac
        FAKE_SHARES="${FAKE_SHARES}${FAKE_SHARES:+ }${_s}"
     done
 
@@ -665,12 +651,7 @@ define_test ()
 {
     desc="$1"
 
-    _f="$0"
-    _f="${_f#./}"          # strip leading ./
-    _f="${_f#simple/}"     # strip leading simple/
-    _f="${_f#multievent/}" # strip leading multievent/
-    _f="${_f%%/*}"         # if subdir, strip off file
-    _f="${_f%.sh}"         # strip off .sh suffix if any
+    _f=$(basename "$0" ".sh")
 
     # Remaining format should be NN.service.event.NNN or NN.service.NNN:
     _num="${_f##*.}"
@@ -691,133 +672,13 @@ define_test ()
     printf "%-17s %-10s %-4s - %s\n\n" "$script" "$event" "$_num" "$desc"
 }
 
-# Set the required result for a test.
-# - Argument 1 is exit code.
-# - Argument 2, if present is the required test output but "--"
-#   indicates empty output.
-# If argument 2 is not present or null then read required test output
-# from stdin.
-required_result ()
-{
-    required_rc="${1:-0}"
-    if [ -n "$2" ] ; then
-       if [ "$2" = "--" ] ; then
-           required_output=""
-       else
-           required_output="$2"
-       fi
-    else
-       if ! tty -s ; then
-           required_output=$(cat)
-       else
-           required_output=""
-       fi
-    fi
-}
-
-ok ()
-{
-    required_result 0 "$@"
-}
-
-ok_null ()
-{
-    ok --
-}
-
-result_print ()
-{
-    _passed="$1"
-    _out="$2"
-    _rc="$3"
-    _iteration="$4"
-
-    if [ "$EVENTSCRIPT_TESTS_VERBOSE" = "yes" ] || ! $_passed ; then
-       if [ -n "$_iteration" ] ; then
-           cat <<EOF
-
-==================================================
-Iteration $_iteration
-EOF
-       fi
-
-cat <<EOF
---------------------------------------------------
-Output (Exit status: ${_rc}):
---------------------------------------------------
-EOF
-       echo "$_out" | cat $EVENTSCRIPT_TESTS_CAT_RESULTS_OPTS
-    fi
-
-    if ! $_passed ; then
-       cat <<EOF
---------------------------------------------------
-Required output (Exit status: ${required_rc}):
---------------------------------------------------
-EOF
-       echo "$required_output" | cat $EVENTSCRIPT_TESTS_CAT_RESULTS_OPTS
-
-       if $EVENTSCRIPT_TESTS_DIFF_RESULTS ; then
-           _outr=$(mktemp)
-           echo "$required_output" >"$_outr"
-
-           _outf=$(mktemp)
-           echo "$_out" >"$_outf"
-
-           cat <<EOF
---------------------------------------------------
-Diff:
---------------------------------------------------
-EOF
-           diff -u "$_outr" "$_outf" | cat -A
-           rm "$_outr" "$_outf"
-       fi
-    fi
-}
-
-result_footer ()
+_extra_header ()
 {
-    _passed="$1"
-
-    if [ "$EVENTSCRIPT_TESTS_VERBOSE" = "yes" ] || ! $_passed ; then
-
-       cat <<EOF
---------------------------------------------------
+    cat <<EOF
 CTDB_BASE="$CTDB_BASE"
 CTDB_ETCDIR="$CTDB_ETCDIR"
 ctdb client is "$(which ctdb)"
---------------------------------------------------
 EOF
-    fi
-
-    if $_passed ; then
-       echo "PASSED"
-       return 0
-    else
-       echo
-       echo "FAILED"
-       return 1
-    fi
-}
-
-result_check ()
-{
-    _rc=$?
-
-    if [ -n "$OUT_FILTER" ] ; then
-       _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
-    else
-       _fout="$_out"
-    fi
-
-    if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
-       _passed=true
-    else
-       _passed=false
-    fi
-
-    result_print "$_passed" "$_out" "$_rc"
-    result_footer "$_passed"
 }
 
 # Run an eventscript once.  The test passes if the return code and
@@ -834,10 +695,12 @@ simple_test ()
 {
     [ -n "$event" ] || die 'simple_test: $event not set'
 
+    _extra_header=$(_extra_header)
+
     echo "Running eventscript \"$script $event${1:+ }$*\""
-    _out=$($EVENTSCRIPTS_TESTS_TRACE "${CTDB_BASE}/events.d/$script" "$event" "$@" 2>&1)
+    _out=$($TEST_COMMAND_TRACE "${CTDB_BASE}/events.d/$script" "$event" "$@" 2>&1)
 
-    result_check
+    result_check "$_extra_header"
 }
 
 simple_test_event ()
@@ -931,8 +794,8 @@ iterate_test ()
            _result=false
        fi
 
-       result_print "$_passed" "$_out" "$_rc" "$iteration"
+       result_print "$_passed" "$_out" "$_rc" "Iteration $iteration"
     done
 
-    result_footer "$_result"
+    result_footer "$_result" "$(_extra_header)"
 }
index 81d275af708abb6aac7eb23b2899c5b39766fa79..e43784e3bb965d50ca4db68ce201aee4653e7fd8 100755 (executable)
@@ -126,7 +126,7 @@ ip_reallocate ()
            fi
            _flags="${_flags}${_flags:+,}${_this}"
        done
-       "$(dirname ${EVENTSCRIPTS_TESTS_DIR})/bin/ctdb_takeover_tests" \
+       "$(dirname ${TEST_SUBDIR})/bin/ctdb_takeover_tests" \
            "ctdb_takeover_run_core" "$_flags" <"$FAKE_CTDB_IP_LAYOUT" |
            sort >"$_t"
        mv "$_t" "$FAKE_CTDB_IP_LAYOUT"
index 3c2d541ef4cfbeed88794ec4debdd1438bf1abc9..28533748f2ca54fa09aeff4040483387bfd170ac 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE all hostname"
 
index b18d91efa2cf54cbaa3e708df9d387649c326328..c3c8c77a0ed3693c002ceb650fbe9922b3aef53c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE -q all hostname"
 
index d92579926138467e0a0fcf71fbc434ba42e2831c..d79bca280615aef1d615da527c206920b8e00ab0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE -p all hostname"
 
index a6e6424acef8a728f65a157707ccbfe3034b251e..d0986b2ffdac9a8fef7343d3b4bb2e5940e819bd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE -pq all hostname"
 
index af237da9a313e648ff7e24b4f0c5f13d6070ecca..0eccbb04a39f2ba729da7fc11442b2b58adaac7e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE 3 hostname"
 
index aa6eeba89eb5f19557f77c5435b1cf9fe8972276..b027850240ed47a382c86006c46303eb550f560b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE -v 3 hostname"
 
index f38c95f5fd86a733494410bfc2b61b656ecfaa32..902d78b23159f4ea7190a2326fca6218df844bb4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE ok hostname"
 
index 8a1cb59dd76fe54b769b9ebe1a375edfa4395cb6..ebf2f61fcd7a60536f51446f1f236f44df7b6040 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE ok hostname"
 
index d80361a4354c01d3d88fffafa191e109ded42b18..cb29e3b9a2c29baa8ad01d3ed2bb524c85e52be6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE ok hostname"
 
index aa2e8be0babaa335a0cb579148cb8878e9c0fe16..6ce9b9b190eb0db41436297482e7b59b238f7466 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE con hostname"
 
index 095f65b224e891b6f52f397676008ab1d6e67f3b..bca478ada5f8650aea6928004b0d30be2fa5eeed 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE recmaster hostname"
 
index e593934f664cb73a2e98eca7f03a061edf9dcbca..412db87e4c645d209e7fd924e01681acf3435269 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE lvsmaster hostname"
 
index 1147e34c10924e627c053aa7e06ee8d68806dbf7..dd50c51b70ddb0719c4a86645cf241139242ad27 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE natgw hostname"
 
index 5239eef1b47f3f2e0244d0e347937487cb7468cb..528eec16df1eb776a5247f8091872fae483c4a60 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${ONNODE_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 cmd="$ONNODE natgw hostname"
 
diff --git a/ctdb/tests/onnode/common.sh b/ctdb/tests/onnode/common.sh
deleted file mode 100644 (file)
index f920bc3..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
-
-# Set indirectly by run_tests at top level.
-unset CTDB_NODES_SOCKETS
-
-# Default to just "onnode".
-: ${ONNODE:=onnode}
-
-# Augment PATH with relevant stubs/ directories.
-
-if [ -d "${ONNODE_TESTS_DIR}/stubs" ] ; then
-    PATH="${ONNODE_TESTS_DIR}/stubs:$PATH"
-fi
-
-export ONNODE_TESTCASE_DIR=$(dirname "$0")
-if [ $(basename "$ONNODE_TESTCASE_DIR") = "onnode" ] ; then
-    # Just a test script, no testcase subdirectory.
-    ONNODE_TESTCASE_DIR="$ONNODE_TESTS_DIR"
-else
-    if [ -d "${ONNODE_TESTCASE_DIR}/stubs" ] ; then
-       PATH="${ONNODE_TESTCASE_DIR}/stubs:$PATH"
-    fi
-fi
-
-# Find CTDB nodes file.
-if [ -z "$CTDB_NODES_FILE" ] ; then
-    if [ -r "${ONNODE_TESTCASE_DIR}/nodes" ] ; then
-       CTDB_NODES_FILE="${ONNODE_TESTCASE_DIR}/nodes"
-    elif [ -r "${ONNODE_TESTS_DIR}/nodes" ] ; then
-       CTDB_NODES_FILE="${ONNODE_TESTS_DIR}/nodes"
-    else
-       CTDB_NODES_FILE="${CTDB_BASE:-/etc/ctdb}/nodes"
-    fi
-fi
-
-export CTDB_NODES_FILE
-
-export ONNODE_TESTS_VAR_DIR="${ONNODE_TESTS_DIR}/var"
-mkdir -p "$ONNODE_TESTS_VAR_DIR"
-
-if [ -z "$CTDB_BASE" ] ; then
-    export CTDB_BASE=$(dirname "$CTDB_NODES_FILE")
-fi
-
-define_test ()
-{
-    _f="$0"
-    _f="${_f#./}"  # strip leading ./
-    _f="${_f%%/*}" # if subdir, strip off file
-    _f="${_f%.sh}" # strip off .sh suffix if any
-
-    echo "$_f $1 - $2"
-}
-
-# Set output for ctdb command.  Option 1st argument is return code.
-ctdb_set_output ()
-{
-    _out="$ONNODE_TESTS_VAR_DIR/ctdb.out"
-    cat >"$_out"
-
-    _rc="$ONNODE_TESTS_VAR_DIR/ctdb.rc"
-    echo "${1:-0}" >"$_rc"
-
-    trap "rm -f $_out $_rc" 0
-}
-
-required_result ()
-{
-    required_rc="${1:-0}"
-    required_output=$(cat)
-}
-
-simple_test ()
-{
-    _sort="cat"
-    if [ "$1" = "-s" ] ; then
-       shift
-       _sort="sort"
-    fi
-    _out=$("$@" 2>&1)
-    _rc=$?
-    _out=$(echo "$_out" | $_sort )
-
-    if [ "$_out" = "$required_output" -a $_rc = $required_rc ] ; then
-       echo "PASSED"
-    else
-       cat <<EOF
-CTDB_NODES_FILE="${CTDB_NODES_FILE}"
-CTDB_BASE="$CTDB_BASE"
-$(which ctdb)
-
-##################################################
-Required output (Exit status: ${required_rc}):
-##################################################
-$required_output
-##################################################
-Actual output (Exit status: ${_rc}):
-##################################################
-$_out
-EOF
-       return 1
-    fi
-}
diff --git a/ctdb/tests/onnode/run_tests.sh b/ctdb/tests/onnode/run_tests.sh
deleted file mode 100755 (executable)
index e5fa7e2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-# Run some onnode unit tests.
-
-cd $(dirname "$0")
-export ONNODE_TESTS_DIR=$(pwd)
-
-test_dir=$(dirname "$ONNODE_TESTS_DIR")
-
-opts="-d"
-
-for i ; do
-    case "$i" in
-       -*)
-           opts="$opts $i"
-           shift
-           ;;
-       *)
-           break
-    esac
-done
-
-tests=""
-if [ -z "$*" ] ; then
-    tests=$(ls ./[0-9][0-9][0-9][0-9].sh ./[0-9][0-9][0-9][0-9]/run_test.sh 2>/dev/null)
-fi
-
-"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1
-
-echo "All OK"
-exit 0
diff --git a/ctdb/tests/onnode/scripts/local.sh b/ctdb/tests/onnode/scripts/local.sh
new file mode 100644 (file)
index 0000000..d6dd41c
--- /dev/null
@@ -0,0 +1,81 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+# Set indirectly by run_tests at top level.
+unset CTDB_NODES_SOCKETS
+
+# Default to just "onnode".
+: ${ONNODE:=onnode}
+
+# Augment PATH with relevant stubs/ directories.
+
+if [ -d "${TEST_SUBDIR}/stubs" ] ; then
+    PATH="${TEST_SUBDIR}/stubs:$PATH"
+fi
+
+# Find CTDB nodes file.
+if [ -z "$CTDB_NODES_FILE" ] ; then
+    if [ -r "${TEST_SUBDIR}/nodes" ] ; then
+       CTDB_NODES_FILE="${TEST_SUBDIR}/nodes"
+    else
+       CTDB_NODES_FILE="${CTDB_BASE:-/etc/ctdb}/nodes"
+    fi
+fi
+
+export CTDB_NODES_FILE
+
+export ONNODE_TESTS_VAR_DIR="${TEST_SUBDIR}/var"
+mkdir -p "$ONNODE_TESTS_VAR_DIR"
+
+if [ -z "$CTDB_BASE" ] ; then
+    export CTDB_BASE=$(dirname "$CTDB_NODES_FILE")
+fi
+
+define_test ()
+{
+    _f=$(basename "$0")
+
+    echo "$_f $1 - $2"
+}
+
+# Set output for ctdb command.  Option 1st argument is return code.
+ctdb_set_output ()
+{
+    _out="$ONNODE_TESTS_VAR_DIR/ctdb.out"
+    cat >"$_out"
+
+    _rc="$ONNODE_TESTS_VAR_DIR/ctdb.rc"
+    echo "${1:-0}" >"$_rc"
+
+    trap "rm -f $_out $_rc" 0
+}
+
+_extra_header ()
+{
+    cat <<EOF
+CTDB_NODES_FILE="${CTDB_NODES_FILE}"
+CTDB_BASE="$CTDB_BASE"
+$(which ctdb)
+
+EOF
+}
+
+simple_test ()
+{
+    _sort="cat"
+    if [ "$1" = "-s" ] ; then
+       shift
+       _sort="sort"
+    fi
+
+    _out=$("$@" 2>&1)
+    _rc=$?
+    _out=$(echo "$_out" | $_sort )
+
+    # Can't do this inline or it affects return code
+    _extra_header="$(_extra_header)"
+
+    # Get the return code back into $?
+    (exit $_rc)
+
+    result_check "$_extra_header"
+}
diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh
new file mode 100644 (file)
index 0000000..581663c
--- /dev/null
@@ -0,0 +1,9 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+# Common variables and functions for all CTDB tests.
+
+# Print a message and exit.
+die ()
+{
+    echo "$1" >&2 ; exit ${2:-1}
+}
index f550d7945f6f66850ed51d8722a0b18483178632..18d100f3d89e2741e28dea1397d81173d200f846 100755 (executable)
@@ -1,14 +1,14 @@
 #!/bin/bash
 
-ctdb_test_scripts_dir=$(cd $(dirname $0) ; pwd)
-export CTDB_DIR=$(dirname $(dirname $ctdb_test_scripts_dir))
+export TEST_SCRIPTS_DIR=$(cd $(dirname $0) ; pwd)
+export CTDB_DIR=$(dirname $(dirname $TEST_SCRIPTS_DIR))
 var_dir=$CTDB_DIR/tests/var
 
 ######################################################################
 
 ctdb_tools_dir=$CTDB_DIR/tools
 
-PATH="${ctdb_test_scripts_dir}:${ctdb_tools_dir}:${PATH}"
+PATH="${TEST_SCRIPTS_DIR}:${ctdb_tools_dir}:${PATH}"
 
 export CTDB_TIMEOUT=60
 
@@ -17,7 +17,7 @@ export CTDB_TIMEOUT=60
 if [ -n "$CTDB_TEST_REMOTE_DIR" ] ; then
     CTDB_TEST_WRAPPER="${CTDB_TEST_REMOTE_DIR}/test_wrap"
 else
-    CTDB_TEST_WRAPPER="${ctdb_test_scripts_dir}/test_wrap"
+    CTDB_TEST_WRAPPER="${TEST_SCRIPTS_DIR}/test_wrap"
 fi
 export CTDB_TEST_WRAPPER
 
index 063f1c3a3e4f9a42bdbd7cf5caf99abe22352c5b..70c5b5d10b623680f412b727e9585adbba52a715 100644 (file)
@@ -8,51 +8,6 @@ fail ()
 
 ######################################################################
 
-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)"
-           testfailures=$(($testfailures+1))
-       fi
-    fi
-
-    testduration=$(($(date +%s)-$teststarttime))
-
-    echo "=========================================================================="
-    echo "TEST ${interp}: ${name}${statstr} (duration: ${testduration}s)"
-    echo "=========================================================================="
-
-}
-
-test_exit ()
-{
-    exit $(($testfailures+0))
-}
-
 ctdb_check_time_logs ()
 {
     local threshold=20
@@ -116,7 +71,8 @@ ctdb_test_exit ()
 
     echo "*** TEST COMPLETED (RC=$status) AT $(date '+%F %T'), CLEANING UP..."
 
-    if [ -n "$CTDB_TEST_REAL_CLUSTER" -a $status -ne 0 ] ; then
+    if [ -n "$CTDB_TEST_REAL_CLUSTER"  -a -n "$CTDB_TEST_TIME_LOGGING" -a \
+       $status -ne 0 ] ; then
        ctdb_check_time_logs
     fi
 
@@ -143,22 +99,6 @@ ctdb_test_exit_hook_add ()
     ctdb_test_exit_hook="${ctdb_test_exit_hook}${ctdb_test_exit_hook:+ ; }$*"
 }
 
-ctdb_test_run ()
-{
-    local name="$1" ; shift
-    
-    [ -n "$1" ] || set -- "$name"
-
-    ctdb_test_begin "$name"
-
-    local status=0
-    "$@" || status=$?
-
-    ctdb_test_end "$name" "$status" "$*"
-    
-    return $status
-}
-
 ctdb_test_usage()
 {
     local status=${1:-2}
index 1ce089d85251161f7c84a12e4bbea39ad9051081..3a5ec96b74f739a1242024c6b2ad8e738dfc22ab 100755 (executable)
@@ -5,12 +5,21 @@
 # the arguments that it sees.
 . $(dirname $0)/ctdb_test_env :
 
-. ctdb_test_functions.bash
+. "${TEST_SCRIPTS_DIR}/common.sh"
 
 usage() {
     cat <<EOF
 Usage: run_tests [OPTIONS] [TESTS]
 
+Options:
+       -s      Print a summary of tests results after running all tests
+       -v      Verbose - print test output for non-failures (only some tests)
+       -A      Use "cat -A" to print test output (only some tests)
+       -D      Show diff between failed/expected test output (some tests only)
+       -X      Trace certain scripts run by tests using -x (only some tests)
+       -d      Print descriptions of tests instead of filenames (dodgy!)
+       -q      Quiet - don't show tests being run (hint: use with -s)
+       -x      Trace this script with the -x option
 EOF
     exit 1
 }
@@ -21,7 +30,12 @@ with_summary=false
 with_desc=false
 quiet=false
 
-temp=$(getopt -n "$prog" -o "xdhqs" -l help -- "$@")
+export TEST_VERBOSE=false
+export TEST_COMMAND_TRACE=""
+export TEST_CAT_RESULTS_OPTS=""
+export TEST_DIFF_RESULTS=false
+
+temp=$(getopt -n "$prog" -o "xdhqsvXAD" -l help -- "$@")
 
 [ $? != 0 ] && usage
 
@@ -33,6 +47,10 @@ while true ; do
        -d) with_desc=true ; shift ;;  # 4th line of output is description
        -q) quiet=true ; shift ;;
        -s) with_summary=true ; shift ;;
+       -v) TEST_VERBOSE=true ; shift ;;
+       -X) TEST_COMMAND_TRACE="sh -x" ; shift ;;
+       -A) TEST_CAT_RESULTS_OPTS="-A" ; shift ;;
+       -D) TEST_DIFF_RESULTS=true ; shift ;;
        --) shift ; break ;;
        *) usage ;;
     esac
@@ -46,8 +64,66 @@ 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"
+
+    ctdb_test_begin "$name"
+
+    local status=0
+    "$@" || status=$?
+
+    ctdb_test_end "$name" "$status" "$*"
+
+    return $status
+}
+
+######################################################################
+
 tests_total=0
 tests_passed=0
+tests_failed=0
 summary=""
 
 rows=$(if tty -s ; then stty size ; else echo x 80 ; fi | sed -e 's@.* @@' -e 's@^0$@80@')
@@ -58,10 +134,16 @@ sf=$(mktemp)
 
 set -o pipefail
 
-for f; do
-    [ -x $f ] || fail "test \"$f\" is not executable"
+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
+
+    export TEST_SUBDIR=$(dirname "$_f")
+
+    ctdb_test_run "$_f" | tee "$tf" | show_progress
     status=$?
     if $with_summary ; then
        if [ $status -eq 0 ] ; then
@@ -69,12 +151,29 @@ for f; do
            t=" PASSED "
        else
            t="*FAILED*"
+           tests_failed=$(($tests_failed + 1))
        fi
        if $with_desc ; then
            desc=$(tail -n +4 $tf | head -n 1)
-           f="$desc"
+           _f="$desc"
+       fi
+       echo "$t $_f" >>"$sf"
+    fi
+}
+
+for f ; do
+    if [ -d "$f" ] ; then
+       # This expands the most probable problem cases like "." and "..".
+       if [ $(dirname "$f") = "." ] ; then
+           f=$(cd "$f" ; pwd)
        fi
-       echo "$t $f" >>"$sf"
+       for i in $(ls "${f%/}/"*".sh" 2>/dev/null) ; do
+           run_one_test "$i"
+       done
+    elif [ -f "$f" ] ; then
+       run_one_test "$f"
+    else
+       die "test \"$f\" is not recognised"
     fi
 done
 
@@ -89,4 +188,6 @@ fi
 
 rm -f "$sf"
 
-test_exit
+if [ $tests_failed -gt 0 ] ; then
+    exit 1
+fi
diff --git a/ctdb/tests/scripts/unit.sh b/ctdb/tests/scripts/unit.sh
new file mode 100644 (file)
index 0000000..6f92d6c
--- /dev/null
@@ -0,0 +1,141 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+. "${TEST_SCRIPTS_DIR}/common.sh"
+
+# Common variables and functions for CTDB unit tests.
+
+# Set the required result for a test.
+# - Argument 1 is exit code.
+# - Argument 2, if present is the required test output but "--"
+#   indicates empty output.
+# If argument 2 is not present or null then read required test output
+# from stdin.
+required_result ()
+{
+    required_rc="${1:-0}"
+    if [ -n "$2" ] ; then
+       if [ "$2" = "--" ] ; then
+           required_output=""
+       else
+           required_output="$2"
+       fi
+    else
+       if ! tty -s ; then
+           required_output=$(cat)
+       else
+           required_output=""
+       fi
+    fi
+}
+
+ok ()
+{
+    required_result 0 "$@"
+}
+
+ok_null ()
+{
+    ok --
+}
+
+result_print ()
+{
+    _passed="$1"
+    _out="$2"
+    _rc="$3"
+    _extra_header="$4"
+
+    if "$TEST_VERBOSE" || ! $_passed ; then
+       if [ -n "$_extra_header" ] ; then
+           cat <<EOF
+
+==================================================
+$_extra_header
+EOF
+       fi
+
+cat <<EOF
+--------------------------------------------------
+Output (Exit status: ${_rc}):
+--------------------------------------------------
+EOF
+       echo "$_out" | cat $TEST_CAT_RESULTS_OPTS
+    fi
+
+    if ! $_passed ; then
+       cat <<EOF
+--------------------------------------------------
+Required output (Exit status: ${required_rc}):
+--------------------------------------------------
+EOF
+       echo "$required_output" | cat $TEST_CAT_RESULTS_OPTS
+
+       if $TEST_DIFF_RESULTS ; then
+           _outr=$(mktemp)
+           echo "$required_output" >"$_outr"
+
+           _outf=$(mktemp)
+           echo "$_out" >"$_outf"
+
+           cat <<EOF
+--------------------------------------------------
+Diff:
+--------------------------------------------------
+EOF
+           diff -u "$_outr" "$_outf" | cat -A
+           rm "$_outr" "$_outf"
+       fi
+    fi
+}
+
+result_footer ()
+{
+    _passed="$1"
+    _extra_footer="$2"
+
+    if "$TEST_VERBOSE" || ! $_passed ; then
+       if [ -n "$_extra_footer" ] ; then
+           cat <<EOF
+--------------------------------------------------
+$_extra_footer
+--------------------------------------------------
+EOF
+       fi
+    fi
+
+    if $_passed ; then
+       echo "PASSED"
+       return 0
+    else
+       echo
+       echo "FAILED"
+       return 1
+    fi
+}
+
+result_check ()
+{
+    _rc=$?
+
+    _extra_header="$1"
+
+    if [ -n "$OUT_FILTER" ] ; then
+       _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
+    else
+       _fout="$_out"
+    fi
+
+    if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
+       _passed=true
+    else
+       _passed=false
+    fi
+
+    result_print "$_passed" "$_out" "$_rc" "$_extra_header"
+    result_footer "$_passed"
+}
+
+local="${TEST_SUBDIR}/scripts/local.sh"
+if [ -r "$local" ] ; then
+    . "$local"
+fi
index fa5e25affccc2cde87e272c108bf1a30527c096c..3d8221a58c0d1a482e71c70b8896f87c15caf3ba 100755 (executable)
@@ -31,7 +31,7 @@ onnode all onnode all true
 # We're seeing some weirdness with CTDB controls timing out.  We're
 # wondering if time is jumping forward, so this creates a time log on
 # each node that we can examine later if tests fail weirdly.
-if [ -n "$CTDB_TEST_REAL_CLUSTER" ] ; then
+if [ -n "$CTDB_TEST_REAL_CLUSTER" -a -n "$CTDB_TEST_TIME_LOGGING" ] ; then
     echo "Starting time logging on each node..."
     f="/var/log/ctdb.test.time.log"
     onnode -p all "[ -f $f ] || while : ; do date '+%s %N' ; sleep 1 ; done >$f 2>&1 </dev/null &"  &
diff --git a/ctdb/tests/takeover/common.sh b/ctdb/tests/takeover/common.sh
deleted file mode 100644 (file)
index 716e4d5..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
-
-# Print a message and exit.
-die () { echo "$@" >&2 ; exit 1 ; }
-
-test_prog="$(dirname ${TAKEOVER_TESTS_DIR})/bin/ctdb_takeover_tests ctdb_takeover_run_core"
-
-define_test ()
-{
-    _f="$0"
-    _f="${_f#./}"  # strip leading ./
-    _f="${_f#testcases/}"  # strip leading testcases/
-    _f="${_f%.sh}" # strip off .sh suffix if any
-
-    case "$_f" in
-       nondet.*)
-           algorithm="nondet"
-           export CTDB_LCP2="no"
-           ;;
-       lcp2.*)
-           algorithm="lcp2"
-           export CTDB_LCP2="yes"
-           ;;
-       *)
-           die "Unknown algorithm for testcase \"$_f\""
-    esac
-
-    printf "%-12s - %s\n" "$_f" "$1"
-}
-
-required_result ()
-{
-    required_rc="${1:-0}"
-    required_output=$(cat)
-}
-
-simple_test ()
-{
-    _states="$1"
-    _out=$($test_prog $_states 2>&1)
-    _rc=$?
-
-    if [ "$algorithm" = "lcp2" -a -n "$CTDB_TEST_LOGLEVEL" ] ; then
-       OUT_FILTER='s@^.*:@DATE TIME \[PID\]:@'
-    fi
-
-    if [ -n "$OUT_FILTER" ] ; then
-       _fout=$(echo "$_out" | sed -r "$OUT_FILTER")
-    else
-       _fout="$_out"
-    fi
-
-    if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
-       echo "PASSED"
-    else
-       cat <<EOF
-Algorithm: $algorithm
-
-##################################################
-Required output (Exit status: ${required_rc}):
-##################################################
-$required_output
-##################################################
-Actual output (Exit status: ${_rc}):
-##################################################
-$_out
-EOF
-       return 1
-    fi
-}
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.001.sh
rename to ctdb/tests/takeover/lcp2.001.sh
index f792f5989f09b30d265c9246dd469758df6b9671..8772318d6e3ff07e1bfed4ba927cb204ddf9ab8d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 3 -> 1 healthy"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.002.sh
rename to ctdb/tests/takeover/lcp2.002.sh
index 17b85ee771336e54eaefb4480b31b0a723f1a2c0..f3f6f0a6b1a67ea4d9431c95339babdbe5e05d89 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 3 -> 2 healthy"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.003.sh
rename to ctdb/tests/takeover/lcp2.003.sh
index f47ad88aad64a3f888d36c32385a8e4c0d8335d3..f6cfe57b2d9a778e53ca6680745969922766aa71 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 1 -> all healthy"
 
similarity index 95%
rename from ctdb/tests/takeover/testcases/lcp2.004.sh
rename to ctdb/tests/takeover/lcp2.004.sh
index a277bf6eef78f3cbb09f8d6e2f95cdb2b8bec629..c067184d3832774039d94bda21feb21aebb627e5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 1 -> all healthy, info logging"
 
similarity index 99%
rename from ctdb/tests/takeover/testcases/lcp2.005.sh
rename to ctdb/tests/takeover/lcp2.005.sh
index 3dbe532cb62a28692eb29823dc4e85eb3d4c6f75..4a8c0ea982aedbf6b5830a98fae5487cac591902 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 1 -> all healthy, debug logging"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.006.sh
rename to ctdb/tests/takeover/lcp2.006.sh
index 639796d6c2f44aca1456288e842941adf9a34fb9..13bb40fd69caf31aead464c54cacb7b63c81182d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 0 -> 1 healthy"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.007.sh
rename to ctdb/tests/takeover/lcp2.007.sh
index b15fcd8313bbeb324afc0999c4e7846535908083..76fa06e212a0c44d17712c6f59cb9fa512c3ff93 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 0 -> 2 healthy"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.008.sh
rename to ctdb/tests/takeover/lcp2.008.sh
index 48d8532cfd71af6cbb24e854b23a06405bcfa0e3..f5c0af3a7c684ffd7676aee4671534be3df70860 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 0 -> all healthy"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/lcp2.009.sh
rename to ctdb/tests/takeover/lcp2.009.sh
index df706369b84abf6d73c8386efbd93bb905870bfd..e862c928070a6c1c2ebf561a0dc298b839b0b4fb 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 3 healthy -> all disconnected"
 
similarity index 95%
rename from ctdb/tests/takeover/testcases/lcp2.010.sh
rename to ctdb/tests/takeover/lcp2.010.sh
index c47b6528cd54bb013a51f51e4946a401b5884984..20b1c98e65e6fa35072f0ffaf7b60e7aa1e27b29 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "2 disjoint groups of nodes/addresses, a node becomes healthy"
 
diff --git a/ctdb/tests/takeover/lcp2.011.sh b/ctdb/tests/takeover/lcp2.011.sh
new file mode 100755 (executable)
index 0000000..f752aa3
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "2 disjoint groups of nodes/addresses, continue a stopped node"
+
+# Another LCP2 1.0 bug
+
+export CTDB_TEST_LOGLEVEL=0
+
+required_result <<EOF
+10.11.19.46 3
+10.11.19.45 3
+10.11.19.44 1
+10.11.18.46 1
+10.11.18.45 3
+10.11.18.44 1
+10.11.17.46 3
+10.11.17.45 3
+10.11.17.44 1
+10.11.16.46 1
+10.11.16.45 3
+10.11.16.44 1
+9.11.136.46 2
+9.11.136.45 0
+9.11.136.44 2
+EOF
+
+simple_test 0,0,0,0 <<EOF
+9.11.136.44 2 0,2
+9.11.136.45 2 0,2
+9.11.136.46 2 0,2
+10.11.16.44 1 1,3
+10.11.16.45 3 1,3
+10.11.16.46 1 1,3
+10.11.17.44 1 1,3
+10.11.17.45 3 1,3
+10.11.17.46 3 1,3
+10.11.18.44 1 1,3
+10.11.18.45 3 1,3
+10.11.18.46 1 1,3
+10.11.19.44 1 1,3
+10.11.19.45 3 1,3
+10.11.19.46 3 1,3
+EOF
diff --git a/ctdb/tests/takeover/lcp2.012.sh b/ctdb/tests/takeover/lcp2.012.sh
new file mode 100755 (executable)
index 0000000..70dad93
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Node with NODE_FLAGS_NOIPTAKEOVER doesn't gain IPs"
+
+export CTDB_TEST_LOGLEVEL=0
+
+required_result <<EOF
+192.168.21.254 1
+192.168.21.253 2
+192.168.21.252 1
+192.168.20.254 2
+192.168.20.253 2
+192.168.20.252 1
+192.168.20.251 2
+192.168.20.250 1
+192.168.20.249 1
+EOF
+
+simple_test 0x01000000,0,0 <<EOF
+192.168.20.249 1
+192.168.20.250 1
+192.168.20.251 1
+192.168.20.252 1
+192.168.20.253 1
+192.168.20.254 1
+192.168.21.252 1
+192.168.21.253 1
+192.168.21.254 1
+EOF
diff --git a/ctdb/tests/takeover/lcp2.013.sh b/ctdb/tests/takeover/lcp2.013.sh
new file mode 100755 (executable)
index 0000000..4d01f12
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Node with NODE_FLAGS_NOIPTAKEOVER doesn't lose IPs"
+
+export CTDB_TEST_LOGLEVEL=0
+
+required_result <<EOF
+192.168.21.254 2
+192.168.21.253 1
+192.168.21.252 0
+192.168.20.254 2
+192.168.20.253 1
+192.168.20.252 0
+192.168.20.251 2
+192.168.20.250 1
+192.168.20.249 0
+EOF
+
+simple_test 0x01000000,0,0 <<EOF
+192.168.20.249 0
+192.168.20.250 1
+192.168.20.251 2
+192.168.20.252 0
+192.168.20.253 1
+192.168.20.254 2
+192.168.21.252 0
+192.168.21.253 1
+192.168.21.254 2
+EOF
similarity index 91%
rename from ctdb/tests/takeover/testcases/nondet.001.sh
rename to ctdb/tests/takeover/nondet.001.sh
index 52f4598fb021b22862efd36ae5561a3c0935e0ad..71506070c09b64f05576780f1d5011e2c65e7a49 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 1 healthy"
 
similarity index 91%
rename from ctdb/tests/takeover/testcases/nondet.002.sh
rename to ctdb/tests/takeover/nondet.002.sh
index 9a4ef44b4dc6b99f22dd586c326e3c90839d256a..4ff801b1c4ed1af8cae624d400f2dea4d4dc9c24 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 2 healthy"
 
similarity index 92%
rename from ctdb/tests/takeover/testcases/nondet.003.sh
rename to ctdb/tests/takeover/nondet.003.sh
index b75fc6d6f01e4478ef565c05e91ea8f21312372e..2a9dfb4679b6622474ec265cdd426cfff76a1552 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TAKEOVER_TESTS_DIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "3 nodes, 1 -> all healthy"
 
diff --git a/ctdb/tests/takeover/run_tests.sh b/ctdb/tests/takeover/run_tests.sh
deleted file mode 100755 (executable)
index f019e8f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-# Run some IP allocation unit tests.
-
-cd $(dirname "$0")
-export TAKEOVER_TESTS_DIR=$(pwd)
-
-test_dir=$(dirname "$TAKEOVER_TESTS_DIR")
-
-opts="-d"
-
-for i ; do
-    case "$i" in
-       -*)
-           opts="$opts $i"
-           shift
-           ;;
-       *)
-           break
-    esac
-done
-
-tests=""
-if [ -z "$*" ] ; then
-    tests=$(ls testcases/*.[0-9][0-9][0-9].sh 2>/dev/null)
-fi
-
-"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1
-
-echo "All OK"
-exit 0
diff --git a/ctdb/tests/takeover/scripts/local.sh b/ctdb/tests/takeover/scripts/local.sh
new file mode 100644 (file)
index 0000000..ba46ef2
--- /dev/null
@@ -0,0 +1,36 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+test_prog="$(dirname ${TEST_SUBDIR})/bin/ctdb_takeover_tests ctdb_takeover_run_core"
+
+define_test ()
+{
+    _f=$(basename "$0" ".sh")
+
+    case "$_f" in
+       nondet.*)
+           algorithm="nondet"
+           export CTDB_LCP2="no"
+           ;;
+       lcp2.*)
+           algorithm="lcp2"
+           export CTDB_LCP2="yes"
+           ;;
+       *)
+           die "Unknown algorithm for testcase \"$_f\""
+    esac
+
+    printf "%-12s - %s\n" "$_f" "$1"
+}
+
+simple_test ()
+{
+    # Do some filtering of the output to replace date/time.
+    if [ "$algorithm" = "lcp2" -a -n "$CTDB_TEST_LOGLEVEL" ] ; then
+       OUT_FILTER='s@^.*:@DATE\ TIME\ \[PID\]:@'
+    fi
+
+    _states="$1"
+    _out=$($test_prog $_states 2>&1)
+
+    result_check "Algorithm: $algorithm"
+}
similarity index 99%
rename from ctdb/tests/takeover/ctdb_takeover.py
rename to ctdb/tests/takeover/simulation/ctdb_takeover.py
index bc24fd416203f442b56763e7f97af6cef31d01b2..4b7ceef468260eb6b5be64166b54a37e5b94c79a 100755 (executable)
@@ -786,7 +786,7 @@ class Cluster(object):
         else:
             os.environ["CTDB_TEST_LOGLEVEL"] = "0"
 
-        p = subprocess.Popen("../bin/ctdb_takeover_tests ctdb_takeover_run_core %s 2>&1" % nodestates,
+        p = subprocess.Popen("../../bin/ctdb_takeover_tests ctdb_takeover_run_core %s 2>&1" % nodestates,
                              shell=True,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE)
         p.stdin.write("\n".join(in_lines))
diff --git a/ctdb/tests/takeover/simulation/hey_jude.py b/ctdb/tests/takeover/simulation/hey_jude.py
new file mode 100755 (executable)
index 0000000..a6b14c5
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+from ctdb_takeover import Cluster, Node, process_args
+
+process_args()
+
+addresses10 = ['10.4.20.%d' % n for n in range(154, 168)]
+addresses172a = ['172.20.106.%d' % n for n in range(110, 124)]
+addresses172b = ['172.20.107.%d' % n for n in range(110, 117)]
+
+c = Cluster()
+
+#for i in range(7):
+#    c.add_node(Node([addresses10, addresses172]))
+
+
+for i in range(4):
+    c.add_node(Node([addresses172a, addresses172b]))
+for i in range(3):
+    c.add_node(Node(addresses10))
+
+c.recover()
+
+c.random_iterations()
diff --git a/ctdb/tests/tool/common.sh b/ctdb/tests/tool/common.sh
deleted file mode 100644 (file)
index 506c7d0..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
-
-# Print a message and exit.
-die () { echo "$@" >&2 ; exit 1 ; }
-
-test_bin="$(dirname ${TESTS_SUBDIR})/bin"
-
-define_test ()
-{
-    _f="$0"
-    _f="${_f#./}"  # strip leading ./
-    _f="${_f#testcases/}"  # strip leading testcases/
-    _f="${_f%.sh}" # strip off .sh suffix if any
-
-    case "$_f" in
-       func.*)
-           _func="${_f#func.}"
-           _func="${_func%.*}" # Strip test number
-           test_prog="${test_bin}/ctdb_tool_libctdb ${_func}"
-           ;;
-       stubby.*)
-           _cmd="${_f#stubby.}"
-           _cmd="${_cmd%.*}" # Strip test number
-           test_prog="${test_bin}/ctdb_tool_stubby ${_cmd}"
-           ;;
-       *)
-           die "Unknown pattern for testcase \"$_f\""
-    esac
-
-    printf "%-28s - %s\n" "$_f" "$1"
-}
-
-required_result ()
-{
-    required_rc="${1:-0}"
-    required_output=$(cat)
-}
-
-simple_test ()
-{
-    _out=$($test_prog "$@" 2>&1)
-    _rc=$?
-
-    # 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
-
-    if [ -n "$OUT_FILTER" ] ; then
-       _fout=$(echo "$_out" | sed -r "$OUT_FILTER")
-    else
-       _fout="$_out"
-    fi
-
-    if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
-       if [ "$TESTS_VERBOSE" = "yes" ] ; then
-           cat <<EOF
-##################################################
-Output (Exit status: ${_rc}):
-##################################################
-$_fout
-EOF
-       fi
-       echo "PASSED"
-    else
-       cat -A <<EOF
-##################################################
-Required output (Exit status: ${required_rc}):
-##################################################
-$required_output
-##################################################
-Actual output (Exit status: ${_rc}):
-##################################################
-$_fout
-EOF
-       return 1
-    fi
-}
similarity index 89%
rename from ctdb/tests/tool/testcases/func.parse_nodestring.001.sh
rename to ctdb/tests/tool/func.parse_nodestring.001.sh
index 04447cbb6a09504a1e1d561b9fe23f375ff827b7..d7caf89da981ce645b4291afa75ebabbc3d1afa3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, dd_ok, 3 healthy"
 
similarity index 89%
rename from ctdb/tests/tool/testcases/func.parse_nodestring.002.sh
rename to ctdb/tests/tool/func.parse_nodestring.002.sh
index f5b9777af2e53472db1f7ae68fcb779f4a1a3fb2..c89e444eaf072f7b283ea1517f2c722f009c3da4 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, dd_ok, 2 ok/1 disconnected"
 
similarity index 89%
rename from ctdb/tests/tool/testcases/func.parse_nodestring.003.sh
rename to ctdb/tests/tool/func.parse_nodestring.003.sh
index 709bfa20e4a11c06399c63b42a50e749f71771e9..3e03ac40419d338446ee4d6fe4d466b74e09c6f9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, current disconnected"
 
diff --git a/ctdb/tests/tool/run_tests.sh b/ctdb/tests/tool/run_tests.sh
deleted file mode 100755 (executable)
index cf68322..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-# Run some IP allocation unit tests.
-
-cd $(dirname "$0")
-export TESTS_SUBDIR=$(pwd)
-
-test_dir=$(dirname "$TESTS_SUBDIR")
-
-opts="-d"
-
-for i ; do
-    case "$i" in
-       -v)
-           export TESTS_VERBOSE="yes"
-           shift
-           ;;
-       -*)
-           opts="$opts $i"
-           shift
-           ;;
-       *)
-           break
-    esac
-done
-
-tests=""
-if [ -z "$*" ] ; then
-    tests=$(ls testcases/*.[0-9][0-9][0-9].sh 2>/dev/null)
-fi
-
-"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1
-
-echo "All OK"
-exit 0
diff --git a/ctdb/tests/tool/scripts/local.sh b/ctdb/tests/tool/scripts/local.sh
new file mode 100644 (file)
index 0000000..1105628
--- /dev/null
@@ -0,0 +1,38 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+test_bin="$(dirname ${TEST_SUBDIR})/bin"
+
+define_test ()
+{
+    _f=$(basename "$0" ".sh")
+
+    case "$_f" in
+       func.*)
+           _func="${_f#func.}"
+           _func="${_func%.*}" # Strip test number
+           test_prog="${test_bin}/ctdb_tool_libctdb ${_func}"
+           ;;
+       stubby.*)
+           _cmd="${_f#stubby.}"
+           _cmd="${_cmd%.*}" # Strip test number
+           test_prog="${test_bin}/ctdb_tool_stubby ${_cmd}"
+           ;;
+       *)
+           die "Unknown pattern for testcase \"$_f\""
+    esac
+
+    printf "%-28s - %s\n" "$_f" "$1"
+}
+
+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=$($test_prog "$@" 2>&1)
+
+    result_check
+}
similarity index 92%
rename from ctdb/tests/tool/testcases/stubby.nodestatus.001.sh
rename to ctdb/tests/tool/stubby.nodestatus.001.sh
index 1d364277afd27c6b41528086b65641a7317defa5..6392b8d1eccff0217198ad1edd008f07e433db02 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, 3 nodes, all OK"
 
similarity index 92%
rename from ctdb/tests/tool/testcases/stubby.nodestatus.002.sh
rename to ctdb/tests/tool/stubby.nodestatus.002.sh
index 9e311b2d7d013128a18c042b947c5529d6072e94..f5b1909a07c3f90739aaf033afba469d10e7ad2f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "-n all, 3 nodes, all OK"
 
similarity index 93%
rename from ctdb/tests/tool/testcases/stubby.nodestatus.003.sh
rename to ctdb/tests/tool/stubby.nodestatus.003.sh
index 28837d0af8b3f54c35c5d01f8efd3ecacb933767..a3a7a42e4344a5b310783800d42f290a42d2b98a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, 3 nodes, 1 disconnected"
 
similarity index 93%
rename from ctdb/tests/tool/testcases/stubby.nodestatus.004.sh
rename to ctdb/tests/tool/stubby.nodestatus.004.sh
index 0679f62aa6ed21893cc165c214e0b782ad1717bb..bc9890590c93c3f17d08c6cadd16c27a6add1dfd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "-n all, 3 nodes, 1 disconnected"
 
diff --git a/ctdb/tests/tool/stubby.nodestatus.005.sh b/ctdb/tests/tool/stubby.nodestatus.005.sh
new file mode 100755 (executable)
index 0000000..cb532e7
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "-n all all, 3 nodes, 1 disconnected"
+
+required_result 1 <<EOF
+Number of nodes:3
+pnn:0 192.168.20.41    OK (THIS NODE)
+pnn:1 192.168.20.42    DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43    OK
+Number of nodes:3
+pnn:0 192.168.20.41    OK
+pnn:1 192.168.20.42    DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43    OK (THIS NODE)
+EOF
+
+simple_test -n all all <<EOF
+NODEMAP
+0       192.168.20.41   0x0
+1       192.168.20.42   0x1
+2       192.168.20.43   0x0     CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
similarity index 94%
rename from ctdb/tests/tool/testcases/stubby.status.001.sh
rename to ctdb/tests/tool/stubby.status.001.sh
index 74cdc39c222190572c182158eb84b906492c3347..48b5bac24a97abff8a98b4926f9fefc19fa81ef9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, 3 nodes, all ok"
 
similarity index 94%
rename from ctdb/tests/tool/testcases/stubby.status.002.sh
rename to ctdb/tests/tool/stubby.status.002.sh
index 77d3cc22374aaab498b77702066674bf38a5c0f4..fceceb30e0d1e7f31601cf2eb315b88753a2c3d1 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. "${TESTS_SUBDIR}/common.sh"
+. "${TEST_SCRIPTS_DIR}/unit.sh"
 
 define_test "all, 3 nodes, 1 unhealthy"