diff options
Diffstat (limited to 'compiler/oat_test.cc')
-rw-r--r-- | compiler/oat_test.cc | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index d5842a8c9d..66111f6e23 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -149,11 +149,10 @@ class OatTest : public CommonCompilerTest { 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; @@ -264,7 +263,7 @@ class OatTest : public CommonCompilerTest { 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_; @@ -568,7 +567,7 @@ static void MaybeModifyDexFileToFail(bool verify, std::unique_ptr<const DexFile> } } -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; @@ -606,11 +605,14 @@ void OatTest::TestDexFileInput(bool verify, bool low_4gb) { 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) { @@ -654,15 +656,19 @@ void OatTest::TestDexFileInput(bool verify, bool low_4gb) { } 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) { @@ -717,8 +723,8 @@ 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); |