summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-09-24 11:26:51 -0400
committerGennadiy Civil <misterg@google.com>2019-09-27 16:48:17 -0400
commitbf0fe874a27bd6c9a4a35b98e662d2d02f8879a2 (patch)
tree535216a786f1d7b54b55dcd7889f984dd133d3ad
parent076c46198fe1cb50160b287e51c72bd7b1194c1a (diff)
downloadgoogletest-git-bf0fe874a27bd6c9a4a35b98e662d2d02f8879a2.tar.gz
Googletest export
Use a more portable path for Android to write temp files to. /sdcard is *not* guaranteed to be available, but /data/local/tmp is. In some emulated situations, /sdcard may not be mounted, may not be R/W, or mounting may be delayed until *after* the test process begins. This is fairly common location to use. See e.g.: https://reviews.llvm.org/D9569 PiperOrigin-RevId: 270909282
-rw-r--r--googletest/src/gtest-port.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc
index 73dfdeba..fc5ba6be 100644
--- a/googletest/src/gtest-port.cc
+++ b/googletest/src/gtest-port.cc
@@ -1102,13 +1102,10 @@ class CapturedStream {
// code as part of a regular standalone executable, which doesn't
// run in a Dalvik process (e.g. when running it through 'adb shell').
//
- // The location /sdcard is directly accessible from native code
- // and is the only location (unofficially) supported by the Android
- // team. It's generally a symlink to the real SD Card mount point
- // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or
- // other OEM-customized locations. Never rely on these, and always
- // use /sdcard.
- char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX";
+ // The location /data/local/tmp is directly accessible from native code.
+ // '/sdcard' and other variants cannot be relied on, as they are not
+ // guaranteed to be mounted, or may have a delay in mounting.
+ char name_template[] = "/data/local/tmp/gtest_captured_stream.XXXXXX";
# else
char name_template[] = "/tmp/captured_stream.XXXXXX";
# endif // GTEST_OS_LINUX_ANDROID