Make unit tests less timing sensitive when unmounting busy loop devices.
This CL modifies utils::UnmountFilesystem() to retry when umount()
fails to unmount a busy loop device and replaces several unit tests to
use the modified utils::UnmountFilesystem() instead of calling
System("umount").
BUG=chromium-os:35112
TEST=Run unit tests repeatedly.
Change-Id: I42978f02b4797c68acbec6c351ea2663b9ec7b59
Reviewed-on: https://gerrit.chromium.org/gerrit/34862
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index 8f42ddd..65f378e 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -119,7 +119,7 @@
ASSERT_TRUE(WriteFileString(mountpoint + "/postinst", script));
ASSERT_EQ(0, System(string("chmod a+x ") + mountpoint + "/postinst"));
- ASSERT_EQ(0, System(string("umount ") + mountpoint));
+ ASSERT_TRUE(utils::UnmountFilesystem(mountpoint));
ASSERT_EQ(0, System(string("rm -f ") + cwd + "/postinst_called"));