Loading cmds/installd/tests/installd_service_test.cpp +9 −14 Original line number Original line Diff line number Diff line Loading @@ -451,12 +451,12 @@ TEST_F(ServiceTest, SnapshotAppData_WrongVolumeUuid) { TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { auto fake_package_ce_path = create_data_user_ce_package_path("TEST", 0, "com.foo"); 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_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, auto fake_package_ce_cache_path = fake_package_ce_path + "/cache"; "cache", kXattrInodeCache); auto fake_package_ce_code_cache_path = fake_package_ce_path + "/code_cache"; auto fake_package_ce_code_cache_path = read_path_inode(fake_package_ce_path, "code_cache", kXattrInodeCache); auto fake_package_de_cache_path = fake_package_de_path + "/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 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_ce_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_path, 700)); Loading @@ -464,20 +464,15 @@ TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { ASSERT_TRUE(mkdirs(fake_package_ce_code_cache_path, 700)); 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_cache_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_code_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, auto deleter = [&fake_package_ce_path, &fake_package_de_path, &fake_package_ce_cache_path, &fake_package_ce_code_cache_path, &rollback_ce_dir, &rollback_de_dir]() { &fake_package_de_cache_path, &fake_package_de_code_cache_path]() { delete_dir_contents(fake_package_ce_path, true); delete_dir_contents(fake_package_ce_path, true); delete_dir_contents(fake_package_de_path, true); delete_dir_contents(fake_package_de_path, true); delete_dir_contents(fake_package_ce_cache_path, true); delete_dir_contents_and_dir(rollback_ce_dir, true); delete_dir_contents(fake_package_ce_code_cache_path, true); delete_dir_contents_and_dir(rollback_de_dir, 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()); }; }; auto scope_guard = android::base::make_scope_guard(deleter); auto scope_guard = android::base::make_scope_guard(deleter); Loading Loading
cmds/installd/tests/installd_service_test.cpp +9 −14 Original line number Original line Diff line number Diff line Loading @@ -451,12 +451,12 @@ TEST_F(ServiceTest, SnapshotAppData_WrongVolumeUuid) { TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { auto fake_package_ce_path = create_data_user_ce_package_path("TEST", 0, "com.foo"); 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_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, auto fake_package_ce_cache_path = fake_package_ce_path + "/cache"; "cache", kXattrInodeCache); auto fake_package_ce_code_cache_path = fake_package_ce_path + "/code_cache"; auto fake_package_ce_code_cache_path = read_path_inode(fake_package_ce_path, "code_cache", kXattrInodeCache); auto fake_package_de_cache_path = fake_package_de_path + "/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 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_ce_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_path, 700)); Loading @@ -464,20 +464,15 @@ TEST_F(ServiceTest, CreateAppDataSnapshot_ClearsCache) { ASSERT_TRUE(mkdirs(fake_package_ce_code_cache_path, 700)); 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_cache_path, 700)); ASSERT_TRUE(mkdirs(fake_package_de_code_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, auto deleter = [&fake_package_ce_path, &fake_package_de_path, &fake_package_ce_cache_path, &fake_package_ce_code_cache_path, &rollback_ce_dir, &rollback_de_dir]() { &fake_package_de_cache_path, &fake_package_de_code_cache_path]() { delete_dir_contents(fake_package_ce_path, true); delete_dir_contents(fake_package_ce_path, true); delete_dir_contents(fake_package_de_path, true); delete_dir_contents(fake_package_de_path, true); delete_dir_contents(fake_package_ce_cache_path, true); delete_dir_contents_and_dir(rollback_ce_dir, true); delete_dir_contents(fake_package_ce_code_cache_path, true); delete_dir_contents_and_dir(rollback_de_dir, 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()); }; }; auto scope_guard = android::base::make_scope_guard(deleter); auto scope_guard = android::base::make_scope_guard(deleter); Loading