2017-03-18 00:18:20 -04:00
|
|
|
|
// 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.
|
|
|
|
|
|
Un-disable WinMultiprocess-based tests in Chromium
As of
https://chromium.googlesource.com/chromium/src/+/00a0654929787f70b0cd81f30aa14e81c5e11b2f,
crashpad_util_test is able to run in Chromium. It uses Chromium’s own
base::TestLauncher rather than gtest’s RUN_ALL_TESTS() for proper
integration with Swarming.
Launching WinMultiprocess test children out of the same test executable
via WinChildProcess is not compatible with Chromium’s parallel, shardy,
Swarmy test launcher. When running these children, the standard gtest
RUN_ALL_TESTS() launcher will now be used, even in Chromium.
Two tests disabled in Chromium are now enabled:
ExceptionHandlerServerTest.MultipleConnections and
ScopedProcessSuspend.ScopedProcessSuspend.
As part of this work, I discovered that disabled tests chosen to run via
--gtest_also_run_disabled_tests did not actually work for
WinMultiprocess-based tests, because gtest’s test launcher would refuse
to run the child side of the test, believing it was disabled. This is
fixed by always supplying --gtest_also_run_disabled_tests to
WinChildProcess children, on the basis that if the parent is managing to
run and it’s disabled, disabled tests must actually be enabled.
Bug: crashpad:205
Change-Id: Ied22f16b9329ee13b6b07fd29de704f6fe2a058e
Reviewed-on: https://chromium-review.googlesource.com/742462
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-27 17:41:32 -04:00
|
|
|
|
#include "build/build_config.h"
|
2017-03-18 00:18:20 -04:00
|
|
|
|
#include "gtest/gtest.h"
|
win: Dynamically disable WoW64 tests absent explicit 32-bit build output
Rather than having the 64-bit build assume that it lives in
out\{Debug,Release}_x64 and that it can find 32-bit build output in
out\{Debug,Release}, require the location of 32-bit build output to be
provided explicitly via the CRASHPAD_TEST_32_BIT_OUTPUT environment
variable. If this variable is not set, 64-bit tests that require 32-bit
test build output will dynamically disable themselves at runtime.
In order for this to work, a new DISABLED_TEST() macro is added to
support dynamically disabled tests. gtest does not have its own
first-class support for this
(https://groups.google.com/d/topic/googletestframework/Nwh3u7YFuN4,
https://github.com/google/googletest/issues/490) so this local solution
is used instead.
For tests via Crashpad’s own build\run_tests.py, which is how Crashpad’s
own buildbots and trybots invoke tests, CRASHPAD_TEST_32_BIT_OUTPUT is
set to a locaton compatible with the paths expected for the GYP-based
build. No test coverage is lost on Crashpad’s own buildbots and trybots.
For Crashpad tests in Chromium’s buildbots and trybots, this environment
variable will not be set, causing these tests to be dynamically
disabled.
Bug: crashpad:203, chromium:743139, chromium:777924
Change-Id: I3c0de2bf4f835e13ed5a4adda5760d6fed508126
Reviewed-on: https://chromium-review.googlesource.com/739795
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-26 13:48:01 -04:00
|
|
|
|
#include "test/gtest_disabled.h"
|
2017-03-18 00:18:20 -04:00
|
|
|
|
#include "test/main_arguments.h"
|
|
|
|
|
|
Un-disable WinMultiprocess-based tests in Chromium
As of
https://chromium.googlesource.com/chromium/src/+/00a0654929787f70b0cd81f30aa14e81c5e11b2f,
crashpad_util_test is able to run in Chromium. It uses Chromium’s own
base::TestLauncher rather than gtest’s RUN_ALL_TESTS() for proper
integration with Swarming.
Launching WinMultiprocess test children out of the same test executable
via WinChildProcess is not compatible with Chromium’s parallel, shardy,
Swarmy test launcher. When running these children, the standard gtest
RUN_ALL_TESTS() launcher will now be used, even in Chromium.
Two tests disabled in Chromium are now enabled:
ExceptionHandlerServerTest.MultipleConnections and
ScopedProcessSuspend.ScopedProcessSuspend.
As part of this work, I discovered that disabled tests chosen to run via
--gtest_also_run_disabled_tests did not actually work for
WinMultiprocess-based tests, because gtest’s test launcher would refuse
to run the child side of the test, believing it was disabled. This is
fixed by always supplying --gtest_also_run_disabled_tests to
WinChildProcess children, on the basis that if the parent is managing to
run and it’s disabled, disabled tests must actually be enabled.
Bug: crashpad:205
Change-Id: Ied22f16b9329ee13b6b07fd29de704f6fe2a058e
Reviewed-on: https://chromium-review.googlesource.com/742462
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-27 17:41:32 -04:00
|
|
|
|
#if defined(CRASHPAD_TEST_LAUNCHER_GMOCK)
|
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
#endif // CRASHPAD_TEST_LAUNCHER_GMOCK
|
|
|
|
|
|
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
|
#include "test/win/win_child_process.h"
|
|
|
|
|
#endif // OS_WIN
|
|
|
|
|
|
2017-10-27 16:06:32 -04:00
|
|
|
|
#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
|
|
|
|
|
|
2017-03-18 00:18:20 -04:00
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
crashpad::test::InitializeMainArguments(argc, argv);
|
win: Dynamically disable WoW64 tests absent explicit 32-bit build output
Rather than having the 64-bit build assume that it lives in
out\{Debug,Release}_x64 and that it can find 32-bit build output in
out\{Debug,Release}, require the location of 32-bit build output to be
provided explicitly via the CRASHPAD_TEST_32_BIT_OUTPUT environment
variable. If this variable is not set, 64-bit tests that require 32-bit
test build output will dynamically disable themselves at runtime.
In order for this to work, a new DISABLED_TEST() macro is added to
support dynamically disabled tests. gtest does not have its own
first-class support for this
(https://groups.google.com/d/topic/googletestframework/Nwh3u7YFuN4,
https://github.com/google/googletest/issues/490) so this local solution
is used instead.
For tests via Crashpad’s own build\run_tests.py, which is how Crashpad’s
own buildbots and trybots invoke tests, CRASHPAD_TEST_32_BIT_OUTPUT is
set to a locaton compatible with the paths expected for the GYP-based
build. No test coverage is lost on Crashpad’s own buildbots and trybots.
For Crashpad tests in Chromium’s buildbots and trybots, this environment
variable will not be set, causing these tests to be dynamically
disabled.
Bug: crashpad:203, chromium:743139, chromium:777924
Change-Id: I3c0de2bf4f835e13ed5a4adda5760d6fed508126
Reviewed-on: https://chromium-review.googlesource.com/739795
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-26 13:48:01 -04:00
|
|
|
|
testing::AddGlobalTestEnvironment(
|
|
|
|
|
crashpad::test::DisabledTestGtestEnvironment::Get());
|
2017-10-27 16:06:32 -04:00
|
|
|
|
|
|
|
|
|
#if defined(CRASHPAD_IN_CHROMIUM)
|
|
|
|
|
|
Un-disable WinMultiprocess-based tests in Chromium
As of
https://chromium.googlesource.com/chromium/src/+/00a0654929787f70b0cd81f30aa14e81c5e11b2f,
crashpad_util_test is able to run in Chromium. It uses Chromium’s own
base::TestLauncher rather than gtest’s RUN_ALL_TESTS() for proper
integration with Swarming.
Launching WinMultiprocess test children out of the same test executable
via WinChildProcess is not compatible with Chromium’s parallel, shardy,
Swarmy test launcher. When running these children, the standard gtest
RUN_ALL_TESTS() launcher will now be used, even in Chromium.
Two tests disabled in Chromium are now enabled:
ExceptionHandlerServerTest.MultipleConnections and
ScopedProcessSuspend.ScopedProcessSuspend.
As part of this work, I discovered that disabled tests chosen to run via
--gtest_also_run_disabled_tests did not actually work for
WinMultiprocess-based tests, because gtest’s test launcher would refuse
to run the child side of the test, believing it was disabled. This is
fixed by always supplying --gtest_also_run_disabled_tests to
WinChildProcess children, on the basis that if the parent is managing to
run and it’s disabled, disabled tests must actually be enabled.
Bug: crashpad:205
Change-Id: Ied22f16b9329ee13b6b07fd29de704f6fe2a058e
Reviewed-on: https://chromium-review.googlesource.com/742462
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-27 17:41:32 -04:00
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
|
// Chromium’s test launcher interferes with WinMultiprocess-based tests. Allow
|
|
|
|
|
// their child processes to be launched by the standard gtest-based test
|
|
|
|
|
// runner.
|
|
|
|
|
const bool use_chromium_test_launcher =
|
|
|
|
|
!crashpad::test::WinChildProcess::IsChildProcess();
|
|
|
|
|
#else // OS_WIN
|
|
|
|
|
constexpr bool use_chromium_test_launcher = true;
|
|
|
|
|
#endif // OS_WIN
|
2017-10-27 16:06:32 -04:00
|
|
|
|
|
Un-disable WinMultiprocess-based tests in Chromium
As of
https://chromium.googlesource.com/chromium/src/+/00a0654929787f70b0cd81f30aa14e81c5e11b2f,
crashpad_util_test is able to run in Chromium. It uses Chromium’s own
base::TestLauncher rather than gtest’s RUN_ALL_TESTS() for proper
integration with Swarming.
Launching WinMultiprocess test children out of the same test executable
via WinChildProcess is not compatible with Chromium’s parallel, shardy,
Swarmy test launcher. When running these children, the standard gtest
RUN_ALL_TESTS() launcher will now be used, even in Chromium.
Two tests disabled in Chromium are now enabled:
ExceptionHandlerServerTest.MultipleConnections and
ScopedProcessSuspend.ScopedProcessSuspend.
As part of this work, I discovered that disabled tests chosen to run via
--gtest_also_run_disabled_tests did not actually work for
WinMultiprocess-based tests, because gtest’s test launcher would refuse
to run the child side of the test, believing it was disabled. This is
fixed by always supplying --gtest_also_run_disabled_tests to
WinChildProcess children, on the basis that if the parent is managing to
run and it’s disabled, disabled tests must actually be enabled.
Bug: crashpad:205
Change-Id: Ied22f16b9329ee13b6b07fd29de704f6fe2a058e
Reviewed-on: https://chromium-review.googlesource.com/742462
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-27 17:41:32 -04:00
|
|
|
|
if (use_chromium_test_launcher) {
|
|
|
|
|
// 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)));
|
|
|
|
|
}
|
2017-10-27 16:06:32 -04:00
|
|
|
|
|
|
|
|
|
#endif // CRASHPAD_IN_CHROMIUM
|
Un-disable WinMultiprocess-based tests in Chromium
As of
https://chromium.googlesource.com/chromium/src/+/00a0654929787f70b0cd81f30aa14e81c5e11b2f,
crashpad_util_test is able to run in Chromium. It uses Chromium’s own
base::TestLauncher rather than gtest’s RUN_ALL_TESTS() for proper
integration with Swarming.
Launching WinMultiprocess test children out of the same test executable
via WinChildProcess is not compatible with Chromium’s parallel, shardy,
Swarmy test launcher. When running these children, the standard gtest
RUN_ALL_TESTS() launcher will now be used, even in Chromium.
Two tests disabled in Chromium are now enabled:
ExceptionHandlerServerTest.MultipleConnections and
ScopedProcessSuspend.ScopedProcessSuspend.
As part of this work, I discovered that disabled tests chosen to run via
--gtest_also_run_disabled_tests did not actually work for
WinMultiprocess-based tests, because gtest’s test launcher would refuse
to run the child side of the test, believing it was disabled. This is
fixed by always supplying --gtest_also_run_disabled_tests to
WinChildProcess children, on the basis that if the parent is managing to
run and it’s disabled, disabled tests must actually be enabled.
Bug: crashpad:205
Change-Id: Ied22f16b9329ee13b6b07fd29de704f6fe2a058e
Reviewed-on: https://chromium-review.googlesource.com/742462
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-27 17:41:32 -04:00
|
|
|
|
|
2017-10-30 23:55:51 -04:00
|
|
|
|
#if defined(CRASHPAD_TEST_LAUNCHER_GMOCK)
|
|
|
|
|
testing::InitGoogleMock(&argc, argv);
|
|
|
|
|
#elif defined(CRASHPAD_TEST_LAUNCHER_GTEST)
|
|
|
|
|
testing::InitGoogleTest(&argc, argv);
|
|
|
|
|
#else // CRASHPAD_TEST_LAUNCHER_GMOCK
|
|
|
|
|
#error #define CRASHPAD_TEST_LAUNCHER_GTEST or CRASHPAD_TEST_LAUNCHER_GMOCK
|
|
|
|
|
#endif // CRASHPAD_TEST_LAUNCHER_GMOCK
|
|
|
|
|
|
Un-disable WinMultiprocess-based tests in Chromium
As of
https://chromium.googlesource.com/chromium/src/+/00a0654929787f70b0cd81f30aa14e81c5e11b2f,
crashpad_util_test is able to run in Chromium. It uses Chromium’s own
base::TestLauncher rather than gtest’s RUN_ALL_TESTS() for proper
integration with Swarming.
Launching WinMultiprocess test children out of the same test executable
via WinChildProcess is not compatible with Chromium’s parallel, shardy,
Swarmy test launcher. When running these children, the standard gtest
RUN_ALL_TESTS() launcher will now be used, even in Chromium.
Two tests disabled in Chromium are now enabled:
ExceptionHandlerServerTest.MultipleConnections and
ScopedProcessSuspend.ScopedProcessSuspend.
As part of this work, I discovered that disabled tests chosen to run via
--gtest_also_run_disabled_tests did not actually work for
WinMultiprocess-based tests, because gtest’s test launcher would refuse
to run the child side of the test, believing it was disabled. This is
fixed by always supplying --gtest_also_run_disabled_tests to
WinChildProcess children, on the basis that if the parent is managing to
run and it’s disabled, disabled tests must actually be enabled.
Bug: crashpad:205
Change-Id: Ied22f16b9329ee13b6b07fd29de704f6fe2a058e
Reviewed-on: https://chromium-review.googlesource.com/742462
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-10-27 17:41:32 -04:00
|
|
|
|
return RUN_ALL_TESTS();
|
2017-03-18 00:18:20 -04:00
|
|
|
|
}
|