Index: postinstall_runner_action_unittest.cc |
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc |
index baf03b656f0fcb727f6302e308570c21cf3fa349..05acb4c6b52cd4d7bb024dd0671a30eef9ede6fb 100644 |
--- a/postinstall_runner_action_unittest.cc |
+++ b/postinstall_runner_action_unittest.cc |
@@ -132,8 +132,11 @@ void PostinstallRunnerActionTest::DoTest(bool do_losetup, bool do_err_script) { |
if (dev[strlen(dev) - 1] == '\n') |
dev[strlen(dev) - 1] = '\0'; |
- if (do_losetup) |
+ scoped_ptr<ScopedLoopbackDeviceReleaser> loop_releaser; |
+ if (do_losetup) { |
ASSERT_EQ(0, System(string("losetup ") + dev + " " + cwd + "/image.dat")); |
+ loop_releaser.reset(new ScopedLoopbackDeviceReleaser(dev)); |
+ } |
ActionProcessor processor; |
ObjectFeederAction<InstallPlan> feeder_action; |
@@ -172,8 +175,9 @@ void PostinstallRunnerActionTest::DoTest(bool do_losetup, bool do_err_script) { |
else |
ASSERT_LT(rc, 0); |
- if (do_losetup) |
- ASSERT_EQ(0, System(string("losetup -d ") + dev)); |
+ if (do_losetup) { |
+ loop_releaser.reset(NULL); |
+ } |
ASSERT_EQ(0, System(string("rm -f ") + cwd + "/postinst_called")); |
ASSERT_EQ(0, System(string("rm -f ") + cwd + "/image.dat")); |
} |