diff options
| -rw-r--r-- | cmds/installd/tests/installd_service_test.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/cmds/installd/tests/installd_service_test.cpp b/cmds/installd/tests/installd_service_test.cpp index cf7f1ebca4..73277100d1 100644 --- a/cmds/installd/tests/installd_service_test.cpp +++ b/cmds/installd/tests/installd_service_test.cpp @@ -451,12 +451,12 @@ TEST_F(ServiceTest, SnapshotAppData_WrongVolumeUuid) { TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { auto fake_package_ce_path = create_data_user_ce_package_path("TEST", 0, "com.foo"); auto fake_package_de_path = create_data_user_de_package_path("TEST", 0, "com.foo"); - auto fake_package_ce_cache_path = read_path_inode(fake_package_ce_path, - "cache", kXattrInodeCache); - auto fake_package_ce_code_cache_path = read_path_inode(fake_package_ce_path, - "code_cache", kXattrInodeCache); + auto fake_package_ce_cache_path = fake_package_ce_path + "/cache"; + auto fake_package_ce_code_cache_path = fake_package_ce_path + "/code_cache"; auto fake_package_de_cache_path = fake_package_de_path + "/cache"; auto fake_package_de_code_cache_path = fake_package_de_path + "/code_cache"; + auto rollback_ce_dir = create_data_misc_ce_rollback_path("TEST", 0); + auto rollback_de_dir = create_data_misc_de_rollback_path("TEST", 0); ASSERT_TRUE(mkdirs(fake_package_ce_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_path, 700)); @@ -464,20 +464,15 @@ TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { ASSERT_TRUE(mkdirs(fake_package_ce_code_cache_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_cache_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_code_cache_path, 700)); + ASSERT_TRUE(mkdirs(rollback_ce_dir, 700)); + ASSERT_TRUE(mkdirs(rollback_de_dir, 700)); auto deleter = [&fake_package_ce_path, &fake_package_de_path, - &fake_package_ce_cache_path, &fake_package_ce_code_cache_path, - &fake_package_de_cache_path, &fake_package_de_code_cache_path]() { + &rollback_ce_dir, &rollback_de_dir]() { delete_dir_contents(fake_package_ce_path, true); delete_dir_contents(fake_package_de_path, true); - delete_dir_contents(fake_package_ce_cache_path, true); - delete_dir_contents(fake_package_ce_code_cache_path, true); - delete_dir_contents(fake_package_de_cache_path, true); - delete_dir_contents(fake_package_de_code_cache_path, true); - rmdir(fake_package_ce_cache_path.c_str()); - rmdir(fake_package_ce_code_cache_path.c_str()); - rmdir(fake_package_de_cache_path.c_str()); - rmdir(fake_package_de_code_cache_path.c_str()); + delete_dir_contents_and_dir(rollback_ce_dir, true); + delete_dir_contents_and_dir(rollback_de_dir, true); }; auto scope_guard = android::base::make_scope_guard(deleter); |