Delete unnecessary -d options from umount in unit tests.
The -d option to umount is unnecessary in cases where the original
mount was created with '-o loop' (it says so in the man page).
Moreover, there's a demonstrable bug when using 'umount -d' in this
case: umount complains that it's unable to delete the loop device
in this case. This change silences those messages.
The demonstrated bug in umount is a plausible explanation for build
failures characterized by unexpected failures of 'mount -o loop';
see the BUG, below.
BUG=chromium-os:24975
TEST=Run the unit test, verify it still works.
Change-Id: Id537522b865b8ef1af4d7407fe8dab9556ccbec3
Reviewed-on: https://gerrit.chromium.org/gerrit/16093
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/filesystem_iterator_unittest.cc b/filesystem_iterator_unittest.cc
index 676d91f..3ffdd70 100644
--- a/filesystem_iterator_unittest.cc
+++ b/filesystem_iterator_unittest.cc
@@ -57,8 +57,8 @@
expected_paths_vector.end());
VerifyAllPaths(kMountPath, expected_paths);
- EXPECT_EQ(0, System(string("umount -d ") + kMountPath + "/some_dir/mnt"));
- EXPECT_EQ(0, System(string("umount -d ") + kMountPath));
+ EXPECT_EQ(0, System(string("umount ") + kMountPath + "/some_dir/mnt"));
+ EXPECT_EQ(0, System(string("umount ") + kMountPath));
EXPECT_EQ(0, System(string("rm -f ") + first_image + " " + sub_image));
}
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index a5649e0..2229004 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -118,7 +118,7 @@
ASSERT_TRUE(WriteFileString(mountpoint + "/postinst", script));
ASSERT_EQ(0, System(string("chmod a+x ") + mountpoint + "/postinst"));
- ASSERT_EQ(0, System(string("umount -d ") + mountpoint));
+ ASSERT_EQ(0, System(string("umount ") + mountpoint));
ASSERT_EQ(0, System(string("rm -f ") + cwd + "/postinst_called"));
diff --git a/test_utils.cc b/test_utils.cc
index fcaae46..0a30ddf 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -217,7 +217,7 @@
kMountPath, kMountPath)));
EXPECT_EQ(0, System(StringPrintf("ln -s bogus %s/boguslink",
kMountPath)));
- EXPECT_EQ(0, System(StringPrintf("umount -d %s", kMountPath)));
+ EXPECT_EQ(0, System(StringPrintf("umount %s", kMountPath)));
if (out_paths) {
out_paths->clear();