Commit 0de122e6 authored by Ilia Samsonov's avatar Ilia Samsonov Committed by Commit Bot

Roll src/third_party/googletest/src/ 306f3754a..10b1902d8 (16 commits)

https://chromium.googlesource.com/external/github.com/google/googletest.git/+log/306f3754a71d..10b1902d893e

$ git log 306f3754a..10b1902d8 --date=short --no-merges --format='%ad %ae %s'
2020-01-21 absl-team Googletest export
2020-01-17 absl-team Googletest export
2020-01-16 absl-team Googletest export
2020-01-15 absl-team Googletest export
2020-01-15 absl-team Googletest export
2020-01-14 absl-team Googletest export
2020-01-14 absl-team Googletest export
2020-01-14 absl-team Googletest export
2020-01-10 absl-team Googletest export
2020-01-15 36923279+ivan1993br Remove exclusion of *-main and*-all targets
2020-01-12 hilmanbeyri Use IsReadableTypeName IsReadableTypeName in OfType function in gmock-matchers_test.cc
2020-01-12 hilmanbeyri fix unit test failure on NoShortCircuitOnFailure and DetectsFlakyShortCircuit when GTEST_HAS_RTTI is 1
2020-01-09 absl-team Googletest export
2020-01-09 absl-team Googletest export
2020-01-07 absl-team Googletest export
2020-01-07 absl-team Googletest export

Created with:
  roll-dep src/third_party/googletest/src

This CL uses the internal placeholder GTEST_CUSTOM_TEMPDIR_FUNCTION_ to
use an available path for temp directory.

Change-Id: I9ca9bd1d599d9737a228b43e50b5caadfff5229c

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel,mac_optional_gpu_tests_rel
Change-Id: I9ca9bd1d599d9737a228b43e50b5caadfff5229c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023674Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Commit-Queue: Ilia Samsonov <isamsonov@google.com>
Cr-Commit-Position: refs/heads/master@{#738235}
parent 795efb16
......@@ -211,7 +211,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling googletest
# and whatever else without interference from each other.
'googletest_revision': '306f3754a71d6d1ac644681d3544d06744914228',
'googletest_revision': '10b1902d893ea8cc43c69541d70868f91af3646b',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling lighttpd
# and whatever else without interference from each other.
......
......@@ -67,8 +67,10 @@ source_set("gtest") {
"custom/gtest/internal/custom/stack_trace_getter.cc",
"custom/gtest/internal/custom/stack_trace_getter.h",
# TODO(crbug.com/1009553): Remove this wrapper after plumbing a workable
# temporary path into googletest on Android.
# TODO(crbug.com/1009553): Remove this wrapper and custom temp dir
# after plumbing a workable temporary path into googletest on Android.
"custom/gtest/internal/custom/chrome_custom_temp_dir.cc",
"custom/gtest/internal/custom/chrome_custom_temp_dir.h",
"custom/gtest/internal/custom/gtest_port_wrapper.cc",
"src/googletest/include/gtest/gtest-death-test.h",
"src/googletest/include/gtest/gtest-matchers.h",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/googletest/custom/gtest/internal/custom/chrome_custom_temp_dir.h"
#include "third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h"
#if GTEST_OS_WINDOWS
#include <windows.h>
#endif // GTEST_OS_WINDOWS
namespace testing {
namespace {
// The temporary directory read from the OS canonical environment variable.
//
// Returns an empty string if the environment variable is not set. The returned
// string may or may not end with the OS-specific path separator. The path is
// not guaranteed to point to an existing directory. The directory it points to
// is not guaranteed to be writable by the application.
std::string ChromeGetEnvTempDir() {
#if GTEST_OS_WINDOWS_MOBILE
const char* env_result = internal::posix::GetEnv("TEMP");
#elif GTEST_OS_WINDOWS
char temp_dir_path[_MAX_PATH + 1] = {'\0'}; // NOLINT
if (::GetTempPathA(sizeof(temp_dir_path), temp_dir_path) != 0)
return temp_dir_path;
const char* env_result = internal::posix::GetEnv("TEMP");
#else
const char* env_result = internal::posix::GetEnv("TMPDIR");
#endif // GETST_OS_WINDOWS
if (env_result == nullptr)
return std::string();
return env_result;
}
} // namespace
// returns temp directory for tests.
std::string ChromeCustomTempDir() {
std::string temp_dir = ChromeGetEnvTempDir();
if (!temp_dir.empty()) {
if (temp_dir.back() != GTEST_PATH_SEP_[0])
temp_dir.push_back(GTEST_PATH_SEP_[0]);
return temp_dir;
}
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS
return "\\temp\\";
#elif GTEST_OS_LINUX_ANDROID
// Android applications are expected to call the framework's
// Context.getExternalStorageDirectory() method through JNI to get the
// location of the world-writable SD Card directory. However, this requires a
// Context handle, which cannot be retrieved globally from native code. Doing
// so also precludes running the code as part of a regular standalone
// executable, which doesn't run in a Dalvik process (e.g. when running it
// through 'adb shell').
//
// Starting from Android O, the recommended generic temporary directory is
// '/data/local/tmp'. The recommended fallback is the current directory,
// which is usually accessible in app context.
if (::access("/data/local/tmp", R_OK | W_OK | X_OK) == 0)
return "/data/local/tmp/";
const char* current_dir = ::getcwd(nullptr, 0);
if (current_dir != nullptr &&
::access(current_dir, R_OK | W_OK | X_OK) == 0) {
temp_dir = current_dir;
temp_dir.push_back(GTEST_PATH_SEP_[0]);
return temp_dir;
}
// Before Android O, /sdcard is usually available.
if (::access("/sdcard", R_OK | W_OK | X_OK) == 0)
return "/sdcard/";
// Generic POSIX fallback.
return "/tmp/";
#else
return "/tmp/";
#endif // GTEST_OS_WINDOWS_MOBILE
}
} // namespace testing
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_CHROME_CUSTOM_TEMP_DIR_H_
#define THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_CHROME_CUSTOM_TEMP_DIR_H_
#include <string>
namespace testing {
// Returns alternate temp directory for gtest.
std::string ChromeCustomTempDir();
} // namespace testing
#endif // THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_CHROME_CUSTOM_TEMP_DIR_H_
......@@ -6,6 +6,7 @@
#define THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_H_
#include "build/build_config.h"
#include "third_party/googletest/custom/gtest/internal/custom/chrome_custom_temp_dir.h"
#if !defined(GTEST_DISABLE_PRINT_STACK_TRACE)
#include "third_party/googletest/custom/gtest/internal/custom/stack_trace_getter.h"
......@@ -15,4 +16,8 @@
#define GTEST_OS_STACK_TRACE_GETTER_ StackTraceGetter
#endif // defined(GTEST_DISABLE_PRINT_STACK_TRACE)
// TODO(crbug.com/1009553): Remove once googletest android temporary path is
// fixed.
#define GTEST_CUSTOM_TEMPDIR_FUNCTION_ ChromeCustomTempDir
#endif // THIRD_PARTY_GOOGLETEST_CUSTOM_GTEST_INTERNAL_CUSTOM_GTEST_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment