From: Stéphane Graber Date: Mon, 18 Aug 2014 04:00:59 +0000 (-0400) Subject: tests: Call sync before testing a shutdown X-Git-Tag: lxc-1.1.0.alpha2~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b861ba646bd8f4d651b74e733256a7a3b81a32;p=thirdparty%2Flxc.git tests: Call sync before testing a shutdown This should avoid tests failure when the machine running the tests has either very slow disks or a lot of data waiting to be flushed. Signed-off-by: Stéphane Graber --- diff --git a/src/tests/lxc-test-autostart b/src/tests/lxc-test-autostart index 845a06a94..5b606f5e7 100755 --- a/src/tests/lxc-test-autostart +++ b/src/tests/lxc-test-autostart @@ -74,6 +74,13 @@ lxc-autostart -g lxc-auto-test -r lxc-wait -n $CONTAINER_NAME -t 5 -s RUNNING || (echo "Container didn't restart" && exit 1) sleep 5 +# When shutting down, the container calls sync. If the machine running +# the test has a massive backlog, it can take minutes for the sync call to +# finish, causing a test failure. +# So try to reduce that by flushing everything to disk before we attempt +# a container shutdown. +sync + # Shut it down lxc-autostart -g lxc-auto-test -s -t 120 lxc-wait -n $CONTAINER_NAME -t 120 -s STOPPED || (echo "Container didn't stop" && exit 1)