summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2020-08-31 15:48:25 -0700
committer Treehugger Robot <treehugger-gerrit@google.com> 2020-09-03 17:07:33 +0000
commit1faacf59b9f74e9d2de4e0331ef0cdfcf132225d (patch)
treee8288e534e85a816b7eb818bf20085e1b46a3553
parent93deebfd2af0470b13973d51e2cce6c62a7344f4 (diff)
Support running art gtests out-of-tree
Art host gtests would CHECK that the binary path was below ANDROID_BUILD_TOP. This could cause problems for some build configurations such as custom OUT_DIRs and using the vscode debugger. Since having ANDROID_BUILD_TOP be correct is the only actually important thing we can just ignore this discrepency. Change the test setup to prefer ANDROID_BUILD_TOP if set and it differs from the binary location. Test: gtests Change-Id: I566fd4c1b801efe87bf368caa41f2330f659b4b2
-rw-r--r--libartbase/base/common_art_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index c372e10182..70b94b87cb 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -172,8 +172,12 @@ std::string CommonArtTestImpl::GetAndroidBuildTop() {
android_build_top = std::filesystem::path(android_build_top).string();
CHECK(!android_build_top.empty());
if (android_build_top_from_env != nullptr) {
- CHECK_EQ(std::filesystem::weakly_canonical(android_build_top).string(),
- std::filesystem::weakly_canonical(android_build_top_from_env).string());
+ if (std::filesystem::weakly_canonical(android_build_top).string() !=
+ std::filesystem::weakly_canonical(android_build_top_from_env).string()) {
+ LOG(WARNING) << "Execution path (" << argv << ") not below ANDROID_BUILD_TOP ("
+ << android_build_top_from_env << ")! Using env-var.";
+ android_build_top = android_build_top_from_env;
+ }
} else {
setenv("ANDROID_BUILD_TOP", android_build_top.c_str(), /*overwrite=*/0);
}