mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Upstream crashpad_util_test-in-Chromium changes
This upstreams part of
00a0654929
.
The gmock_main and gtest_main test launchers detect via a
CRASHPAD_IN_CHROMIUM macro that they are building as part of Chromium,
and use Chromium’s custom test launcher rather than gtest’s
RUN_ALL_TESTS(). This enables parallelism, sharding, and integration
with Swarming.
WinMultiprocess-based tests are not compatible with this test launcher
or with the Swarming test design, and must be disabled when
CRASHPAD_IN_CHROMIUM is set. This is covered by
https://crashpad.chromium.org/bug/205.
CRASHPAD_IN_CHROMIUM is never defined during Crashpad’s own standalone
build, it’s only defined when building in Chromium.
Change-Id: I969c5d376f86ab4b3f4cc85c97d4452b53b35063
Reviewed-on: https://chromium-review.googlesource.com/740988
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
parent
ef262d1ee3
commit
672c872589
@ -17,10 +17,31 @@
|
|||||||
#include "test/gtest_disabled.h"
|
#include "test/gtest_disabled.h"
|
||||||
#include "test/main_arguments.h"
|
#include "test/main_arguments.h"
|
||||||
|
|
||||||
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
||||||
|
#include "base/bind.h"
|
||||||
|
#include "base/test/launcher/unit_test_launcher.h"
|
||||||
|
#include "base/test/test_suite.h"
|
||||||
|
#endif // CRASHPAD_IN_CHROMIUM
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
crashpad::test::InitializeMainArguments(argc, argv);
|
crashpad::test::InitializeMainArguments(argc, argv);
|
||||||
testing::InitGoogleMock(&argc, argv);
|
testing::InitGoogleMock(&argc, argv);
|
||||||
testing::AddGlobalTestEnvironment(
|
testing::AddGlobalTestEnvironment(
|
||||||
crashpad::test::DisabledTestGtestEnvironment::Get());
|
crashpad::test::DisabledTestGtestEnvironment::Get());
|
||||||
|
|
||||||
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
||||||
|
|
||||||
|
// This supports --test-launcher-summary-output, which writes a JSON file
|
||||||
|
// containing test details needed by Swarming.
|
||||||
|
base::TestSuite test_suite(argc, argv);
|
||||||
|
return base::LaunchUnitTests(
|
||||||
|
argc,
|
||||||
|
argv,
|
||||||
|
base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
|
||||||
|
|
||||||
|
#else // CRASHPAD_IN_CHROMIUM
|
||||||
|
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
|
|
||||||
|
#endif // CRASHPAD_IN_CHROMIUM
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,31 @@
|
|||||||
#include "test/gtest_disabled.h"
|
#include "test/gtest_disabled.h"
|
||||||
#include "test/main_arguments.h"
|
#include "test/main_arguments.h"
|
||||||
|
|
||||||
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
||||||
|
#include "base/bind.h"
|
||||||
|
#include "base/test/launcher/unit_test_launcher.h"
|
||||||
|
#include "base/test/test_suite.h"
|
||||||
|
#endif // CRASHPAD_IN_CHROMIUM
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
crashpad::test::InitializeMainArguments(argc, argv);
|
crashpad::test::InitializeMainArguments(argc, argv);
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
testing::AddGlobalTestEnvironment(
|
testing::AddGlobalTestEnvironment(
|
||||||
crashpad::test::DisabledTestGtestEnvironment::Get());
|
crashpad::test::DisabledTestGtestEnvironment::Get());
|
||||||
|
|
||||||
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
||||||
|
|
||||||
|
// This supports --test-launcher-summary-output, which writes a JSON file
|
||||||
|
// containing test details needed by Swarming.
|
||||||
|
base::TestSuite test_suite(argc, argv);
|
||||||
|
return base::LaunchUnitTests(
|
||||||
|
argc,
|
||||||
|
argv,
|
||||||
|
base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
|
||||||
|
|
||||||
|
#else // CRASHPAD_IN_CHROMIUM
|
||||||
|
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
|
|
||||||
|
#endif // CRASHPAD_IN_CHROMIUM
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,13 @@ class TestClient final : public WinChildProcess {
|
|||||||
DISALLOW_COPY_AND_ASSIGN(TestClient);
|
DISALLOW_COPY_AND_ASSIGN(TestClient);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ExceptionHandlerServerTest, MultipleConnections) {
|
// https://crashpad.chromium.org/bug/205
|
||||||
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
||||||
|
#define MAYBE_MultipleConnections DISABLED_MultipleConnections
|
||||||
|
#else // CRASHPAD_IN_CHROMIUM
|
||||||
|
#define MAYBE_MultipleConnections MultipleConnections
|
||||||
|
#endif // CRASHPAD_IN_CHROMIUM
|
||||||
|
TEST_F(ExceptionHandlerServerTest, MAYBE_MultipleConnections) {
|
||||||
WinChildProcess::EntryPoint<TestClient>();
|
WinChildProcess::EntryPoint<TestClient>();
|
||||||
|
|
||||||
std::unique_ptr<WinChildProcess::Handles> handles_1 =
|
std::unique_ptr<WinChildProcess::Handles> handles_1 =
|
||||||
|
@ -89,7 +89,13 @@ class ScopedProcessSuspendTest final : public WinChildProcess {
|
|||||||
DISALLOW_COPY_AND_ASSIGN(ScopedProcessSuspendTest);
|
DISALLOW_COPY_AND_ASSIGN(ScopedProcessSuspendTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(ScopedProcessSuspend, ScopedProcessSuspend) {
|
// https://crashpad.chromium.org/bug/205
|
||||||
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
||||||
|
#define MAYBE_ScopedProcessSuspend DISABLED_ScopedProcessSuspend
|
||||||
|
#else // CRASHPAD_IN_CHROMIUM
|
||||||
|
#define MAYBE_ScopedProcessSuspend ScopedProcessSuspend
|
||||||
|
#endif // CRASHPAD_IN_CHROMIUM
|
||||||
|
TEST(ScopedProcessSuspend, MAYBE_ScopedProcessSuspend) {
|
||||||
WinChildProcess::EntryPoint<ScopedProcessSuspendTest>();
|
WinChildProcess::EntryPoint<ScopedProcessSuspendTest>();
|
||||||
std::unique_ptr<WinChildProcess::Handles> handles = WinChildProcess::Launch();
|
std::unique_ptr<WinChildProcess::Handles> handles = WinChildProcess::Launch();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user