Fix oatdump_test.
The ExportDex variants stopped working now that core-oj.jar is
uncumpressed and the vdex file doesn't contain the dex code.
Use an app dex file instead.
Change-Id: Ib7c09a7180a62007a67de5062575ad07dcce4944
Test: oatdump_test
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 3dab025..67d85c1 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -216,6 +216,7 @@
ART_GTEST_verifier_deps_test_DEX_DEPS := VerifierDeps VerifierDepsMulti MultiDex
ART_GTEST_dex_to_dex_decompiler_test_DEX_DEPS := VerifierDeps DexToDexDecompiler
ART_GTEST_oatdump_app_test_DEX_DEPS := ProfileTestMultiDex
+ART_GTEST_oatdump_test_DEX_DEPS := ProfileTestMultiDex
# The elf writer test has dependencies on core.oat.
ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_DEFAULT_64) $(HOST_CORE_IMAGE_DEFAULT_32)
diff --git a/oatdump/oatdump_test.cc b/oatdump/oatdump_test.cc
index e6936f6..7b1de01 100644
--- a/oatdump/oatdump_test.cc
+++ b/oatdump/oatdump_test.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <android-base/file.h>
+
#include "oatdump_test.h"
namespace art {
@@ -90,8 +92,11 @@
// Test is failing on target, b/77469384.
TEST_DISABLED_FOR_TARGET();
std::string error_msg;
+ ASSERT_TRUE(GenerateAppOdexFile(kDynamic, {}));
ASSERT_TRUE(Exec(kDynamic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly));
- const std::string dex_location = tmp_dir_+ "/core-oj-hostdex.jar_export.dex";
+ const std::string dex_location =
+ tmp_dir_+ "/" + android::base::Basename(GetTestDexFileName(GetAppBaseName().c_str())) +
+ "_export.dex";
const std::string dexdump2 = GetExecutableFilePath("dexdump2",
/*is_debug=*/false,
/*is_static=*/false);
@@ -104,6 +109,7 @@
TEST_DISABLED_FOR_ARM_AND_MIPS();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
+ ASSERT_TRUE(GenerateAppOdexFile(kDynamic, {}));
ASSERT_TRUE(Exec(kStatic, kModeOat, {"--export-dex-to=" + tmp_dir_}, kListOnly));
}
diff --git a/oatdump/oatdump_test.h b/oatdump/oatdump_test.h
index dfa659b..22c1baa 100644
--- a/oatdump/oatdump_test.h
+++ b/oatdump/oatdump_test.h
@@ -201,7 +201,7 @@
exec_argv.push_back("--oat-file=" + GetAppOdexName());
} else {
CHECK_EQ(static_cast<size_t>(mode), static_cast<size_t>(kModeOat));
- exec_argv.push_back("--oat-file=" + core_oat_location_);
+ exec_argv.push_back("--oat-file=" + GetAppOdexName());
}
}
exec_argv.insert(exec_argv.end(), args.begin(), args.end());