summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.bazel2
-rw-r--r--WORKSPACE7
-rw-r--r--docs/quickstart-bazel.md14
-rw-r--r--googlemock/include/gmock/internal/gmock-port.h12
-rw-r--r--googlemock/test/BUILD.bazel1
-rw-r--r--googletest/src/gtest.cc8
-rw-r--r--googletest/test/BUILD.bazel1
-rwxr-xr-xgoogletest/test/googletest-catch-exceptions-test.py10
-rw-r--r--googletest/test/googletest-output-test-golden-lin.txt20
-rw-r--r--googletest/test/googletest-output-test_.cc8
10 files changed, 44 insertions, 39 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index 153a348b..3b25878a 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -30,8 +30,6 @@
#
# Bazel Build for Google C++ Testing Framework(Google Test)
-load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
-
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
diff --git a/WORKSPACE b/WORKSPACE
index 9fd96bb8..7eb18eb9 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -10,13 +10,6 @@ http_archive(
)
http_archive(
- name = "rules_cc",
- sha256 = "1e19e9a3bc3d4ee91d7fcad00653485ee6c798efbbf9588d40b34cbfbded143d",
- strip_prefix = "rules_cc-68cb652a71e7e7e2858c50593e5a9e3b94e5b9a9",
- urls = ["https://github.com/bazelbuild/rules_cc/archive/68cb652a71e7e7e2858c50593e5a9e3b94e5b9a9.zip"], # 2021-05-14T14:51:14Z
-)
-
-http_archive(
name = "rules_python",
sha256 = "98b3c592faea9636ac8444bfd9de7f3fb4c60590932d6e6ac5946e3f8dbd5ff6",
strip_prefix = "rules_python-ed6cc8f2c3692a6a7f013ff8bc185ba77eb9b4d2",
diff --git a/docs/quickstart-bazel.md b/docs/quickstart-bazel.md
index 362ee6d0..3a63a270 100644
--- a/docs/quickstart-bazel.md
+++ b/docs/quickstart-bazel.md
@@ -62,18 +62,6 @@ as a ZIP archive from GitHub. In the above example,
GoogleTest version to use; we recommend updating the hash often to point to the
latest version.
-Bazel also needs a dependency on the
-[`rules_cc` repository](https://github.com/bazelbuild/rules_cc) to build C++
-code, so add the following to the `WORKSPACE` file:
-
-```
-http_archive(
- name = "rules_cc",
- urls = ["https://github.com/bazelbuild/rules_cc/archive/40548a2974f1aea06215272d9c2b47a14a24e556.zip"],
- strip_prefix = "rules_cc-40548a2974f1aea06215272d9c2b47a14a24e556",
-)
-```
-
Now you're ready to build C++ code that uses GoogleTest.
## Create and run a binary
@@ -104,8 +92,6 @@ To build the code, create a file named `BUILD` in the same directory with the
following contents:
```
-load("@rules_cc//cc:defs.bzl", "cc_test")
-
cc_test(
name = "hello_test",
size = "small",
diff --git a/googlemock/include/gmock/internal/gmock-port.h b/googlemock/include/gmock/internal/gmock-port.h
index 7ec07302..5d3e0e59 100644
--- a/googlemock/include/gmock/internal/gmock-port.h
+++ b/googlemock/include/gmock/internal/gmock-port.h
@@ -70,29 +70,29 @@
#define GMOCK_DECLARE_bool_(name) \
namespace testing { \
GTEST_API_ extern bool GMOCK_FLAG(name); \
- }
+ } static_assert(true, "no-op to require trailing semicolon")
#define GMOCK_DECLARE_int32_(name) \
namespace testing { \
GTEST_API_ extern int32_t GMOCK_FLAG(name); \
- }
+ } static_assert(true, "no-op to require trailing semicolon")
#define GMOCK_DECLARE_string_(name) \
namespace testing { \
GTEST_API_ extern ::std::string GMOCK_FLAG(name); \
- }
+ } static_assert(true, "no-op to require trailing semicolon")
// Macros for defining flags.
#define GMOCK_DEFINE_bool_(name, default_val, doc) \
namespace testing { \
GTEST_API_ bool GMOCK_FLAG(name) = (default_val); \
- }
+ } static_assert(true, "no-op to require trailing semicolon")
#define GMOCK_DEFINE_int32_(name, default_val, doc) \
namespace testing { \
GTEST_API_ int32_t GMOCK_FLAG(name) = (default_val); \
- }
+ } static_assert(true, "no-op to require trailing semicolon")
#define GMOCK_DEFINE_string_(name, default_val, doc) \
namespace testing { \
GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val); \
- }
+ } static_assert(true, "no-op to require trailing semicolon")
#endif // !defined(GMOCK_DECLARE_bool_)
#if !defined(GMOCK_FLAG_GET)
diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel
index 6193ed4d..004da12a 100644
--- a/googlemock/test/BUILD.bazel
+++ b/googlemock/test/BUILD.bazel
@@ -30,7 +30,6 @@
#
# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock
-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
licenses(["notice"])
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index ece08817..44d5d5bf 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -3033,10 +3033,16 @@ void TestSuite::Run() {
internal::HandleExceptionsInMethodIfSupported(
this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()");
+ const bool skip_all = ad_hoc_test_result().Failed();
+
start_timestamp_ = internal::GetTimeInMillis();
internal::Timer timer;
for (int i = 0; i < total_test_count(); i++) {
- GetMutableTestInfo(i)->Run();
+ if (skip_all) {
+ GetMutableTestInfo(i)->Skip();
+ } else {
+ GetMutableTestInfo(i)->Run();
+ }
if (GTEST_FLAG_GET(fail_fast) &&
GetMutableTestInfo(i)->result()->Failed()) {
for (int j = i + 1; j < total_test_count(); j++) {
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel
index 7b78555e..8fd595c7 100644
--- a/googletest/test/BUILD.bazel
+++ b/googletest/test/BUILD.bazel
@@ -30,7 +30,6 @@
#
# Bazel BUILD for The Google C++ Testing Framework (Google Test)
-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
licenses(["notice"])
diff --git a/googletest/test/googletest-catch-exceptions-test.py b/googletest/test/googletest-catch-exceptions-test.py
index 94a5b33f..442397a4 100755
--- a/googletest/test/googletest-catch-exceptions-test.py
+++ b/googletest/test/googletest-catch-exceptions-test.py
@@ -147,19 +147,19 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
self.assertTrue(
'CxxExceptionInConstructorTest::TearDownTestSuite() '
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
- self.assertTrue(
+ self.assertFalse(
'CxxExceptionInSetUpTestSuiteTest constructor '
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
- self.assertTrue(
+ self.assertFalse(
'CxxExceptionInSetUpTestSuiteTest destructor '
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
- self.assertTrue(
+ self.assertFalse(
'CxxExceptionInSetUpTestSuiteTest::SetUp() '
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
- self.assertTrue(
+ self.assertFalse(
'CxxExceptionInSetUpTestSuiteTest::TearDown() '
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
- self.assertTrue(
+ self.assertFalse(
'CxxExceptionInSetUpTestSuiteTest test body '
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
diff --git a/googletest/test/googletest-output-test-golden-lin.txt b/googletest/test/googletest-output-test-golden-lin.txt
index 3fab3b97..1f24fb79 100644
--- a/googletest/test/googletest-output-test-golden-lin.txt
+++ b/googletest/test/googletest-output-test-golden-lin.txt
@@ -12,7 +12,7 @@ Expected equality of these values:
3
Stack trace: (omitted)
-[==========] Running 88 tests from 41 test suites.
+[==========] Running 89 tests from 42 test suites.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
@@ -956,6 +956,17 @@ Stack trace: (omitted)
~DynamicFixture()
[ FAILED ] BadDynamicFixture2.Derived
DynamicFixture::TearDownTestSuite
+[----------] 1 test from TestSuiteThatFailsToSetUp
+googletest-output-test_.cc:#: Failure
+Value of: false
+ Actual: false
+Expected: true
+Stack trace: (omitted)
+
+[ RUN ] TestSuiteThatFailsToSetUp.ShouldNotRun
+googletest-output-test_.cc:#: Skipped
+
+[ SKIPPED ] TestSuiteThatFailsToSetUp.ShouldNotRun
[----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
googletest-output-test_.cc:#: Failure
@@ -1032,8 +1043,10 @@ Failed
Expected fatal failure.
Stack trace: (omitted)
-[==========] 88 tests from 41 test suites ran.
+[==========] 89 tests from 42 test suites ran.
[ PASSED ] 31 tests.
+[ SKIPPED ] 1 test, listed below:
+[ SKIPPED ] TestSuiteThatFailsToSetUp.ShouldNotRun
[ FAILED ] 57 tests, listed below:
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ FAILED ] NonfatalFailureTest.DiffForLongStrings
@@ -1094,6 +1107,9 @@ Stack trace: (omitted)
[ FAILED ] GoogleTestVerification.UninstantiatedTypeParameterizedTestSuite<DetectNotInstantiatedTypesTest>
57 FAILED TESTS
+[ FAILED ] TestSuiteThatFailsToSetUp: SetUpTestSuite or TearDownTestSuite
+
+ 1 FAILED TEST SUITE
 YOU HAVE 1 DISABLED TEST
Note: Google Test filter = FatalFailureTest.*:LoggingTest.*
diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc
index 9e5465c9..b0ad52ca 100644
--- a/googletest/test/googletest-output-test_.cc
+++ b/googletest/test/googletest-output-test_.cc
@@ -1060,6 +1060,14 @@ class BarEnvironment : public testing::Environment {
}
};
+class TestSuiteThatFailsToSetUp : public testing::Test {
+ public:
+ static void SetUpTestSuite() { EXPECT_TRUE(false); }
+};
+TEST_F(TestSuiteThatFailsToSetUp, ShouldNotRun) {
+ std::abort();
+}
+
// The main function.
//
// The idea is to use Google Test to run all the tests we have defined (some