diff options
author | Alex Deymo <deymo@chromium.org> | 2015-06-26 20:57:06 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-02 03:02:58 +0000 |
commit | 2e9533be9eb2e022d653400f47a354a7f06bf9db (patch) | |
tree | 1f70cfce9819476bb1065bda730833b89502d62d /payload_generator/ext2_filesystem_unittest.cc | |
parent | 13e0dd63e68f2003b46d413d499760b5a7631a03 (diff) |
update_engine: Expose the update_engine.conf in the FilesystemInterface.
The old image contains a /etc/update_engine.conf file that states the
payload version supported by that image. Currently we read this file
directly from the mounted filesystem and parse its contents. To stop
mounting the filesystem we need to retrieve the information on this file
somehow.
This patch extends the FilesystemInterface with a method to load the
update_engine.conf settings from the filesystem and implemets it using
ext2fs on ext2 filesystems.
CQ-DEPED=CL:282380
BUG=chromium:305832
TEST=Added new unittests with and without this file.
Change-Id: I41b41e8aac58c645fb40aabfe340cde8821e405a
Reviewed-on: https://chromium-review.googlesource.com/282381
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'payload_generator/ext2_filesystem_unittest.cc')
-rw-r--r-- | payload_generator/ext2_filesystem_unittest.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/payload_generator/ext2_filesystem_unittest.cc b/payload_generator/ext2_filesystem_unittest.cc index 122ba02c..d2ea2b30 100644 --- a/payload_generator/ext2_filesystem_unittest.cc +++ b/payload_generator/ext2_filesystem_unittest.cc @@ -177,4 +177,26 @@ TEST_F(Ext2FilesystemTest, ParseGeneratedImages) { } } +TEST_F(Ext2FilesystemTest, LoadSettingsFailsTest) { + base::FilePath path = test_utils::GetBuildArtifactsPath().Append( + "gen/disk_ext2_1k.img"); + unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(path.value()); + + chromeos::KeyValueStore store; + // disk_ext2_1k.img doesn't have the /etc/update_engine.conf file. + EXPECT_FALSE(fs->LoadSettings(&store)); +} + +TEST_F(Ext2FilesystemTest, LoadSettingsWorksTest) { + base::FilePath path = test_utils::GetBuildArtifactsPath().Append( + "gen/disk_ext2_ue_settings.img"); + unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(path.value()); + + chromeos::KeyValueStore store; + EXPECT_TRUE(fs->LoadSettings(&store)); + string minor_version; + EXPECT_TRUE(store.GetString("PAYLOAD_MINOR_VERSION", &minor_version)); + EXPECT_EQ("1234", minor_version); +} + } // namespace chromeos_update_engine |