Add support for bsdiff of file system metadata blocks
BUG=chromium-os:10188
TEST=Unit test, build delta update, apply to Mario and make sure it
boots with new version
Change-Id: I37b3fcc3c0e65e063cd95b0b3c9a5cd2261c98c9
Review URL: http://codereview.chromium.org/5684002
diff --git a/test_utils.h b/test_utils.h
index 4c82888..68de48d 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -8,8 +8,10 @@
#include <set>
#include <string>
#include <vector>
+
+#include <base/scoped_ptr.h>
#include <gtest/gtest.h>
-#include "base/scoped_ptr.h"
+
#include "update_engine/action.h"
#include "update_engine/subprocess.h"
#include "update_engine/utils.h"
@@ -92,6 +94,11 @@
const char* const kMountPath = "/tmp/UpdateEngineTests_mnt";
} // namespace {}
+// Creates an empty ext image.
+void CreateEmptyExtImageAtPath(const std::string& path,
+ size_t size,
+ int block_size);
+
// Creates an ext image with some files in it. The paths creates are
// returned in out_paths.
void CreateExtImageAtPath(const std::string& path,
@@ -211,6 +218,22 @@
T object_;
};
+class ScopedLoopMounter {
+ public:
+ explicit ScopedLoopMounter(const std::string& file_path,
+ std::string* mnt_path,
+ unsigned long flags);
+
+ private:
+ // These objects must be destructed in the following order:
+ // ScopedFilesystemUnmounter (the file system must be unmounted first)
+ // ScopedLoopbackDeviceReleaser (then the loop device can be deleted)
+ // ScopedDirRemover (then the mount point can be deleted)
+ scoped_ptr<ScopedDirRemover> dir_remover_;
+ scoped_ptr<ScopedLoopbackDeviceReleaser> loop_releaser_;
+ scoped_ptr<ScopedFilesystemUnmounter> unmounter_;
+};
+
} // namespace chromeos_update_engine
#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__