Augment search path for tradefed host gtests.
Tradefed uses different directory layout locally and remotely.
Bug: 147817558
Test: m general-tests && atest art_dex2oat_tests --host
Change-Id: I60cb5971dfb7b6a644a74a1c77d1a269ce461859
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index 70b94b8..875920c 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -42,6 +42,7 @@
#include "base/os.h"
#include "base/runtime_debug.h"
#include "base/stl_util.h"
+#include "base/string_view_cpp20.h"
#include "base/unix_file/fd_file.h"
#include "dex/art_dex_file_loader.h"
#include "dex/dex_file-inl.h"
@@ -159,7 +160,9 @@
break;
}
// We are running tests from testcases (extracted from zip) on tradefed.
- if (path.filename() == std::filesystem::path("testcases")) {
+ // The first path is for remote runs and the second path for local runs.
+ if (path.filename() == std::filesystem::path("testcases") ||
+ StartsWith(path.filename().string(), "host_testcases")) {
android_build_top = path.append("art_common");
break;
}