mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
ctdb-tests: Use test_case() to help document test cases
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
d52b497d11
commit
6d3c9e64d9
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user