Minor changes to FilesystemCopierAction.RunAsRootSimpleTest.
- Fail the test if loop devices cannot be bound.
- More detailed logging.
BUG=chromium-os:31082
TEST=Builds and runs unit tests
Change-Id: Ic8adfe08a86a91e0d45275ec8ccc31af1b481737
Reviewed-on: https://gerrit.chromium.org/gerrit/28427
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/filesystem_copier_action_unittest.cc b/filesystem_copier_action_unittest.cc
index cb9c817..62b39a6 100644
--- a/filesystem_copier_action_unittest.cc
+++ b/filesystem_copier_action_unittest.cc
@@ -146,9 +146,15 @@
ScopedLoopbackDeviceBinder a_dev_releaser(a_loop_file, &a_dev);
ScopedLoopbackDeviceBinder b_dev_releaser(b_loop_file, &b_dev);
+ if (!(a_dev_releaser.is_bound() && b_dev_releaser.is_bound())) {
+ ADD_FAILURE();
+ return false;
+ }
- LOG(INFO) << "copying: " << a_loop_file << " -> " << b_loop_file
- << ", " << kLoopFileSize << " bytes";
+ LOG(INFO) << "copying: "
+ << a_loop_file << " (" << a_dev << ") -> "
+ << b_loop_file << " (" << b_dev << ", "
+ << kLoopFileSize << " bytes";
bool success = true;
// Set up the action objects
diff --git a/test_utils.h b/test_utils.h
index 6d85157..8305c14 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -146,6 +146,8 @@
return dev_;
}
+ bool is_bound() const { return is_bound_; }
+
private:
std::string dev_;
bool is_bound_;