s3: smbd: SMB2 close. If a file has delete on close, store the return info before...
[Samba.git] / ctdb / tests / simple / 51_ctdb_bench.sh
blobed39286f553be10863a11c0e64f36c574c264227
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Run the ctdb_bench test and sanity check the output.
8 This doesn't test for performance regressions or similarly anything
9 useful. Only vague sanity checking of results is done.
11 Prerequisites:
13 * An active CTDB cluster with at least 2 active nodes.
15 Steps:
17 1. Verify that the status on all of the ctdb nodes is 'OK'.
18 2. Run ctdb_bench on all nodes with default options.
19 3. Ensure that the number of +ve and -ive messages are within 1% of
20 each other.
21 4. Ensure that the number of messages per second is greater than 10.
23 Expected results:
25 * ctdb_bench runs without error and prints reasonable results.
26 EOF
29 . "${TEST_SCRIPTS_DIR}/integration.bash"
31 ctdb_test_init "$@"
33 set -e
35 cluster_is_healthy
37 try_command_on_node 0 "$CTDB listnodes"
38 num_nodes=$(echo "$out" | wc -l)
40 echo "Running ctdb_bench on all $num_nodes nodes."
41 try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND ctdb_bench -n $num_nodes
43 # Get the last line of output.
44 while read line ; do
45 prev=$line
46 done <<<"$out"
48 pat='^(Ring: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec \(\+ve=[[:digit:]]+ -ve=[[:digit:]]+\)[[:space:]]?|Waiting for cluster[[:space:]]?)+$'
49 sanity_check_output 1 "$pat" "$out"
51 # $prev should look like this:
52 # Ring: 10670.93 msgs/sec (+ve=53391 -ve=53373)
53 stuff="${prev##*Ring: }"
54 mps="${stuff% msgs/sec*}"
56 if [ ${mps%.*} -ge 10 ] ; then
57 echo "OK: $mps msgs/sec >= 10 msgs/sec"
58 else
59 echo "BAD: $mps msgs/sec < 10 msgs/sec"
60 exit 1
63 stuff="${stuff#*msgs/sec (+ve=}"
64 positive="${stuff%% *}"
66 if [ $positive -gt 0 ] ; then
67 echo "OK: +ive ($positive) > 0"
68 else
69 echo "BAD: +ive ($positive) = 0"
70 exit 1
73 stuff="${stuff#*-ve=}"
74 negative="${stuff%)}"
76 if [ $negative -gt 0 ] ; then
77 echo "OK: -ive ($negative) > 0"
78 else
79 echo "BAD: -ive ($negative) = 0"
80 exit 1
83 perc_diff=$(( ($positive - $negative) * 100 / $positive ))
84 perc_diff=${perc_diff#-}
86 check_percent=5
87 if [ $perc_diff -le $check_percent ] ; then
88 echo "OK: percentage difference between +ive and -ive ($perc_diff%) <= $check_percent%"
89 else
90 echo "BAD: percentage difference between +ive and -ive ($perc_diff%) > $check_percent%"
91 exit 1