File* oat_file,
const std::vector<const char*>& dex_filenames,
SafeMap<std::string, std::string>& key_value_store,
- bool verify) {
+ bool verify,
+ ProfileCompilationInfo* profile_compilation_info) {
TimingLogger timings("WriteElf", false, false);
- OatWriter oat_writer(/*compiling_boot_image*/false,
- &timings,
- /*profile_compilation_info*/nullptr);
+ OatWriter oat_writer(/*compiling_boot_image*/false, &timings, profile_compilation_info);
for (const char* dex_filename : dex_filenames) {
if (!oat_writer.AddDexFileSource(dex_filename, dex_filename)) {
return false;
return true;
}
- void TestDexFileInput(bool verify, bool low_4gb);
+ void TestDexFileInput(bool verify, bool low_4gb, bool use_profile);
void TestZipFileInput(bool verify);
std::unique_ptr<const InstructionSetFeatures> insn_features_;
}
}
-void OatTest::TestDexFileInput(bool verify, bool low_4gb) {
+void OatTest::TestDexFileInput(bool verify, bool low_4gb, bool use_profile) {
TimingLogger timings("OatTest::DexFileInput", false, false);
std::vector<const char*> input_filenames;
ScratchFile oat_file, vdex_file(oat_file, ".vdex");
SafeMap<std::string, std::string> key_value_store;
key_value_store.Put(OatHeader::kImageLocationKey, "test.art");
+ std::unique_ptr<ProfileCompilationInfo>
+ profile_compilation_info(use_profile ? new ProfileCompilationInfo() : nullptr);
success = WriteElf(vdex_file.GetFile(),
oat_file.GetFile(),
input_filenames,
key_value_store,
- verify);
+ verify,
+ profile_compilation_info.get());
// In verify mode, we expect failure.
if (verify) {
}
TEST_F(OatTest, DexFileInputCheckOutput) {
- TestDexFileInput(false, /*low_4gb*/false);
+ TestDexFileInput(/*verify*/false, /*low_4gb*/false, /*use_profile*/false);
}
TEST_F(OatTest, DexFileInputCheckOutputLow4GB) {
- TestDexFileInput(false, /*low_4gb*/true);
+ TestDexFileInput(/*verify*/false, /*low_4gb*/true, /*use_profile*/false);
}
TEST_F(OatTest, DexFileInputCheckVerifier) {
- TestDexFileInput(true, /*low_4gb*/false);
+ TestDexFileInput(/*verify*/true, /*low_4gb*/false, /*use_profile*/false);
+}
+
+TEST_F(OatTest, DexFileFailsVerifierWithLayout) {
+ TestDexFileInput(/*verify*/true, /*low_4gb*/false, /*use_profile*/true);
}
void OatTest::TestZipFileInput(bool verify) {
std::vector<const char*> input_filenames { zip_file.GetFilename().c_str() }; // NOLINT [readability/braces] [4]
ScratchFile oat_file, vdex_file(oat_file, ".vdex");
- success = WriteElf(vdex_file.GetFile(), oat_file.GetFile(),
- input_filenames, key_value_store, verify);
+ success = WriteElf(vdex_file.GetFile(), oat_file.GetFile(), input_filenames,
+ key_value_store, verify, /*profile_compilation_info*/nullptr);
if (verify) {
ASSERT_FALSE(success);