Adjust data dir set up in `CommonArtTestImpl::SetUpAndroidRootEnvVars`.
Don't set up the `ANDROID_DATA` dir as a subdirectory of
`/data/dalvik-cache` in
`art::CommonArtTestImpl::SetUpAndroidRootEnvVars` (used in some ART
gtests), as it is not accessible on `user` builds; instead, use a
subdirectory of `/data/local/tmp`, which does not require any special
permission.
(cherry picked from commit 7ffab8106445905d30fdef6291ebd18765c961f0)
Test: m art_chroot && atest ArtGtestsTargetChroot
Test: Run ART gtests as described in `test/README.chroot.md`
Bug: 193218514
Bug: 162834439
Change-Id: I19c7015b0140610a6fd2150a7f7a057465312b0c
Merged-In: I19c7015b0140610a6fd2150a7f7a057465312b0c
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index 698ff87..c81cbc6 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -277,7 +277,6 @@
}
void CommonArtTestImpl::SetUpAndroidDataDir(std::string& android_data) {
- // On target, Cannot use /mnt/sdcard because it is mounted noexec, so use subdir of dalvik-cache
if (IsHost()) {
const char* tmpdir = getenv("TMPDIR");
if (tmpdir != nullptr && tmpdir[0] != 0) {
@@ -286,7 +285,11 @@
android_data = "/tmp";
}
} else {
- android_data = "/data/dalvik-cache";
+ // On target, we cannot use `/mnt/sdcard` because it is mounted `noexec`,
+ // nor `/data/dalvik-cache` as it is not accessible on `user` builds.
+ // Instead, use `/data/local/tmp`, which does not require any special
+ // permission.
+ android_data = "/data/local/tmp";
}
android_data += "/art-data-XXXXXX";
if (mkdtemp(&android_data[0]) == nullptr) {