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

Unified Diff: test_utils.h

Issue 5561003: AU: Try to remove unit test flakiness on buildbots. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: Created 10 years 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: test_utils.h
diff --git a/test_utils.h b/test_utils.h
index 9f2fee29aa1c6dffff2e03ed91a3da05ed3d00b9..4c8288892b37eb82dd4e904d0f40b62965efa8ee 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -108,13 +108,19 @@ class ScopedLoopbackDeviceReleaser {
public:
explicit ScopedLoopbackDeviceReleaser(const std::string& dev) : dev_(dev) {}
~ScopedLoopbackDeviceReleaser() {
- std::vector<std::string> args;
- args.push_back("/sbin/losetup");
- args.push_back("-d");
- args.push_back(dev_);
- int return_code = 0;
- EXPECT_TRUE(Subprocess::SynchronousExec(args, &return_code));
- EXPECT_EQ(0, return_code);
+ for (int retry = 0; retry < 5; retry++) {
+ std::vector<std::string> args;
+ args.push_back("/sbin/losetup");
+ args.push_back("-d");
+ args.push_back(dev_);
+ int return_code = 0;
+ EXPECT_TRUE(Subprocess::SynchronousExec(args, &return_code));
+ if (return_code == 0) {
+ return;
+ }
+ sleep(1);
+ }
+ ADD_FAILURE();
}
private:
const std::string dev_;
« 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