From c6b861ba646bd8f4d651b74e733256a7a3b81a32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Mon, 18 Aug 2014 00:00:59 -0400 Subject: [PATCH] tests: Call sync before testing a shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/tests/lxc-test-autostart | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- 2.47.3