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
This commit is contained in:
Abseil Team 2019-09-24 11:26:51 -04:00 committed by Gennadiy Civil
parent 076c46198f
commit bf0fe874a2

View File

@ -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