update_engine: Introduce FilesystemInterface abstraction. The interaction with the filesystem in the payload generation process is hard-coded in several places, making it hard to mock out or use a different filesystem like squashfs for delta generation. For example, the metadata, regular file data and non-file data are handled by three different functions in a similar way, but with different code. This patch introcudes a filesystem abstraction to map files or pseudo-files (like the metadata, free-space, etc) into the same interface. The interface includes three implementations: for parsing ext2 filesystems using ext2fs (already used by the metadata parsing but not by the file data processing), a raw one for monolitic partitions like the kernel and a fake one used for testing without requiring to build/parse a real ext2 filesystem. BUG=chromium:331965 TEST=FEATURES=test emerge-link update_engine Change-Id: I1e14cf8f3883c8e9a1d471c8193c8da60776aa7c Reviewed-on: https://chromium-review.googlesource.com/275803 Reviewed-by: Don Garrett <[email protected]> Tested-by: Alex Deymo <[email protected]> Commit-Queue: Alex Deymo <[email protected]>
diff --git a/test_utils.h b/test_utils.h index dddd563..5453d27 100644 --- a/test_utils.h +++ b/test_utils.h
@@ -17,6 +17,7 @@ #include <vector> #include <base/callback.h> +#include <base/files/file_path.h> #include <glib-object.h> #include <gtest/gtest.h> @@ -209,8 +210,11 @@ // Frees a GValue object and its allocated resources. void GValueFree(gpointer arg); -} // namespace test_utils +// Returns the path where the build artifacts are stored. This is the directory +// where the unittest executable is being run from. +base::FilePath GetBuildArtifactsPath(); +} // namespace test_utils // Useful actions for test. These need to be defined in the // chromeos_update_engine namespace.