ART: Use non-stripped core jars in gtests
To support emulators and other preopted device configurations, use
a special core-libart and core-oj version that will never be stripped.
Bug: 24535627
Change-Id: Ie632bc382bbc753e9c100039f2ecc4ac1f2ab249
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 99f7a2a..3d16c49 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -442,8 +442,8 @@
$$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \
$$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
$$($(2)TARGET_OUT_SHARED_LIBRARIES)/libopenjdk.so \
- $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar \
- $$(TARGET_OUT_JAVA_LIBRARIES)/core-oj.jar
+ $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar \
+ $$(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar
.PHONY: $$(gtest_rule)
$$(gtest_rule): test-art-target-sync
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index 403dd4c..624abb9 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -436,17 +436,26 @@
}
}
-std::vector<std::string> CommonRuntimeTest::GetLibCoreDexFileNames() {
- return std::vector<std::string>({GetDexFileName("core-oj"), GetDexFileName("core-libart")});
-}
-
-std::string CommonRuntimeTest::GetDexFileName(const std::string& jar_prefix) {
- if (IsHost()) {
+static std::string GetDexFileName(const std::string& jar_prefix, bool host) {
+ std::string path;
+ if (host) {
const char* host_dir = getenv("ANDROID_HOST_OUT");
CHECK(host_dir != nullptr);
- return StringPrintf("%s/framework/%s-hostdex.jar", host_dir, jar_prefix.c_str());
+ path = host_dir;
+ } else {
+ path = GetAndroidRoot();
}
- return StringPrintf("%s/framework/%s.jar", GetAndroidRoot(), jar_prefix.c_str());
+
+ std::string suffix = host
+ ? "-hostdex" // The host version.
+ : "-testdex"; // The unstripped target version.
+
+ return StringPrintf("%s/framework/%s%s.jar", path.c_str(), jar_prefix.c_str(), suffix.c_str());
+}
+
+std::vector<std::string> CommonRuntimeTest::GetLibCoreDexFileNames() {
+ return std::vector<std::string>({GetDexFileName("core-oj", IsHost()),
+ GetDexFileName("core-libart", IsHost())});
}
std::string CommonRuntimeTest::GetTestAndroidRoot() {
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index 8d9e628..7223b6e 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -118,9 +118,6 @@
// initializers, initialize well-known classes, and creates the heap thread pool.
virtual void FinalizeSetup();
- // Gets the path of the specified dex file for host or target.
- static std::string GetDexFileName(const std::string& jar_prefix);
-
std::string GetTestAndroidRoot();
std::string GetTestDexFileName(const char* name);