diff options
author | Bryan Ferris <bferris@google.com> | 2020-02-13 00:37:34 +0100 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-02-13 00:37:34 +0100 |
commit | 7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd (patch) | |
tree | 056a7e38bdc99b99214183e2e58608612f6b2e72 /tests/unit/install_test.cpp | |
parent | Merge "rm libbinderthreadstate" am: 2015fe5dbc am: ecfa97375f (diff) | |
parent | Force package installation with FUSE unless the package stores on device (diff) | |
download | android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.tar android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.tar.gz android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.tar.bz2 android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.tar.lz android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.tar.xz android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.tar.zst android_bootable_recovery-7bc9c8297b44991a81a9c54ae19c1162ef7e5ffd.zip |
Diffstat (limited to 'tests/unit/install_test.cpp')
-rw-r--r-- | tests/unit/install_test.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/install_test.cpp b/tests/unit/install_test.cpp index 370fbdcc5..ecf1c9a61 100644 --- a/tests/unit/install_test.cpp +++ b/tests/unit/install_test.cpp @@ -34,6 +34,7 @@ #include "install/install.h" #include "install/wipe_device.h" #include "otautil/paths.h" +#include "otautil/roots.h" #include "private/setup_commands.h" static void BuildZipArchive(const std::map<std::string, std::string>& file_map, int fd, @@ -513,3 +514,30 @@ TEST(InstallTest, CheckPackageMetadata_ab_post_timestamp) { "\n"); TestCheckPackageMetadata(metadata, OtaType::AB, true); } + +TEST(InstallTest, SetupPackageMount_package_path) { + load_volume_table(); + bool install_with_fuse; + + // Setup should fail if the input path doesn't exist. + ASSERT_FALSE(SetupPackageMount("/does_not_exist", &install_with_fuse)); + + // Package should be installed with fuse if it's not in /cache. + TemporaryDir temp_dir; + TemporaryFile update_package(temp_dir.path); + ASSERT_TRUE(SetupPackageMount(update_package.path, &install_with_fuse)); + ASSERT_TRUE(install_with_fuse); + + // Setup should fail if the input path isn't canonicalized. + std::string uncanonical_package_path = android::base::Join( + std::vector<std::string>{ + temp_dir.path, + "..", + android::base::Basename(temp_dir.path), + android::base::Basename(update_package.path), + }, + '/'); + + ASSERT_EQ(0, access(uncanonical_package_path.c_str(), R_OK)); + ASSERT_FALSE(SetupPackageMount(uncanonical_package_path, &install_with_fuse)); +} |