Tests - eventscripts - stop timeouts waiting for backgrounded testparm
authorMartin Schwenke <martin@meltin.net>
Fri, 19 Aug 2011 06:51:08 +0000 (16:51 +1000)
committerMartin Schwenke <martin@meltin.net>
Tue, 30 Aug 2011 06:51:55 +0000 (16:51 +1000)
Not sleeping at all speeds up the tests.  However, it can also cause
timeouts.  Therefore, every time sleep is run we force the stub to do
a short 0.1s sleep instead of whatever is specified.  This should be
enough to avoid races.

Signed-off-by: Martin Schwenke <martin@meltin.net>
tests/eventscripts/common.sh
tests/eventscripts/stubs/sleep

index f57df4eab781b7ac7ce23c031eb88f639455a894..a2bcd830c92edf6a0f3db82e40df5eb60919b099 100644 (file)
@@ -305,6 +305,11 @@ setup_samba ()
 
        export FAKE_TCP_LISTEN="0.0.0.0:445 0.0.0.0:139"
        export FAKE_WBINFO_FAIL="no"
+
+       # Some things in 50.samba are backgrounded and waited for.  If
+       # we don't sleep at all then timeouts can happen.  This avoids
+       # that...  :-)
+       export FAKE_SLEEP_FORCE=0.1
     else
        debug "Marking Samba services as down, not listening and not managed by CTDB"
         # Get into known state.
index adb63cdf41d54be5461a6e43dea4ad8a08586a26..e4542444de789dad50aea675a3f48bccc6b4770c 100755 (executable)
@@ -1,7 +1,9 @@
 #!/bin/sh
 
-if [ "$REALLY_SLEEP" = "yes" ] ; then
+if [ "$FAKE_SLEEP_REALLY" = "yes" ] ; then
     /bin/sleep "$@"
+elif [ -n "$FAKE_SLEEP_FORCE" ] ; then
+    /bin/sleep "$FAKE_SLEEP_FORCE"
 else
     :
 fi