From bfaba288427e80e7941e49c4264ba8f6cd6d97d1 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Fri, 15 Mar 2019 11:35:51 +0000 Subject: Fix buildbots hidden_api_test Target buildbots set /system to be the runtime module root because they are running without an apex. The test assumes that /system dex files are assigned to the application domain but here they get assigned to the core-platform domain. Adjust the domain setting logic to check if the runtime module root is distict from the android root (as a proxy for 'is running with apex'). If not (as is the case with the buildbots), skip checks against apex locations. Test: m test-art-target-gtest-hidden_api_test Change-Id: Iff3890ec69cb04a1e4ed5bc2a3b5c652ada05f36 --- libartbase/base/file_utils.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libartbase/base/file_utils.cc') diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc index 1f8457a484..865c8a6a85 100644 --- a/libartbase/base/file_utils.cc +++ b/libartbase/base/file_utils.cc @@ -334,6 +334,16 @@ bool LocationIsOnSystemFramework(const char* full_path) { return android::base::StartsWith(full_path, framework_path); } +bool RuntimeModuleRootDistinctFromAndroidRoot() { + std::string error_msg; + std::string android_root = GetAndroidRootSafe(&error_msg); + const char* runtime_root = + GetAndroidDirSafe(kRuntimeApexEnvVar, kRuntimeApexDefaultPath, &error_msg); + return !android_root.empty() + && (runtime_root != nullptr) + && (android_root != std::string_view(runtime_root)); +} + int DupCloexec(int fd) { #if defined(__linux__) return fcntl(fd, F_DUPFD_CLOEXEC, 0); -- cgit v1.2.3-59-g8ed1b