From bf0fe874a27bd6c9a4a35b98e662d2d02f8879a2 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 24 Sep 2019 11:26:51 -0400 Subject: 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 --- googletest/src/gtest-port.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 73dfdeb..fc5ba6b 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 -- cgit v0.12