Allow it to trigger on a particular command instead of
unconditionally. Wrap setting and clearing the variable.
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
setup
-export FAKE_TIMEOUT="yes"
+timeout_trigger "yes"
required_result 1 <<EOF
ERROR: smb.conf cache create failed - testparm command timed out
EOF
ok_null
simple_test
-export FAKE_TIMEOUT="yes"
+timeout_trigger "yes"
ok <<EOF
WARNING: smb.conf cache update timed out - using old cache file
EOF
echo "${_net}/${_maskbits}"
}
+# Cause the timeout stub to fail.
+timeout_trigger()
+{
+ export FAKE_TIMEOUT="$*"
+}
+
+timeout_clear()
+{
+ unset FAKE_TIMEOUT
+}
+
######################################################################
# CTDB fakery
#!/bin/sh
-if [ -n "$FAKE_TIMEOUT" ]; then
+# Throw away the timeout argument
+shift
+
+if [ "$FAKE_TIMEOUT" = "yes" ] || [ "$FAKE_TIMEOUT" = "$*" ]; then
exit 124
else
- shift 1
exec "$@"
fi