Lines Matching refs:std

73   int GenerateOdexForTestWithStatus(const std::vector<std::string>& dex_locations,  in GenerateOdexForTestWithStatus()
74 const std::string& odex_location, in GenerateOdexForTestWithStatus()
76 std::string* error_msg, in GenerateOdexForTestWithStatus()
77 const std::vector<std::string>& extra_args = {}, in GenerateOdexForTestWithStatus()
79 std::unique_ptr<File> oat_file;
80 std::vector<std::string> args;
82 for (const std::string& dex_location : dex_locations) {
88 args.push_back("--oat-fd=" + std::to_string(oat_file->Fd()));
111 const std::string& dex_location, in GenerateOdexForTest()
112 const std::string& odex_location, in GenerateOdexForTest()
114 const std::vector<std::string>& extra_args = {}, in GenerateOdexForTest()
132 const std::string& dex_location, in GenerateOdexForTest()
133 const std::string& odex_location, in GenerateOdexForTest()
135 const std::vector<std::string>& extra_args, in GenerateOdexForTest()
140 std::vector<std::string> dex_locations; in GenerateOdexForTest()
142 std::string loc_arg = "--zip-location=" + dex_location; in GenerateOdexForTest()
143 CHECK(std::any_of(extra_args.begin(), in GenerateOdexForTest()
145 [&](const std::string& s) { return s == loc_arg; })); in GenerateOdexForTest()
146 CHECK(std::any_of(extra_args.begin(), in GenerateOdexForTest()
148 [](const std::string& s) { return StartsWith(s, "--zip-fd="); })); in GenerateOdexForTest()
152 std::string error_msg; in GenerateOdexForTest()
163 << "Failed to compile odex: " << error_msg << std::endl << output_; in GenerateOdexForTest()
167 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in GenerateOdexForTest()
189 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in GenerateOdexForTest()
210 int Dex2Oat(const std::vector<std::string>& dex2oat_args, std::string* error_msg) { in Dex2Oat()
211 std::vector<std::string> argv; in Dex2Oat()
238 argv.push_back("--android-root=" + std::string(android_root)); in Dex2Oat()
241 std::string all_args; in Dex2Oat()
242 for (const std::string& arg : argv) { in Dex2Oat()
259 std::string output_ = "";
260 std::string error_msg_ = "";
266 void RunTest(bool use_fd, bool expect_use, const std::vector<std::string>& extra_args = {}) { in RunTest()
267 std::string dex_location = GetScratchDir() + "/Dex2OatSwapTest.jar";
268 std::string odex_location = GetOdexDir() + "/Dex2OatSwapTest.odex";
272 std::vector<std::string> copy(extra_args);
274 std::unique_ptr<ScratchFile> sf;
279 std::string swap_location = GetOdexDir() + "/Dex2OatSwapTest.odex.swap";
289 virtual std::string GetTestDexFileName() { in GetTestDexFileName()
310 EXPECT_NE(output_.find("Large app, accepted running with swap."), std::string::npos) in CheckHostResult()
313 EXPECT_EQ(output_.find("Large app, accepted running with swap."), std::string::npos) in CheckHostResult()
336 EXPECT_NE(output_.find("dex2oat took"), std::string::npos) << output_; in CheckHostValidity()
369 EXPECT_NE(output_.find("Large app, accepted running with swap."), std::string::npos) in CheckHostResult()
372 EXPECT_EQ(output_.find("Large app, accepted running with swap."), std::string::npos) in CheckHostResult()
378 std::string GetTestDexFileName() override { in GetTestDexFileName()
388 native_alloc_1_ = std::numeric_limits<size_t>::max(); in GrabResult1()
399 swap_2_ = std::numeric_limits<size_t>::max(); in GrabResult2()
405 std::regex native_alloc_regex("dex2oat took.*native alloc=[^ ]+ \\(([0-9]+)B\\)"); in ParseNativeAlloc()
406 std::smatch native_alloc_match; in ParseNativeAlloc()
407 bool found = std::regex_search(output_, native_alloc_match, native_alloc_regex); in ParseNativeAlloc()
417 std::istringstream stream(native_alloc_match[1].str()); in ParseNativeAlloc()
425 std::regex swap_regex("dex2oat took[^\\n]+swap=[^ ]+ \\(([0-9]+)B\\)"); in ParseSwap()
426 std::smatch swap_match; in ParseSwap()
427 bool found = std::regex_search(output_, swap_match, swap_regex); in ParseSwap()
442 std::istringstream stream(swap_match[1].str()); in ParseSwap()
470 std::string output_1 = output_; in TEST_F()
478 std::string output_2 = output_; in TEST_F()
499 const std::vector<std::string>& extra_args = {}) { in RunTest()
500 std::string dex_location = GetScratchDir() + "/DexNoOat.jar";
501 std::string odex_location = GetOdexDir() + "/DexOdexNoOat.odex";
502 std::string app_image_file = GetScratchDir() + "/Test.art";
506 std::vector<std::string> new_args(extra_args);
520 void CheckResult(const std::string& dex_location, in CheckResult()
521 const std::string& odex_location, in CheckResult()
522 const std::string& app_image_file, in CheckResult()
530 std::string error_msg; in CheckResult()
531 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in CheckResult()
540 std::unique_ptr<File> file(OS::OpenFileForReading(app_image_file.c_str())); in CheckResult()
549 std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(&error_msg); in CheckResult()
552 ASSERT_LT(class_def_count, std::numeric_limits<uint16_t>::max()); in CheckResult()
589 EXPECT_NE(output_.find("Very large app, downgrading to"), std::string::npos) << output_; in CheckHostResult()
591 EXPECT_EQ(output_.find("Very large app, downgrading to"), std::string::npos) << output_; in CheckHostResult()
611 EXPECT_NE(output_.find("dex2oat took"), std::string::npos) << output_; in CheckHostValidity()
649 void GenerateProfile(const std::string& test_profile, in GenerateProfile()
658 std::vector<dex::TypeIndex> classes;; in GenerateProfile()
668 void CompileProfileOdex(const std::string& dex_location, in CompileProfileOdex()
669 const std::string& odex_location, in CompileProfileOdex()
670 const std::string& app_image_file_name, in CompileProfileOdex()
673 const std::vector<std::string>& extra_args = {}, in CompileProfileOdex()
675 const std::string profile_location = GetScratchDir() + "/primary.prof";
677 std::string error_msg;
678 std::vector<std::unique_ptr<const DexFile>> dex_files;
683 std::unique_ptr<const DexFile>& dex_file = dex_files[0];
685 std::vector<std::string> copy(extra_args);
687 std::unique_ptr<File> app_image_file;
691 copy.push_back("--app-image-fd=" + std::to_string(app_image_file->Fd()));
707 uint64_t GetImageObjectSectionSize(const std::string& image_file_name) { in GetImageObjectSectionSize()
709 std::unique_ptr<File> file(OS::OpenFileForReading(image_file_name.c_str())); in GetImageObjectSectionSize()
720 std::string dex_location = GetScratchDir() + "/DexNoOat.jar"; in RunTest()
721 std::string odex_location = GetOdexDir() + "/DexOdexNoOat.odex"; in RunTest()
722 std::string app_image_file = app_image ? (GetOdexDir() + "/DexOdexNoOat.art"): ""; in RunTest()
757 std::string dex_location = GetScratchDir() + "/DexNoOat.jar"; in RunTestVDex()
758 std::string odex_location = GetOdexDir() + "/DexOdexNoOat.odex"; in RunTestVDex()
759 std::string vdex_location = GetOdexDir() + "/DexOdexNoOat.vdex"; in RunTestVDex()
760 std::string app_image_file_name = GetOdexDir() + "/DexOdexNoOat.art"; in RunTestVDex()
763 std::unique_ptr<File> vdex_file1(OS::CreateEmptyFile(vdex_location.c_str())); in RunTestVDex()
767 std::string input_vdex = "--input-vdex-fd=-1"; in RunTestVDex()
768 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_file1->Fd()); in RunTestVDex()
779 std::string input_vdex = StringPrintf("--input-vdex-fd=%d", vdex_file1->Fd()); in RunTestVDex()
780 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_file2.GetFd()); in RunTestVDex()
795 void CheckResult(const std::string& dex_location, in CheckResult()
796 const std::string& odex_location, in CheckResult()
797 const std::string& app_image_file_name) { in CheckResult()
799 std::string error_msg; in CheckResult()
800 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in CheckResult()
810 std::vector<std::unique_ptr<const DexFile>> dex_files; in CheckResult()
815 std::unique_ptr<const DexFile>& old_dex_file = dex_files[0]; in CheckResult()
818 std::unique_ptr<const DexFile> new_dex_file = oat_dex_file->OpenDexFile(&error_msg); in CheckResult()
821 ASSERT_LT(class_def_count, std::numeric_limits<uint16_t>::max()); in CheckResult()
825 std::string old_class0 = old_dex_file->PrettyType(old_dex_file->GetClassDef(0).class_idx_); in CheckResult()
826 std::string old_class1 = old_dex_file->PrettyType(old_dex_file->GetClassDef(1).class_idx_); in CheckResult()
827 std::string new_class0 = new_dex_file->PrettyType(new_dex_file->GetClassDef(0).class_idx_); in CheckResult()
828 std::string new_class1 = new_dex_file->PrettyType(new_dex_file->GetClassDef(1).class_idx_); in CheckResult()
837 std::unique_ptr<File> file(OS::OpenFileForReading(app_image_file_name.c_str())); in CheckResult()
861 EXPECT_NE(output_.find("dex2oat took"), std::string::npos) << output_; in CheckHostValidity()
880 std::string dex_location = GetScratchDir() + "/UnquickenMultiDex.jar"; in RunUnquickenMultiDex()
881 std::string odex_location = GetOdexDir() + "/UnquickenMultiDex.odex"; in RunUnquickenMultiDex()
882 std::string vdex_location = GetOdexDir() + "/UnquickenMultiDex.vdex"; in RunUnquickenMultiDex()
885 std::unique_ptr<File> vdex_file1(OS::CreateEmptyFile(vdex_location.c_str())); in RunUnquickenMultiDex()
889 std::string input_vdex = "--input-vdex-fd=-1"; in RunUnquickenMultiDex()
890 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_file1->Fd()); in RunUnquickenMultiDex()
900 std::vector<uint32_t> checksums1; in RunUnquickenMultiDex()
904 std::string input_vdex = StringPrintf("--input-vdex-fd=%d", vdex_file1->Fd()); in RunUnquickenMultiDex()
905 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_file1->Fd()); in RunUnquickenMultiDex()
916 std::vector<uint32_t> checksums2; in RunUnquickenMultiDex()
926 std::string dex_location = GetScratchDir() + "/UnquickenMultiDex.jar"; in RunUnquickenMultiDexCDex()
927 std::string odex_location = GetOdexDir() + "/UnquickenMultiDex.odex"; in RunUnquickenMultiDexCDex()
928 std::string odex_location2 = GetOdexDir() + "/UnquickenMultiDex2.odex"; in RunUnquickenMultiDexCDex()
929 std::string vdex_location = GetOdexDir() + "/UnquickenMultiDex.vdex"; in RunUnquickenMultiDexCDex()
930 std::string vdex_location2 = GetOdexDir() + "/UnquickenMultiDex2.vdex"; in RunUnquickenMultiDexCDex()
933 std::unique_ptr<File> vdex_file1(OS::CreateEmptyFile(vdex_location.c_str())); in RunUnquickenMultiDexCDex()
934 std::unique_ptr<File> vdex_file2(OS::CreateEmptyFile(vdex_location2.c_str())); in RunUnquickenMultiDexCDex()
940 std::string input_vdex = "--input-vdex-fd=-1"; in RunUnquickenMultiDexCDex()
941 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_file1->Fd()); in RunUnquickenMultiDexCDex()
952 std::string input_vdex = StringPrintf("--input-vdex-fd=%d", vdex_file1->Fd()); in RunUnquickenMultiDexCDex()
953 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_file2->Fd()); in RunUnquickenMultiDexCDex()
967 void CheckResult(const std::string& dex_location, const std::string& odex_location) { in CheckResult()
968 std::string error_msg; in CheckResult()
969 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in CheckResult()
981 std::unique_ptr<const DexFile> dex_file = oat_dex_file->OpenDexFile(&error_msg); in CheckResult()
992 void GetDexFileChecksums(const std::string& dex_location, in GetDexFileChecksums()
993 const std::string& odex_location, in GetDexFileChecksums()
994 /*out*/std::vector<uint32_t>* checksums) { in GetDexFileChecksums()
995 std::string error_msg; in GetDexFileChecksums()
996 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in GetDexFileChecksums()
1021 void RunTest(bool expect_success, const std::vector<std::string>& extra_args = {}) { in RunTest()
1022 std::string dex_location = GetScratchDir() + "/Dex2OatSwapTest.jar";
1023 std::string odex_location = GetOdexDir() + "/Dex2OatSwapTest.odex";
1027 std::vector<std::string> copy(extra_args);
1029 std::string swap_location = GetOdexDir() + "/Dex2OatSwapTest.odex.swap";
1039 std::string GetTestDexFileName() { in GetTestDexFileName()
1068 int RunTest(const std::vector<std::string>& extra_args = {}) { in RunTest()
1069 std::string dex_location = GetScratchDir() + "/Dex2OatSwapTest.jar";
1070 std::string odex_location = GetOdexDir() + "/Dex2OatSwapTest.odex";
1074 std::string error_msg;
1082 std::string GetTestDexFileName() { in GetTestDexFileName()
1094 std::string dex_location = GetUsedDexLocation(); in RunTest()
1095 std::string odex_location = GetUsedOatLocation(); in RunTest()
1099 std::string error_msg; in RunTest()
1100 std::vector<std::string> extra_args; in RunTest()
1102 extra_args.push_back(std::string("--class-loader-context=") + class_loader_context); in RunTest()
1105 extra_args.push_back(std::string("--app-image-file=") + GetUsedImageLocation()); in RunTest()
1124 std::string GetUsedDexLocation() { in GetUsedDexLocation()
1128 std::string GetUsedOatLocation() { in GetUsedOatLocation()
1132 std::string GetUsedImageLocation() { in GetUsedImageLocation()
1154 std::string context = "PCL[" + GetUsedDexLocation() + "]"; in TEST_F()
1159 std::vector<std::unique_ptr<const DexFile>> dex_files = OpenTestDexFiles("Nested"); in TEST_F()
1161 std::string context = "PCL[" + dex_files[0]->GetLocation() + "]"; in TEST_F()
1162 std::string expected_classpath_key = "PCL[" + in TEST_F()
1163 dex_files[0]->GetLocation() + "*" + std::to_string(dex_files[0]->GetLocationChecksum()) + "]"; in TEST_F()
1168 std::string stripped_classpath = GetScratchDir() + "/stripped_classpath.jar"; in TEST_F()
1171 std::string context = "PCL[" + stripped_classpath + "]"; in TEST_F()
1177 std::string stripped_classpath = GetScratchDir() + "/stripped_classpath.jar"; in TEST_F()
1178 std::string odex_for_classpath = GetOdexDir() + "/stripped_classpath.odex"; in TEST_F()
1191 std::string context = "PCL[" + stripped_classpath + "]"; in TEST_F()
1192 std::string expected_classpath_key; in TEST_F()
1196 std::unique_ptr<OatFile> oat_file(oat_file_assistant.GetBestOatFile()); in TEST_F()
1197 std::vector<std::unique_ptr<const DexFile>> oat_dex_files = in TEST_F()
1205 std::to_string(oat_dex_files[i]->GetLocationChecksum()); in TEST_F()
1217 std::string context = "PCL[does_not_exists.dex]"; in TEST_F()
1223 std::vector<std::unique_ptr<const DexFile>> dex_files1 = OpenTestDexFiles("Nested"); in TEST_F()
1224 std::vector<std::unique_ptr<const DexFile>> dex_files2 = OpenTestDexFiles("MultiDex"); in TEST_F()
1226 std::string context = "PCL[" + GetTestDexFileName("Nested") + "];" + in TEST_F()
1228 std::string expected_classpath_key = "PCL[" + CreateClassPathWithChecksums(dex_files1) + "];" + in TEST_F()
1235 std::vector<std::unique_ptr<const DexFile>> dex_files1 = OpenTestDexFiles("Nested"); in TEST_F()
1236 std::vector<std::unique_ptr<const DexFile>> dex_files2 = OpenTestDexFiles("MultiDex"); in TEST_F()
1238 std::string context = "PCL[" + GetTestDexFileName("Nested") + "]" + in TEST_F()
1240 std::string expected_classpath_key = "PCL[" + CreateClassPathWithChecksums(dex_files1) + "]" + in TEST_F()
1246 std::vector<std::unique_ptr<const DexFile>> dex_files1 = OpenTestDexFiles("Nested"); in TEST_F()
1247 std::vector<std::unique_ptr<const DexFile>> dex_files2 = OpenTestDexFiles("MultiDex"); in TEST_F()
1249 std::string context = "PCL[" + GetTestDexFileName("Nested") + "]" + in TEST_F()
1251 std::string expected_classpath_key = "PCL[" + CreateClassPathWithChecksums(dex_files1) + "]" + in TEST_F()
1261 std::vector<std::unique_ptr<const DexFile>> dex_files1 = OpenTestDexFiles("Nested"); in TEST_F()
1262 std::vector<std::unique_ptr<const DexFile>> dex_files2 = OpenTestDexFiles("MultiDex"); in TEST_F()
1264 std::string context = "PCL[" + GetTestDexFileName("Nested") + "]" + in TEST_F()
1267 std::string expected_classpath_key = "PCL[" + CreateClassPathWithChecksums(dex_files1) + "]" + in TEST_F()
1278 std::vector<std::unique_ptr<const DexFile>> dex_files1 = OpenTestDexFiles("Nested"); in TEST_F()
1279 std::vector<std::unique_ptr<const DexFile>> dex_files2 = OpenTestDexFiles("MultiDex"); in TEST_F()
1281 std::string context = "PCL[" + GetTestDexFileName("Nested") + "]" + in TEST_F()
1284 std::string expected_classpath_key = "PCL[" + CreateClassPathWithChecksums(dex_files1) + "]" + in TEST_F()
1298 std::string out_dir = GetScratchDir(); in TEST_F()
1299 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1300 const std::string base_vdex_name = out_dir + "/base.vdex"; in TEST_F()
1301 const std::string unload_oat_name = out_dir + "/unload.oat"; in TEST_F()
1302 const std::string unload_vdex_name = out_dir + "/unload.vdex"; in TEST_F()
1303 const std::string no_unload_oat_name = out_dir + "/nounload.oat"; in TEST_F()
1304 const std::string no_unload_vdex_name = out_dir + "/nounload.vdex"; in TEST_F()
1305 std::string error_msg; in TEST_F()
1306 const std::vector<gc::space::ImageSpace*>& spaces = runtime->GetHeap()->GetBootImageSpaces(); in TEST_F()
1308 const std::string image_location = spaces[0]->GetImageLocation(); in TEST_F()
1319 std::unique_ptr<File> unload_oat(OS::OpenFileForReading(unload_oat_name.c_str())); in TEST_F()
1320 std::unique_ptr<File> unload_vdex(OS::OpenFileForReading(unload_vdex_name.c_str())); in TEST_F()
1336 std::unique_ptr<File> no_unload_oat(OS::OpenFileForReading(no_unload_oat_name.c_str())); in TEST_F()
1337 std::unique_ptr<File> no_unload_vdex(OS::OpenFileForReading(no_unload_vdex_name.c_str())); in TEST_F()
1355 std::unique_ptr<const DexFile> dex(OpenTestDexFile("ManyMethods")); in TEST_F()
1359 std::vector<uint16_t> methods; in TEST_F()
1364 std::set<size_t> code_item_offsets; in TEST_F()
1375 std::vector<uint16_t> hot_methods = {methods[1], methods[3], methods[5]}; in TEST_F()
1376 std::vector<uint16_t> startup_methods = {methods[1], methods[2], methods[7]}; in TEST_F()
1377 std::vector<uint16_t> post_methods = {methods[0], methods[2], methods[6]}; in TEST_F()
1408 const std::string dir = GetScratchDir(); in TEST_F()
1409 const std::string oat_filename = dir + "/base.oat"; in TEST_F()
1410 const std::string vdex_filename = dir + "/base.vdex"; in TEST_F()
1411 std::string error_msg; in TEST_F()
1421 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
1429 std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles(); in TEST_F()
1458 std::unique_ptr<const DexFile> dex_file(oat_dex->OpenDexFile(&error_msg)); in TEST_F()
1516 const std::string dir = GetScratchDir(); in TEST_F()
1517 const std::string oat_filename = dir + "/base.oat"; in TEST_F()
1518 const std::string vdex_filename = dir + "/base.vdex"; in TEST_F()
1519 const std::string dex_location = GetTestDexFileName("MultiDex"); in TEST_F()
1520 std::string error_msg; in TEST_F()
1529 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
1537 std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles(); in TEST_F()
1540 std::vector<std::unique_ptr<const CompactDexFile>> compact_dex_files; in TEST_F()
1542 std::unique_ptr<const DexFile> dex_file(oat_dex->OpenDexFile(&error_msg)); in TEST_F()
1546 std::unique_ptr<const CompactDexFile>(dex_file.release()->AsCompactDexFile())); in TEST_F()
1548 for (const std::unique_ptr<const CompactDexFile>& dex_file : compact_dex_files) { in TEST_F()
1563 for (const std::unique_ptr<const CompactDexFile>& other_dex : compact_dex_files) { in TEST_F()
1577 std::unique_ptr<const DexFile> dex(OpenTestDexFile("VerifierDeps")); in TEST_F()
1578 std::string out_dir = GetScratchDir(); in TEST_F()
1579 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1580 std::string error_msg; in TEST_F()
1600 std::unique_ptr<const DexFile> dex(OpenTestDexFile("VerifierDepsMulti")); in TEST_F()
1601 std::string out_dir = GetScratchDir(); in TEST_F()
1602 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1603 std::string error_msg; in TEST_F()
1625 std::unique_ptr<const DexFile> dex(OpenTestDexFile("MyClassNatives")); in TEST_F()
1626 std::string out_dir = GetScratchDir(); in TEST_F()
1627 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1656 std::unique_ptr<const DexFile> dex(OpenTestDexFile("MainUncompressedAligned")); in TEST_F()
1657 std::string out_dir = GetScratchDir(); in TEST_F()
1658 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1672 std::string out_dir = GetScratchDir(); in TEST_F()
1673 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1674 std::string error_msg; in TEST_F()
1688 std::string out_dir = GetScratchDir(); in TEST_F()
1689 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
1690 std::string error_msg; in TEST_F()
1767 std::unique_ptr<uint8_t[]> bytes(DecodeBase64(base64, &length)); in WriteBase64ToFile()
1777 std::string out_dir = GetScratchDir(); in TEST_F()
1778 const std::string oat_filename = out_dir + "/base.oat"; in TEST_F()
1791 std::string error_msg; in TEST_F()
1792 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
1800 std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles(); in TEST_F()
1804 std::unique_ptr<const DexFile> dex_file(oat_dex->OpenDexFile(&error_msg)); in TEST_F()
1819 std::unique_ptr<uint8_t[]> bytes(DecodeBase64(kDuplicateMethodInputDex, &length)); in TEST_F()
1823 std::unique_ptr<const DexFile> dex(OpenTestDexFile("ManyMethods")); in TEST_F()
1829 const std::string& dex_location = apk_file.GetFilename(); in TEST_F()
1830 const std::string odex_location = GetOdexDir() + "/output.odex"; in TEST_F()
1839 std::string dex_location = GetScratchDir() + "/Dex2OatStderrLoggerTest.jar"; in TEST_F()
1840 std::string odex_location = GetOdexDir() + "/Dex2OatStderrLoggerTest.odex"; in TEST_F()
1852 EXPECT_NE(std::string::npos, output_.find("dex2oat took")); in TEST_F()
1856 std::string dex_location = GetScratchDir() + "/Dex2OatCompilationReason.jar"; in TEST_F()
1857 std::string odex_location = GetOdexDir() + "/Dex2OatCompilationReason.odex"; in TEST_F()
1867 std::string error_msg; in TEST_F()
1868 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
1880 std::string dex_location = GetScratchDir() + "/Dex2OatNoCompilationReason.jar"; in TEST_F()
1881 std::string odex_location = GetOdexDir() + "/Dex2OatNoCompilationReason.odex"; in TEST_F()
1891 std::string error_msg; in TEST_F()
1892 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
1904 std::unique_ptr<const DexFile> dex(OpenTestDexFile("ManyMethods")); in TEST_F()
1905 std::string error_msg; in TEST_F()
1906 const std::string out_dir = GetScratchDir(); in TEST_F()
1907 const std::string dex_location = dex->GetLocation(); in TEST_F()
1908 const std::string odex_location = out_dir + "/base.oat"; in TEST_F()
1909 const std::string vdex_location = out_dir + "/base.vdex"; in TEST_F()
1920 std::unique_ptr<VdexFile> vdex(VdexFile::Open(vdex_location.c_str(), in TEST_F()
1928 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
1936 std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles(); in TEST_F()
1940 std::unique_ptr<const DexFile> dex_file(oat_dex->OpenDexFile(&error_msg)); in TEST_F()
1947 std::unique_ptr<File> vdex_file(OS::OpenFileForReading(vdex_location.c_str())); in TEST_F()
1953 std::unique_ptr<uint8_t[]> bytes(new uint8_t[file->GetLength()]); in TEST_F()
1983 std::istringstream iss(output_); in TEST_F()
1984 std::string line; in TEST_F()
1986 const std::string kFastVerifyString = "Fast Verify"; in TEST_F()
1987 while (std::getline(iss, line) && !found_fast_verify) { in TEST_F()
1988 found_fast_verify = found_fast_verify || line.find(kFastVerifyString) != std::string::npos; in TEST_F()
2001 std::string error_msg; in TEST_F()
2021 const std::string& dex_location = temp_dex.GetFilename(); in TEST_F()
2022 std::string odex_location = GetOdexDir() + "/quickened.odex"; in TEST_F()
2023 std::string vdex_location = GetOdexDir() + "/quickened.vdex"; in TEST_F()
2024 std::unique_ptr<File> vdex_output(OS::CreateEmptyFile(vdex_location.c_str())); in TEST_F()
2027 std::string input_vdex = "--input-vdex-fd=-1"; in TEST_F()
2028 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_output->Fd()); in TEST_F()
2039 std::string odex_location2 = GetOdexDir() + "/unquickened.odex"; in TEST_F()
2040 std::string vdex_location2 = GetOdexDir() + "/unquickened.vdex"; in TEST_F()
2041 std::unique_ptr<File> vdex_unquickened(OS::CreateEmptyFile(vdex_location2.c_str())); in TEST_F()
2043 std::string input_vdex = StringPrintf("--input-vdex-fd=%d", vdex_output->Fd()); in TEST_F()
2044 std::string output_vdex = StringPrintf("--output-vdex-fd=%d", vdex_unquickened->Fd()); in TEST_F()
2058 std::unique_ptr<VdexFile> vdex(VdexFile::Open(vdex_location2.c_str(), in TEST_F()
2063 std::vector<std::unique_ptr<const DexFile>> dex_files; in TEST_F()
2097 const std::string& dex_location = invalid_dex.GetFilename(); in TEST_F()
2098 const std::string odex_location = GetOdexDir() + "/output.odex"; in TEST_F()
2099 std::string error_msg; in TEST_F()
2136 std::string error_msg; in TEST_F()
2158 const std::string out_dir = GetScratchDir(); in TEST_F()
2159 const std::string odex_location = out_dir + "/base.odex"; in TEST_F()
2163 { "--app-image-fd=" + std::to_string(app_image_file.GetFd()) }, in TEST_F()
2169 std::string error_msg; in TEST_F()
2170 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
2188 std::string zip_location = GetTestDexFileName("MainUncompressedAligned"); in TEST_F()
2189 std::unique_ptr<File> dex_file(OS::OpenFileForReading(zip_location.c_str())); in TEST_F()
2190 std::vector<std::string> extra_args{ in TEST_F()
2194 std::string out_dir = GetScratchDir(); in TEST_F()
2195 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
2209 const std::string& dex_location = temp_dex.GetFilename(); in TEST_F()
2210 std::vector<uint16_t> methods; in TEST_F()
2211 std::vector<dex::TypeIndex> classes; in TEST_F()
2244 std::unique_ptr<const DexFile> dex_file(OpenDexFile(temp_dex.GetFilename().c_str())); in TEST_F()
2245 const std::string out_dir = GetScratchDir(); in TEST_F()
2246 const std::string odex_location = out_dir + "/base.odex"; in TEST_F()
2247 const std::string app_image_location = out_dir + "/base.art"; in TEST_F()
2259 std::string error_msg; in TEST_F()
2260 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
2270 std::string error_msg; in TEST_F()
2271 std::string zip_location = GetTestDexFileName("Main"); in TEST_F()
2272 std::unique_ptr<File> zip_file(OS::OpenFileForReading(zip_location.c_str())); in TEST_F()
2275 std::unique_ptr<ZipArchive> zip_archive( in TEST_F()
2279 std::string entry_name = DexFileLoader::GetMultiDexClassesDexName(0); in TEST_F()
2280 std::unique_ptr<ZipEntry> entry(zip_archive->Find(entry_name.c_str(), &error_msg)); in TEST_F()
2284 const std::string& dex_location = dex_file.GetFilename(); in TEST_F()
2285 const std::string base_oat_name = GetScratchDir() + "/base.oat"; in TEST_F()
2291 std::vector<std::string> extra_args{ in TEST_F()
2309 const std::string& dex_location = temp_dex.GetFilename(); in TEST_F()
2310 std::vector<uint16_t> methods; in TEST_F()
2311 std::vector<dex::TypeIndex> classes; in TEST_F()
2317 if (accessor.GetDescriptor() == std::string("LStringLiterals$StartupClass;")) { in TEST_F()
2321 std::string method_name(dex->GetMethodName(dex->GetMethodId(method.GetIndex()))); in TEST_F()
2354 std::unique_ptr<const DexFile> dex_file(OpenDexFile(temp_dex.GetFilename().c_str())); in TEST_F()
2365 const std::string out_dir = GetScratchDir(); in TEST_F()
2366 const std::string odex_location = out_dir + "/base.odex"; in TEST_F()
2367 const std::string app_image_location = out_dir + "/base.art"; in TEST_F()
2379 std::string error_msg; in TEST_F()
2380 std::unique_ptr<OatFile> odex_file(OatFile::Open(/*zip_fd=*/ -1, in TEST_F()
2390 std::unique_ptr<gc::space::ImageSpace> space = in TEST_F()
2395 std::set<std::string> seen; in TEST_F()
2404 std::set<std::string> preresolved_seen; in TEST_F()
2423 for (const std::string& str : preresolved_seen) { in TEST_F()
2442 std::set<std::string> boot_image_strings; in TEST_F()
2443 std::set<std::string> app_image_strings; in TEST_F()
2461 std::vector<std::unique_ptr<const DexFile>> dex_files = OpenTestDexFiles("MultiDex"); in TEST_F()
2462 const std::string out_dir = GetScratchDir(); in TEST_F()
2463 const std::string odex_location = out_dir + "/base.odex"; in TEST_F()
2464 const std::string valid_context = "PCL[" + dex_files[0]->GetLocation() + "]"; in TEST_F()
2465 const std::string stored_context = "PCL[/system/not_real_lib.jar]"; in TEST_F()
2466 std::string expected_stored_context = "PCL["; in TEST_F()
2468 for (const std::unique_ptr<const DexFile>& dex_file : dex_files) { in TEST_F()
2475 expected_stored_context += "!classes" + std::to_string(index) + ".dex"; in TEST_F()
2477 expected_stored_context += "*" + std::to_string(dex_file->GetLocationChecksum()); in TEST_F()
2509 void RunTest(const std::vector<std::string>& extra_args = {}) { in RunTest()
2510 std::string dex_location = GetScratchDir() + "/Dex2OatSwapTest.jar";
2511 std::string odex_location = GetOdexDir() + "/Dex2OatSwapTest.odex";
2521 std::string GetTestDexFileName() { in GetTestDexFileName()
2527 std::vector<std::string> argv; in TEST_F()
2530 std::find(std::begin(argv), std::end(argv), "--instruction-set-features=runtime"); in TEST_F()
2533 EXPECT_NE(option_pos, std::end(argv)); in TEST_F()
2535 EXPECT_EQ(option_pos, std::end(argv)); in TEST_F()
2545 std::unique_ptr<const DexFile> dex(OpenTestDexFile("LinkageTest")); in TEST_F()
2546 std::string out_dir = GetScratchDir(); in TEST_F()
2547 const std::string base_oat_name = out_dir + "/base.oat"; in TEST_F()
2548 std::string error_msg; in TEST_F()