Use art::GetAndroidRoot instead of ANDROID_HOST_OUT in art::CommonArtTestImpl.
Do not use the environment variable ANDROID_HOST_OUT to find the
Android Root in art::CommonArtTestImpl; rely on art::GetAndroidRoot
instead.
Test: m test-art-host-gtest
Change-Id: I89fc9288164b57bc3f6542864cece312b6df2fd1
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index afdb733..ccaa90f 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -322,14 +322,7 @@
}
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);
- path = host_dir;
- } else {
- path = GetAndroidRoot();
- }
+ std::string path = GetAndroidRoot();
std::string suffix = host
? "-hostdex" // The host version.
@@ -415,8 +408,7 @@
CHECK(name != nullptr);
std::string filename;
if (IsHost()) {
- filename += getenv("ANDROID_HOST_OUT");
- filename += "/framework/";
+ filename += GetAndroidRoot() + "/framework/";
} else {
filename += ART_TARGET_NATIVETEST_DIR_STRING;
}
@@ -466,9 +458,8 @@
std::string location;
if (IsHost()) {
- const char* host_dir = getenv("ANDROID_HOST_OUT");
- CHECK(host_dir != nullptr);
- location = StringPrintf("%s/framework/core.%s", host_dir, suffix);
+ std::string host_dir = GetAndroidRoot();
+ location = StringPrintf("%s/framework/core.%s", host_dir.c_str(), suffix);
} else {
location = StringPrintf("/data/art-test/core.%s", suffix);
}