diff options
Diffstat (limited to 'debian/tests/delay')
-rwxr-xr-x | debian/tests/delay | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/tests/delay b/debian/tests/delay new file mode 100755 index 0000000..ad0af03 --- /dev/null +++ b/debian/tests/delay @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +DEFAULT_ARGS='delay=10\n login=test\n passwd=test\n ipaddr=127.0.0.1\n port=1\n managed=1\n devices=test\n session_url=http://127.0.0.1\n email=test@test.te\n ping_targets=localhost' +OUTPUT=$AUTOPKGTEST_TMP/delay +mkdir -p $OUTPUT + +for agent in /usr/sbin/fence_*; do + [ "$agent" = "/usr/sbin/fence_ack_manual" ] && continue + [ "$agent" = "/usr/sbin/fence_kdump" ] && continue + + ARGS="$DEFAULT_ARGS" + if [ "$agent" = "/usr/sbin/fence_cisco_mds" ]; then + ARGS=$(echo "$ARGS" | sed 's#port=1#port=fc1/1#') + fi + LOG="$OUTPUT/$(basename $agent)" + + ( + TIME=$(/usr/bin/time -p sh -c "printf '$ARGS' | $agent " 2>&1 | awk -F"[. ]" -vOFS= '/real/ {print $2,$3}') + if [ "$TIME" -lt 1000 ]; then + echo "$agent delay too low: $TIME" | tee $LOG + else + echo "$agent delay ok: $TIME" | tee $LOG + fi + ) & + pids="$pids $!" +done + +wait $pids + +if grep -qr 'delay too low' $OUTPUT; then + exit 1 +fi |