Honor `ART_TEST_ANDROID_RUNTIME_ROOT` when running ART gtests on target.
When this environment variable is defined, use its value to define
`ANDROID_RUNTIME_ROOT` when running ART gtests on device.
This is a generic change, but its first intended use is to point
`ANDROID_RUNTIME_ROOT` to "/system" when running gtests on target, so
that ICU can find ICU .dat files in "/system/etc/icu", until the
Runtime APEX is available in target testing on the ART Buildbot.
Test: Rely on the ART Buildbot.
Bug: 121117762
Bug: 119293618
Bug: 113373927
Change-Id: I96e12e237d3c722609a042aaf1a946b654f9544f
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 00055b2..f00da9c 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -425,6 +425,9 @@
endif
ART_GTEST_TARGET_ANDROID_RUNTIME_ROOT := '/apex/com.android.runtime'
+ifneq ($(ART_TEST_ANDROID_RUNTIME_ROOT),)
+ ART_GTEST_TARGET_ANDROID_RUNTIME_ROOT := $(ART_TEST_ANDROID_RUNTIME_ROOT)
+endif
# Define a make rule for a target device gtest.
# $(1): gtest name - the name of the test we're building such as leb128_test.