// Load extensions and test for the presence of the test string.
ScopedObjectAccess soa(Thread::Current());
ASSERT_EQ(2u, extension_image_locations.size());
full_image_locations = {
base_image_location, extension_image_locations[0], extension_image_locations[1]}; bool success = load_boot_image();
ASSERT_TRUE(success);
ASSERT_EQ(bcp.size(), boot_image_spaces.size());
EXPECT_TRUE(contains_test_string(boot_image_spaces[boot_image_spaces.size() - 2u].get())); // The string in the second extension should be replaced and removed from interned string section.
EXPECT_FALSE(contains_test_string(boot_image_spaces[boot_image_spaces.size() - 1u].get()));
// Reload extensions in reverse order and test for the presence of the test string.
std::swap(bcp[bcp.size() - 2u], bcp[bcp.size() - 1u]);
std::swap(bcp_locations[bcp_locations.size() - 2u], bcp_locations[bcp_locations.size() - 1u]);
full_image_locations = {
base_image_location, extension_image_locations[1], extension_image_locations[0]};
success = load_boot_image();
ASSERT_TRUE(success);
ASSERT_EQ(bcp.size(), boot_image_spaces.size());
EXPECT_TRUE(contains_test_string(boot_image_spaces[boot_image_spaces.size() - 2u].get())); // The string in the second extension should be replaced and removed from interned string section.
EXPECT_FALSE(contains_test_string(boot_image_spaces[boot_image_spaces.size() - 1u].get()));
// Reload the image without the second extension.
bcp.erase(bcp.end() - 2u);
bcp_locations.erase(bcp_locations.end() - 2u);
full_image_locations = {base_image_location, extension_image_locations[0]};
success = load_boot_image();
ASSERT_TRUE(success);
ASSERT_EQ(bcp.size(), boot_image_spaces.size());
ASSERT_TRUE(contains_test_string(boot_image_spaces[boot_image_spaces.size() - 1u].get()));
// The string in the app image should be replaced and removed from interned string section.
EXPECT_FALSE(contains_test_string(app_image_space.get()));
}
// We want to test the relocation behavior of ImageSpace. As such, don't pretend we're a // compiler.
callbacks_.reset();
// Clear DEX2OATBOOTCLASSPATH environment variable used for boot image compilation. // We don't want that environment variable to affect the behavior of this test.
CHECK(old_dex2oat_bcp_ == nullptr); constchar* old_dex2oat_bcp = getenv("DEX2OATBOOTCLASSPATH"); if (old_dex2oat_bcp != nullptr) {
old_dex2oat_bcp_.reset(strdup(old_dex2oat_bcp));
CHECK(old_dex2oat_bcp_ != nullptr);
unsetenv("DEX2OATBOOTCLASSPATH");
}
}
void TearDown() override { if (old_dex2oat_bcp_ != nullptr) { int result = setenv("DEX2OATBOOTCLASSPATH", old_dex2oat_bcp_.get(), /* replace */ 0);
CHECK_EQ(result, 0);
old_dex2oat_bcp_.reset();
}
missing_image_base_.reset();
}
for (size_t i = 0; i < space_count; i++) { // This test does not support multi-image compilation.
ASSERT_NE(image_spaces[i]->GetImageHeader().GetImageReservationSize(), 0u);
TEST_F(ImageSpaceLoadingSingleComponentWithProfilesTest, Test) { // Compiling the primary boot image into a single image is not allowed on host.
TEST_DISABLED_FOR_HOST();
CheckImageSpaceAndOatFile(/*space_count=*/1);
}
class ImageSpaceLoadingMultipleComponentsWithProfilesTest
: public ImageSpaceLoadingTest</*kImage=*/false, /*kRelocate=*/true> { protected:
std::string PrepareImageLocation() override {
std::vector<std::string> dex_files(GetLibCoreDexFileNames());
CHECK_GE(dex_files.size(), 2);
std::string image_location_1 = missing_image_base_->GetFilename() + ".art";
std::string image_location_2 =
missing_image_base_->GetFilename() + "-" + Stem(dex_files[dex_files.size() - 1]) + ".art"; // Compiling the primary boot image into a single image is not allowed on host. if (kIsTargetBuild) {
profile1_ = std::make_unique<ScratchFile>();
GenerateBootProfile(ArrayRef<const std::string>(dex_files).SubArray( /*pos=*/0, /*length=*/dex_files.size() - 1),
profile1_->GetFile(), /*method_frequency=*/6, /*type_frequency=*/6);
image_location_1 += "!" + profile1_->GetFilename();
profile2_ = std::make_unique<ScratchFile>();
GenerateBootProfile(ArrayRef<const std::string>(dex_files).SubArray( /*pos=*/dex_files.size() - 1, /*length=*/1),
profile2_->GetFile(), /*method_frequency=*/8, /*type_frequency=*/8);
image_location_2 += "!" + profile2_->GetFilename();
} // "/path/to/image.art!/path/to/profile1:/path/to/image-lastdex.art!/path/to/profile2" return image_location_1 + ":" + image_location_2;
}
TEST_F(ImageSpaceLoadingMultipleComponentsWithProfilesTest, Test) { // Compiling the primary boot image into a single image is not allowed on host.
TEST_DISABLED_FOR_HOST();
CheckImageSpaceAndOatFile(/*space_count=*/1);
}
} // namespace space
} // namespace gc
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.