Commit 816b1274 authored by Joshua Peraza's avatar Joshua Peraza Committed by Commit Bot

Revert "Update Crashpad to 47a342133d60018f2ffda0037ffe2b5f0d3f7482"

This reverts commit 2ee50cc5.

Reason for revert: Breaks clusterfuzz because of missing ssl deps

Original change's description:
> Update Crashpad to 47a342133d60018f2ffda0037ffe2b5f0d3f7482
>
> 2fb4e9e6a432 mac: Update the process_types version of
>              dyld_all_image_infos for 10.15
> c009b85449cb Use GTEST_SKIP() instead of custom DISABLED_TEST()
> d8f85829b07b linux: fix split stack test
> 7289acb78a6d linux: don't assume vdso exists
> 47a342133d60 linux: use boringssl in chromium
>
> Change-Id: If4718ea7220543c3ca10bc3f7d123ac330625461
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863255
> Commit-Queue: Joshua Peraza <jperaza@chromium.org>
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#707107}

TBR=jperaza@chromium.org,mark@chromium.org

Change-Id: Ia4335007735e1a51ba72d2eb177f780a0db09430
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1867475
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707135}
parent 76d851b4
......@@ -2,7 +2,7 @@ Name: Crashpad
Short Name: crashpad
URL: https://crashpad.chromium.org/
Version: unknown
Revision: 47a342133d60018f2ffda0037ffe2b5f0d3f7482
Revision: fe52a01df1e9c8a5fe8b92872d4bf8689d0cd3b4
License: Apache 2.0
License File: crashpad/LICENSE
Security Critical: yes
......
......@@ -20,6 +20,7 @@
#include "test/errors.h"
#include "test/file.h"
#include "test/filesystem.h"
#include "test/gtest_disabled.h"
#include "test/scoped_temp_dir.h"
#include "util/file/file_io.h"
#include "util/file/filesystem.h"
......@@ -670,7 +671,7 @@ TEST_F(CrashReportDatabaseTest, RequestUpload) {
TEST_F(CrashReportDatabaseTest, Attachments) {
#if defined(OS_MACOSX) || defined(OS_WIN)
// Attachments aren't supported on Mac and Windows yet.
GTEST_SKIP();
DISABLED_TEST();
#else
std::unique_ptr<CrashReportDatabase::NewReport> new_report;
ASSERT_EQ(db()->PrepareNewCrashReport(&new_report),
......@@ -716,7 +717,7 @@ TEST_F(CrashReportDatabaseTest, Attachments) {
TEST_F(CrashReportDatabaseTest, OrphanedAttachments) {
#if defined(OS_MACOSX) || defined(OS_WIN)
// Attachments aren't supported on Mac and Windows yet.
GTEST_SKIP();
DISABLED_TEST();
#else
// TODO: This is using paths that are specific to the generic implementation
// and will need to be generalized for Mac and Windows.
......
......@@ -59,16 +59,4 @@
#define MAC_OS_X_VERSION_10_13 101300
#endif
// 10.14 SDK
#ifndef MAC_OS_X_VERSION_10_14
#define MAC_OS_X_VERSION_10_14 101400
#endif
// 10.15 SDK
#ifndef MAC_OS_X_VERSION_10_15
#define MAC_OS_X_VERSION_10_15 101500
#endif
#endif // CRASHPAD_COMPAT_MAC_AVAILABILITYMACROS_H_
......@@ -38,6 +38,7 @@
#include "build/build_config.h"
#include "gtest/gtest.h"
#include "test/errors.h"
#include "test/gtest_disabled.h"
#include "test/linux/fake_ptrace_connection.h"
#include "test/linux/get_tls.h"
#include "test/multiprocess.h"
......@@ -427,7 +428,7 @@ class ChildWithSplitStackTest : public Multiprocess {
}
void MultiprocessChild() override {
const LinuxVMSize stack_size = page_size_ * 4;
const LinuxVMSize stack_size = page_size_ * 3;
GrowStack(stack_size, reinterpret_cast<LinuxVMAddress>(&stack_size));
}
......@@ -440,7 +441,7 @@ class ChildWithSplitStackTest : public Multiprocess {
} else {
// Write-protect a page on our stack to split up the mapping
LinuxVMAddress page_addr =
stack_address - (stack_address % page_size_) + 2 * page_size_;
stack_address - (stack_address % page_size_) + page_size_;
ASSERT_EQ(
mprotect(reinterpret_cast<void*>(page_addr), page_size_, PROT_READ),
0)
......@@ -808,7 +809,7 @@ TEST(ProcessReaderLinux, AbortMessage) {
// presence of a libc symbol which was introduced in Q.
if (!crashpad::internal::Dlsym(RTLD_DEFAULT,
"android_fdsan_close_with_tag")) {
GTEST_SKIP();
DISABLED_TEST();
}
android_set_abort_message(kTestAbortMessage);
......
......@@ -19,7 +19,6 @@
#include <sys/types.h>
#include <algorithm>
#include <limits>
#include <type_traits>
#include "base/logging.h"
......@@ -27,7 +26,6 @@
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "snapshot/mac/process_types/internal.h"
#include "util/mac/mac_util.h"
#include "util/process/process_memory_mac.h"
#if !DOXYGEN
......@@ -142,8 +140,8 @@ size_t dyld_all_image_infos<Traits>::ExpectedSizeForVersion(
offsetof(dyld_all_image_infos<Traits>, sharedCacheSlide), // 11
offsetof(dyld_all_image_infos<Traits>, sharedCacheUUID), // 12
offsetof(dyld_all_image_infos<Traits>, infoArrayChangeTimestamp), // 13
offsetof(dyld_all_image_infos<Traits>, end_14), // 14
std::numeric_limits<size_t>::max(), // 15, see below
offsetof(dyld_all_image_infos<Traits>, end_14_15), // 14
offsetof(dyld_all_image_infos<Traits>, end_14_15), // 15
sizeof(dyld_all_image_infos<Traits>), // 16
};
......@@ -153,27 +151,7 @@ size_t dyld_all_image_infos<Traits>::ExpectedSizeForVersion(
static_assert(std::is_unsigned<decltype(version)>::value,
"version must be unsigned");
if (version == 15) {
// Disambiguate between the two different layouts for version 15. The
// original one introduced in macOS 10.12 had the same size as version 14.
// The revised one in macOS 10.13 grew. It’s safe to assume that the
// dyld_all_image_infos structure came from the same system that’s now
// interpreting it, so use an OS version check.
int mac_os_x_minor_version = MacOSXMinorVersion();
if (mac_os_x_minor_version == 12) {
return offsetof(dyld_all_image_infos<Traits>, end_14);
}
DCHECK_GE(mac_os_x_minor_version, 13);
DCHECK_LE(mac_os_x_minor_version, 14);
return offsetof(dyld_all_image_infos<Traits>, platform);
}
size_t size = kSizeForVersion[version];
DCHECK_NE(size, std::numeric_limits<size_t>::max());
return size;
return kSizeForVersion[version];
}
// static
......
......@@ -121,29 +121,23 @@ PROCESS_TYPE_STRUCT_BEGIN(dyld_all_image_infos)
// the runtimes that use versions 14 and 15 were built with SDKs that did not
// have this extra padding, it’s necessary to treat the element at index 4 on
// 32-bit systems as outside of the version 14 and 15 structure. This is why
// |reserved| is only declared a 4-element array, with a special end_14 member
// (not present in the native definition) available to indicate the end of the
// native version 14 structure and the 10.12 version 15 structure, preceding
// the padding in the 32-bit structure that would natively be addressed at
// index 4 of |reserved|. Treat reserved_4_32 as only available in version 16
// of the structure.
// |reserved| is only declared a 4-element array, with a special end_14_15
// member (not present in the native definition) available to indicate the
// end of the native version 14 and 15 structure, preceding the padding in the
// 32-bit structure that would natively be addressed at index 4 of |reserved|.
// Treat reserved_4_32 as only available in version 16 of the structure.
PROCESS_TYPE_STRUCT_MEMBER(UIntPtr, reserved, [4])
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_4_64)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_5)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_6)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_7)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_8)
PROCESS_TYPE_STRUCT_MEMBER(Nothing, end_14)
PROCESS_TYPE_STRUCT_MEMBER(Nothing, end_14_15)
PROCESS_TYPE_STRUCT_MEMBER(Reserved32_32Only, reserved_4_32)
// Version 15 (macOS 10.13). <mach-o/dyld_images.h> incorrectly claims that
// these were introduced at version 16. These fields are not present in macOS
// 10.12, which also identifies its structure as version 15.
// Version 16 (macOS 10.13)
PROCESS_TYPE_STRUCT_MEMBER(UIntPtr, compact_dyld_image_info_addr)
PROCESS_TYPE_STRUCT_MEMBER(ULong, compact_dyld_image_info_size) // size_t
// Version 16 (macOS 10.15)
PROCESS_TYPE_STRUCT_MEMBER(uint32_t, platform) // dyld_platform_t
PROCESS_TYPE_STRUCT_END(dyld_all_image_infos)
#endif // ! PROCESS_TYPE_STRUCT_IMPLEMENT_INTERNAL_READ_INTO &&
......
......@@ -18,7 +18,6 @@
#include <mach/mach.h>
#include <string.h>
#include <limits>
#include <vector>
#include "base/stl_util.h"
......@@ -48,11 +47,13 @@ namespace {
TEST(ProcessTypes, DyldImagesSelf) {
// Get the in-process view of dyld_all_image_infos, and check it for sanity.
const dyld_all_image_infos* self_image_infos = DyldGetAllImageInfos();
const int mac_os_x_minor_version = MacOSXMinorVersion();
int mac_os_x_minor_version = MacOSXMinorVersion();
if (mac_os_x_minor_version >= 15) {
EXPECT_GE(self_image_infos->version, 16u);
} else if (mac_os_x_minor_version >= 12) {
// The 10.13 SDK defines dyld_all_image_infos version 16 and says that it’s
// used on 10.13, but 10.13db1 17A264c uses version 15.
//
// TODO(mark): Recheck later in the beta period, up to the 10.13 release.
if (mac_os_x_minor_version >= 12) {
EXPECT_GE(self_image_infos->version, 15u);
} else if (mac_os_x_minor_version >= 9) {
EXPECT_GE(self_image_infos->version, 13u);
......@@ -103,7 +104,7 @@ TEST(ProcessTypes, DyldImagesSelf) {
ProcessReaderMac process_reader;
ASSERT_TRUE(process_reader.Initialize(mach_task_self()));
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13
constexpr uint32_t kDyldAllImageInfosVersionInSDK = 16;
#elif MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
constexpr uint32_t kDyldAllImageInfosVersionInSDK = 15;
......@@ -119,33 +120,12 @@ TEST(ProcessTypes, DyldImagesSelf) {
// Make sure that the size of the structure as declared in the SDK matches the
// size expected for the version of the structure that the SDK describes.
//
// There are two possible layouts for version 15, and the
// ExpectedSizeForVersion() implementation infers the correct one based on the
// run-time OS version, so if the SDK defines the version 15 structure, this
// test can only be performed if the run-time OS natively uses the same format
// structure as the SDK.
bool test_expected_size_for_version_matches_sdk_sizeof;
#if MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_12
test_expected_size_for_version_matches_sdk_sizeof =
mac_os_x_minor_version == 12;
#elif MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13 && \
MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_14
test_expected_size_for_version_matches_sdk_sizeof =
mac_os_x_minor_version >= 13 && mac_os_x_minor_version <= 14;
#else
test_expected_size_for_version_matches_sdk_sizeof = true;
#endif
if (test_expected_size_for_version_matches_sdk_sizeof) {
EXPECT_EQ(process_types::dyld_all_image_infos::ExpectedSizeForVersion(
&process_reader, kDyldAllImageInfosVersionInSDK),
sizeof(dyld_all_image_infos));
}
EXPECT_EQ(process_types::dyld_all_image_infos::ExpectedSizeForVersion(
&process_reader, kDyldAllImageInfosVersionInSDK),
sizeof(dyld_all_image_infos));
// Make sure that the computed sizes of various versions of this structure are
// correct at different bitnessses.
constexpr size_t kSpecialCase = std::numeric_limits<size_t>::max();
constexpr struct {
uint32_t version;
size_t size_32;
......@@ -164,40 +144,13 @@ TEST(ProcessTypes, DyldImagesSelf) {
{12, 84, 160},
{13, 104, 184},
{14, 164, 304},
{15, kSpecialCase, kSpecialCase},
{16, 184, 328},
{15, 164, 304},
{16, 176, 320},
};
for (size_t index = 0; index < base::size(kVersionsAndSizes); ++index) {
uint32_t version = kVersionsAndSizes[index].version;
SCOPED_TRACE(base::StringPrintf("index %zu, version %u", index, version));
if (version == 15) {
if (mac_os_x_minor_version == 12) {
EXPECT_EQ(process_types::internal::dyld_all_image_infos<
process_types::internal::Traits32>::
ExpectedSizeForVersion(version),
164u);
EXPECT_EQ(process_types::internal::dyld_all_image_infos<
process_types::internal::Traits64>::
ExpectedSizeForVersion(version),
304u);
} else if (mac_os_x_minor_version >= 13 && mac_os_x_minor_version <= 14) {
EXPECT_EQ(process_types::internal::dyld_all_image_infos<
process_types::internal::Traits32>::
ExpectedSizeForVersion(version),
176u);
EXPECT_EQ(process_types::internal::dyld_all_image_infos<
process_types::internal::Traits64>::
ExpectedSizeForVersion(version),
320u);
}
continue;
}
ASSERT_NE(kVersionsAndSizes[index].size_32, kSpecialCase);
ASSERT_NE(kVersionsAndSizes[index].size_64, kSpecialCase);
EXPECT_EQ(
process_types::internal::dyld_all_image_infos<
process_types::internal::Traits32>::ExpectedSizeForVersion(version),
......@@ -353,7 +306,7 @@ TEST(ProcessTypes, DyldImagesSelf) {
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13
if (proctype_image_infos.version >= 15 && mac_os_x_minor_version >= 13) {
if (proctype_image_infos.version >= 16) {
EXPECT_EQ(proctype_image_infos.compact_dyld_image_info_addr,
self_image_infos->compact_dyld_image_info_addr);
EXPECT_EQ(proctype_image_infos.compact_dyld_image_info_size,
......@@ -361,12 +314,6 @@ TEST(ProcessTypes, DyldImagesSelf) {
}
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15
if (proctype_image_infos.version >= 16) {
EXPECT_EQ(proctype_image_infos.platform, self_image_infos->platform);
}
#endif
if (proctype_image_infos.version >= 1) {
std::vector<process_types::dyld_image_info> proctype_image_info_vector(
proctype_image_infos.infoArrayCount);
......
......@@ -23,6 +23,7 @@
#include "gtest/gtest.h"
#include "snapshot/win/process_snapshot_win.h"
#include "test/errors.h"
#include "test/gtest_disabled.h"
#include "test/test_paths.h"
#include "test/win/child_launcher.h"
#include "util/file/file_io.h"
......@@ -175,7 +176,7 @@ TEST(ExceptionSnapshotWinTest, MAYBE_ChildCrash) {
#if defined(ARCH_CPU_64_BITS)
TEST(ExceptionSnapshotWinTest, ChildCrashWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestCrashingChild(TestPaths::Architecture::k32Bit);
......@@ -292,7 +293,7 @@ TEST(SimulateCrash, MAYBE_ChildDumpWithoutCrashing) {
#if defined(ARCH_CPU_64_BITS)
TEST(SimulateCrash, ChildDumpWithoutCrashingWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestDumpWithoutCrashingChild(TestPaths::Architecture::k32Bit);
......
......@@ -25,6 +25,7 @@
#include "client/simple_address_range_bag.h"
#include "gtest/gtest.h"
#include "snapshot/win/process_snapshot_win.h"
#include "test/gtest_disabled.h"
#include "test/test_paths.h"
#include "test/win/child_launcher.h"
#include "util/file/file_io.h"
......@@ -109,7 +110,7 @@ TEST(ExtraMemoryRanges, CrashDebugBreak) {
#if defined(ARCH_CPU_64_BITS)
TEST(ExtraMemoryRanges, DontCrashWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestExtraMemoryRanges(kDontCrash, TestPaths::Architecture::k32Bit);
......@@ -117,7 +118,7 @@ TEST(ExtraMemoryRanges, DontCrashWOW64) {
TEST(ExtraMemoryRanges, CrashDebugBreakWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestExtraMemoryRanges(kCrashDebugBreak, TestPaths::Architecture::k32Bit);
......
......@@ -30,6 +30,7 @@
#include "snapshot/annotation_snapshot.h"
#include "snapshot/win/pe_image_reader.h"
#include "snapshot/win/process_reader_win.h"
#include "test/gtest_disabled.h"
#include "test/test_paths.h"
#include "test/win/child_launcher.h"
#include "util/file/file_io.h"
......@@ -151,7 +152,7 @@ TEST(ModuleSnapshotWinTest, CrashDebugBreak) {
#if defined(ARCH_CPU_64_BITS)
TEST(ModuleSnapshotWinTest, DontCrashWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestAnnotationsOnCrash(kDontCrash, TestPaths::Architecture::k32Bit);
......@@ -159,7 +160,7 @@ TEST(ModuleSnapshotWinTest, DontCrashWOW64) {
TEST(ModuleSnapshotWinTest, CrashDebugBreakWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestAnnotationsOnCrash(kCrashDebugBreak, TestPaths::Architecture::k32Bit);
......
......@@ -20,6 +20,7 @@
#include "snapshot/win/pe_image_reader.h"
#include "snapshot/win/process_reader_win.h"
#include "test/errors.h"
#include "test/gtest_disabled.h"
#include "test/test_paths.h"
#include "test/win/child_launcher.h"
#include "util/file/file_io.h"
......@@ -119,7 +120,7 @@ TEST(ProcessSnapshotTest, CrashpadInfoChild) {
#if defined(ARCH_CPU_64_BITS)
TEST(ProcessSnapshotTest, CrashpadInfoChildWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestImageReaderChild(TestPaths::Architecture::k32Bit);
......
......@@ -25,6 +25,8 @@ static_library("test") {
"filesystem.cc",
"filesystem.h",
"gtest_death.h",
"gtest_disabled.cc",
"gtest_disabled.h",
"hex_string.cc",
"hex_string.h",
"main_arguments.cc",
......
// Copyright 2017 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "test/gtest_disabled.h"
#include <stdio.h>
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
namespace crashpad {
namespace test {
namespace {
DisabledTestGtestEnvironment* g_instance;
} // namespace
// static
DisabledTestGtestEnvironment* DisabledTestGtestEnvironment::Get() {
if (!g_instance) {
g_instance = new DisabledTestGtestEnvironment();
}
return g_instance;
}
void DisabledTestGtestEnvironment::DisabledTest() {
const testing::TestInfo* test_info =
testing::UnitTest::GetInstance()->current_test_info();
std::string disabled_test = base::StringPrintf(
"%s.%s", test_info->test_case_name(), test_info->name());
// Show a DISABLED message using a format similar to gtest, along with a hint
// explaining that OK or FAILED will also appear.
printf(
"This test has been disabled dynamically.\n"
"It will appear as both DISABLED and OK or FAILED.\n"
"[ DISABLED ] %s\n",
disabled_test.c_str());
disabled_tests_.push_back(disabled_test);
}
DisabledTestGtestEnvironment::DisabledTestGtestEnvironment()
: testing::Environment(),
disabled_tests_() {
DCHECK(!g_instance);
}
DisabledTestGtestEnvironment::~DisabledTestGtestEnvironment() {
DCHECK_EQ(this, g_instance);
g_instance = nullptr;
}
void DisabledTestGtestEnvironment::TearDown() {
if (!disabled_tests_.empty()) {
printf(
"[ DISABLED ] %" PRIuS " dynamically disabled test%s, listed below:\n"
"[ DISABLED ] %s also counted in PASSED or FAILED below.\n",
disabled_tests_.size(),
disabled_tests_.size() == 1 ? "" : "s",
disabled_tests_.size() == 1 ? "This test is" : "These tests are");
for (const std::string& disabled_test : disabled_tests_) {
printf("[ DISABLED ] %s\n", disabled_test.c_str());
}
}
}
} // namespace test
} // namespace crashpad
// Copyright 2017 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_TEST_GTEST_DISABLED_H_
#define CRASHPAD_TEST_GTEST_DISABLED_H_
#include <string>
#include <vector>
#include "base/macros.h"
#include "gtest/gtest.h"
//! \file
namespace crashpad {
namespace test {
//! \brief Provides support for dynamically disabled gtest tests.
//!
//! A test runner must register this with gtest as follows prior to calling
//! `RUN_ALL_TESTS()`:
//! \code
//! testing::AddGlobalTestEnvironment(
//! crashpad::test::DisabledTestGtestEnvironment::Get());
//! \endcode
class DisabledTestGtestEnvironment final : public testing::Environment {
public:
//! \brief Returns the DisabledTestGtestEnvironment singleton instance,
//! creating it if necessary.
static DisabledTestGtestEnvironment* Get();
//! \brief Displays a message about a test being disabled, and arranges for
//! this information to be duplicated in TearDown().
//!
//! This method is for the internal use of the DISABLED_TEST() macro. Do not
//! call it directly, use the macro instead.
void DisabledTest();
private:
DisabledTestGtestEnvironment();
~DisabledTestGtestEnvironment() override;
// testing::Environment:
void TearDown() override;
std::vector<std::string> disabled_tests_;
DISALLOW_COPY_AND_ASSIGN(DisabledTestGtestEnvironment);
};
} // namespace test
} // namespace crashpad
//! \brief Displays a message about a test being disabled, and returns early.
//!
//! gtest only provides a mechanism for tests to be disabled statically, by
//! prefixing test case names or test names with `DISABLED_`. When it is
//! necessary to disable tests dynamically, gtest provides no assistance. This
//! macro displays a message about the disabled test and returns early. The
//! dynamically disabled test will also be displayed during gtest global test
//! environment tear-down before the test executable exits.
//!
//! This macro may only be invoked from the context of a gtest test.
//!
//! There’s a long-standing <a
//! href="https://groups.google.com/d/topic/googletestframework/Nwh3u7YFuN4">gtest
//! feature request</a> to provide this functionality directly in gtest, but
//! since it hasn’t been implemented, this macro provides a local mechanism to
//! achieve it.
#define DISABLED_TEST() \
do { \
::crashpad::test::DisabledTestGtestEnvironment::Get()->DisabledTest(); \
return; \
} while (false)
#endif // CRASHPAD_TEST_GTEST_DISABLED_H_
......@@ -14,6 +14,7 @@
#include "build/build_config.h"
#include "gtest/gtest.h"
#include "test/gtest_disabled.h"
#include "test/main_arguments.h"
#include "test/multiprocess_exec.h"
......@@ -50,6 +51,8 @@ bool GetChildTestFunctionName(std::string* child_func_name) {
int main(int argc, char* argv[]) {
crashpad::test::InitializeMainArguments(argc, argv);
testing::AddGlobalTestEnvironment(
crashpad::test::DisabledTestGtestEnvironment::Get());
std::string child_func_name;
if (GetChildTestFunctionName(&child_func_name)) {
......
......@@ -37,6 +37,8 @@
'filesystem.cc',
'filesystem.h',
'gtest_death.h',
'gtest_disabled.cc',
'gtest_disabled.h',
'hex_string.cc',
'hex_string.h',
'linux/fake_ptrace_connection.cc',
......
......@@ -22,6 +22,7 @@
#include "base/strings/utf_string_conversions.h"
#include "gtest/gtest.h"
#include "test/filesystem.h"
#include "test/gtest_disabled.h"
#include "test/scoped_temp_dir.h"
#include "util/file/file_io.h"
#include "util/file/filesystem.h"
......@@ -47,7 +48,7 @@ TEST(DirectoryReader, BadPaths) {
TEST(DirectoryReader, BadPaths_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......@@ -143,7 +144,7 @@ TEST(DirectoryReader, FilesAndDirectories) {
TEST(DirectoryReader, FilesAndDirectories_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestFilesAndDirectories(true);
......
......@@ -21,6 +21,7 @@
#include "gtest/gtest.h"
#include "test/errors.h"
#include "test/filesystem.h"
#include "test/gtest_disabled.h"
#include "test/scoped_temp_dir.h"
#include "util/misc/time.h"
......@@ -92,7 +93,7 @@ TEST(Filesystem, FileModificationTime) {
TEST(Filesystem, FileModificationTime_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......@@ -223,7 +224,7 @@ TEST(Filesystem, MoveFileOrDirectory) {
TEST(Filesystem, MoveFileOrDirectory_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......@@ -301,7 +302,7 @@ TEST(Filesystem, IsRegularFile) {
TEST(Filesystem, IsRegularFile_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......@@ -343,7 +344,7 @@ TEST(Filesystem, IsDirectory) {
TEST(Filesystem, IsDirectory_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......@@ -392,7 +393,7 @@ TEST(Filesystem, RemoveFile) {
TEST(Filesystem, RemoveFile_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......@@ -449,7 +450,7 @@ TEST(Filesystem, RemoveDirectory) {
TEST(Filesystem, RemoveDirectory_SymbolicLinks) {
if (!CanCreateSymbolicLinks()) {
GTEST_SKIP();
DISABLED_TEST();
}
ScopedTempDir temp_dir;
......
......@@ -120,9 +120,8 @@ void TestAgainstCloneOrSelf(pid_t pid) {
#if defined(AT_SYSINFO_EHDR)
LinuxVMAddress vdso_addr;
if (aux.GetValue(AT_SYSINFO_EHDR, &vdso_addr)) {
EXPECT_TRUE(mappings.FindMapping(vdso_addr));
}
ASSERT_TRUE(aux.GetValue(AT_SYSINFO_EHDR, &vdso_addr));
EXPECT_TRUE(mappings.FindMapping(vdso_addr));
#endif // AT_SYSINFO_EHDR
#if defined(AT_EXECFN)
......
......@@ -18,6 +18,5 @@ declare_args() {
# TODO(scottmg): https://crbug.com/crashpad/266 fuchsia:DX-690: BoringSSL
# was removed from the Fuchsia SDK. Re-enable it when we have a way to acquire
# a BoringSSL lib again.
crashpad_use_boringssl_for_http_transport_socket =
crashpad_is_in_fuchsia || (crashpad_is_linux && crashpad_is_in_chromium)
crashpad_use_boringssl_for_http_transport_socket = crashpad_is_in_fuchsia
}
......@@ -26,6 +26,7 @@
#include "build/build_config.h"
#include "gtest/gtest.h"
#include "test/errors.h"
#include "test/gtest_disabled.h"
#include "test/scoped_temp_dir.h"
#include "test/test_paths.h"
#include "test/win/child_launcher.h"
......@@ -202,7 +203,7 @@ TEST(ProcessInfo, OtherProcess) {
#if defined(ARCH_CPU_64_BITS)
TEST(ProcessInfo, OtherProcessWOW64) {
if (!TestPaths::Has32BitBuildArtifacts()) {
GTEST_SKIP();
DISABLED_TEST();
}
TestOtherProcess(TestPaths::Architecture::k32Bit);
......
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