Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Unified Diff: postinstall_runner_action_unittest.cc

Issue 6609041: Use the scoped loopback releaser which implements timeout and retries. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698