]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tests: Call sync before testing a shutdown
authorStéphane Graber <stgraber@ubuntu.com>
Mon, 18 Aug 2014 04:00:59 +0000 (00:00 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 18 Aug 2014 04:00:59 +0000 (00:00 -0400)
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 <stgraber@ubuntu.com>
src/tests/lxc-test-autostart

index 845a06a940d931262fae147c269cd2eb7ea1a233..5b606f5e79020de3648347dd119b695c1e3dafa5 100755 (executable)
@@ -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)