]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Use test_case() to help document test cases
authorMartin Schwenke <martin@meltin.net>
Mon, 28 Feb 2022 04:44:04 +0000 (15:44 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 3 May 2022 09:19:31 +0000 (09:19 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/UNIT/cunit/cluster_mutex_001.sh
ctdb/tests/UNIT/cunit/cluster_mutex_002.sh
ctdb/tests/UNIT/cunit/cluster_mutex_003.sh
ctdb/tests/UNIT/cunit/system_socket_test_002.sh
ctdb/tests/UNIT/cunit/system_socket_test_003.sh

index eaa7b2d5b1c8d72ae2dd5a58201bc41ce86cf040..79761436d9278e740d48e34c66df83c426518bd1 100755 (executable)
@@ -10,12 +10,14 @@ export CTDB_CLUSTER_MUTEX_HELPER="$t"
 lockfile="${CTDB_TEST_TMP_DIR}/cluster_mutex.lockfile"
 trap 'rm -f ${lockfile}' 0
 
+test_case "No contention: lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock "$lockfile"
 
+test_case "Contention: lock, lock, unlock"
 ok <<EOF
 LOCK
 CONTENTION
@@ -24,6 +26,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-lock-unlock "$lockfile"
 
+test_case "No contention: lock, unlock, lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
@@ -32,24 +35,28 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock-lock-unlock "$lockfile"
 
+test_case "Cancelled: unlock while lock still in progress"
 ok <<EOF
 CANCEL
 NOLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-check "$lockfile"
 
+test_case "Cancelled: unlock while lock still in progress, unlock again"
 ok <<EOF
 CANCEL
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-unlock "$lockfile"
 
+test_case "PPID doesn't go away: lock, wait, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-wait-unlock "$lockfile"
 
+test_case "PPID goes away: lock, wait, lock, unlock"
 ok <<EOF
 LOCK
 parent gone
index c36a9f583a94983085491c4551723bc94745988b..65d57c3f2b1ebafc61aa25ce684ca917a6884632 100755 (executable)
@@ -12,12 +12,14 @@ trap 'rm ${lockfile}' 0
 t="${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb_mutex_fcntl_helper"
 helper="!${t} ${lockfile}"
 
+test_case "No contention: lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock "$helper"
 
+test_case "Contention: lock, lock, unlock"
 ok <<EOF
 LOCK
 CONTENTION
@@ -26,6 +28,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-lock-unlock "$helper"
 
+test_case "No contention: lock, unlock, lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
@@ -34,24 +37,28 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock-lock-unlock "$helper"
 
+test_case "Cancelled: unlock while lock still in progress"
 ok <<EOF
 CANCEL
 NOLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-check "$helper"
 
+test_case "Cancelled: unlock while lock still in progress, unlock again"
 ok <<EOF
 CANCEL
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-unlock "$helper"
 
+test_case "PPID doesn't go away: lock, wait, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-wait-unlock "$helper"
 
+test_case "PPID goes away: lock, wait, lock, unlock"
 ok <<EOF
 LOCK
 parent gone
@@ -60,6 +67,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-ppid-gone-lock-unlock "$helper"
 
+test_case "Recheck off, lock file removed"
 ok <<EOF
 LOCK
 LOCK
@@ -69,6 +77,7 @@ EOF
 unit_test cluster_mutex_test lock-file-removed-no-recheck \
          "$helper 0" "$lockfile"
 
+test_case "Recheck on, lock file not removed"
 ok <<EOF
 LOCK
 UNLOCK
@@ -76,6 +85,7 @@ EOF
 unit_test cluster_mutex_test lock-file-wait-recheck-unlock \
          "$helper 5" 10
 
+test_case "Recheck on, lock file removed"
 ok <<EOF
 LOCK
 ctdb_mutex_fcntl_helper: lock lost - lock file "${lockfile}" check failed (ret=2)
@@ -83,6 +93,7 @@ LOST
 EOF
 unit_test cluster_mutex_test lock-file-removed "$helper 5" "$lockfile"
 
+test_case "Recheck on, lock file replaced"
 ok <<EOF
 LOCK
 ctdb_mutex_fcntl_helper: lock lost - lock file "${lockfile}" inode changed
index e4f95c1f50984f18198d2014a3707c110678f7d2..57319bd2ef26485f9da497a7e36fdc763edded67 100755 (executable)
@@ -19,12 +19,14 @@ else
        helper="!${t} ${lockfile}"
 fi
 
+test_case "No contention: lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock "$helper"
 
+test_case "Contention: lock, lock, unlock"
 ok <<EOF
 LOCK
 CONTENTION
@@ -33,6 +35,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-lock-unlock "$helper"
 
+test_case "No contention: lock, unlock, lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
@@ -41,24 +44,28 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock-lock-unlock "$helper"
 
+test_case "Cancelled: unlock while lock still in progress"
 ok <<EOF
 CANCEL
 NOLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-check "$helper"
 
+test_case "Cancelled: unlock while lock still in progress, unlock again"
 ok <<EOF
 CANCEL
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-unlock "$helper"
 
+test_case "PPID doesn't go away: lock, wait, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-wait-unlock "$helper"
 
+test_case "PPID goes away: lock, wait, lock, unlock"
 ok <<EOF
 LOCK
 parent gone
index 417ad8f4792a3cd5b1c385576fcacb13205e3332..c20bcfe7547e170089e892c6e6b5780a3f959f23 100755 (executable)
@@ -7,6 +7,7 @@ tcp_test ()
        unit_test system_socket_test tcp "$@"
 }
 
+test_case "ACK, IPv4, seq# 0, ack# 0"
 ok <<EOF
 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
 000010 c0 a8 02 4b 01 bd d4 31 00 00 00 00 00 00 00 00
@@ -15,6 +16,7 @@ ok <<EOF
 EOF
 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 0 0 0
 
+test_case "RST, IPv4, seq# 0, ack# 0"
 ok <<EOF
 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
 000010 c0 a8 02 4b 01 bd d4 31 00 00 00 00 00 00 00 00
@@ -23,6 +25,7 @@ ok <<EOF
 EOF
 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 0 0 1
 
+test_case "RST, IPv4, seq# 12345, ack# 23456"
 ok <<EOF
 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
 000010 c0 a8 02 4b 01 bd d4 31 39 30 00 00 a0 5b 00 00
@@ -31,6 +34,7 @@ ok <<EOF
 EOF
 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 12345 23456 1
 
+test_case "ACK, IPv6, seq# 0, ack# 0"
 ok <<EOF
 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
@@ -41,6 +45,7 @@ EOF
 tcp_test "[fe80::6af7:28ff:fefa:d136]:445" \
         "[fe80::6af7:28ff:fefb:d137]:54321" 0 0 0
 
+test_case "RST, IPv6, seq# 0, ack# 0"
 ok <<EOF
 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
@@ -51,6 +56,7 @@ EOF
 tcp_test "[fe80::6af7:28ff:fefa:d136]:445" \
         "[fe80::6af7:28ff:fefb:d137]:54321" 0 0 1
 
+test_case "RST, IPv6, seq# 12345, ack# 23456"
 ok <<EOF
 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
index 0b265eabdfad46343b2dcbd16ed1d68b14062373..c94ac30632f30e55321c00b17064851799f3996d 100755 (executable)
@@ -9,6 +9,7 @@ arp_test ()
        unit_test system_socket_test arp "$@"
 }
 
+test_case "IPv4 ARP send"
 ok <<EOF
 000000 ff ff ff ff ff ff 12 34 56 78 9a bc 08 06 00 01
 000010 08 00 06 04 00 01 12 34 56 78 9a bc c0 a8 01 19
@@ -18,6 +19,7 @@ ok <<EOF
 EOF
 arp_test "192.168.1.25" "12:34:56:78:9a:bc"
 
+test_case "IPv4 ARP reply"
 ok <<EOF
 000000 ff ff ff ff ff ff 12 34 56 78 9a bc 08 06 00 01
 000010 08 00 06 04 00 02 12 34 56 78 9a bc c0 a8 01 19
@@ -27,6 +29,7 @@ ok <<EOF
 EOF
 arp_test "192.168.1.25" "12:34:56:78:9a:bc" reply
 
+test_case "IPv6 neighbor advertisement"
 ok <<EOF
 000000 33 33 00 00 00 01 12 34 56 78 9a bc 86 dd 60 00
 000010 00 00 00 20 3a ff fe 80 00 00 00 00 00 00 6a f7