From f63e2a14a21aa0528e692d2d5ce1d8e53dfa5742 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 1 Aug 2017 14:36:29 -0400 Subject: WIP --- .gitignore | 2 + BUILD.bazel | 292 ++++++++++++++++++++++++++++++++ WORKSPACE | 1 + googletest/samples/sample10_unittest.cc | 3 +- googletest/samples/sample1_unittest.cc | 9 +- googletest/samples/sample2_unittest.cc | 3 +- googletest/samples/sample3_unittest.cc | 8 +- googletest/samples/sample4_unittest.cc | 3 +- googletest/samples/sample5_unittest.cc | 4 +- googletest/samples/sample6_unittest.cc | 3 +- googletest/samples/sample7_unittest.cc | 20 +-- googletest/samples/sample8_unittest.cc | 3 +- googletest/samples/sample9_unittest.cc | 3 +- 13 files changed, 326 insertions(+), 28 deletions(-) create mode 100644 BUILD.bazel create mode 100644 WORKSPACE diff --git a/.gitignore b/.gitignore index 74e7466..6c1b18f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ # Ignore CI build directory build/ xcuserdata +cmake-build-debug/ +.idea/ diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..50a6aca --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,292 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +config_setting( + name = "win", + values = {"cpu": "x64_windows_msvc"}, +) + +cc_library( + name = "gmock", + srcs = glob( + include = [ + "googlemock/src/*.cc", + "googlemock/include/gmock/**/*.h", + ], + exclude = [ + "googlemock/src/gmock-all.cc", + ], + ), + hdrs = glob([ + "googlemock/include/gmock/*.h", + ]), + includes = [ + "googlemock", + "googlemock/include", + ], + linkopts = select({ + ":win": [], + "//conditions:default": ["-pthread"], + }), + deps = [ + ":gtest", + ], +) + +cc_library( + name = "gtest", + srcs = glob( + include = [ + "googletest/src/*.cc", + "googletest/src/*.h", + "googletest/include/gtest/**/*.h", + ], + exclude = [ + "googletest/src/gtest-all.cc", + "googletest/src/gtest_main.cc", + ], + ), + hdrs = glob([ + "googletest/include/gtest/*.h", + ]), + copts = select( + { + ":win": [], + "//conditions:default": ["-pthread"], + }, + ), + includes = [ + "googletest", + "googletest/include", + ], + linkopts = select({ + ":win": [], + "//conditions:default": [ + "-pthread", + ], + }), +) + +cc_library( + name = "gtest_main", + srcs = glob( + include = [ + "googletest/src/gtest_main.cc", + ], + ), + hdrs = glob([ + "googletest/include/gtest/*.h", + "googletest/include/gtest/**/*.h", + ]), + includes = [ + "googletest", + "googletest/include", + ], + deps = [":gmock"], +) + +"""googletest own tests """ + +#on windows exclude gtest-tuple.h and gtest-tuple_test.cc +filegroup( + name = "win_only_test_files", + srcs = glob( + include = [ + "googletest/test/gtest-*.cc", + "googletest/test/*.h", + "googletest/include/gtest/**/*.h", + ], + exclude = [ + "googletest/src/gtest-unittest-api_test.cc", + "googletest/include/gtest/internal/gtest-tuple.h", + "googletest/test/gtest-tuple_test.cc", + "googletest/src/gtest-all.cc", + "googletest/test/gtest_all_test.cc", + "googletest/test/gtest-death-test_ex_test.cc", + "googletest/test/gtest-listener_test.cc", + "googletest/test/gtest-unittest-api_test.cc", + "googletest/test/gtest-param-test_test.cc", + ], + ), +) + +filegroup( + name = "default_test_files", + srcs = glob( + include = [ + "googletest/test/gtest-*.cc", + "googletest/test/*.h", + "googletest/include/gtest/**/*.h", + ], + exclude = [ + "googletest/src/gtest-unittest-api_test.cc", + "googletest/src/gtest-all.cc", + "googletest/test/gtest_all_test.cc", + "googletest/test/gtest-death-test_ex_test.cc", + "googletest/test/gtest-listener_test.cc", + "googletest/test/gtest-unittest-api_test.cc", + "googletest/test/gtest-param-test_test.cc", + ], + ), +) + +cc_test( + name = "gtest_all_test", + size = "small", + srcs = select({ + ":win": [":win_only_test_files"], + "//conditions:default": [":default_test_files"], + }), + copts = select({ + ":win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], + "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], + }), + includes = [ + "googletest", + "googletest/include", + "googletest/include/internal", + "googletest/test", + ], + linkopts = select({ + ":win": [], + "//conditions:default": [ + "-pthread", + ], + }), + deps = [":gtest_main"], +) + +""" these googletest tests have their own main()""" + +cc_test( + name = "gtest-death-test", + size = "small", + srcs = [ + "googletest/test/gtest-death-test_ex_test.cc", + ], + copts = [ + "-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1", + ], + deps = [ + ":gtest_main", + ], +) + +cc_test( + name = "gtest-listener_test", + size = "small", + srcs = [ + "googletest/test/gtest-listener_test.cc", + ], + deps = [ + ":gtest_main", + ], +) + +cc_test( + name = "gtest-unittest-api_test", + size = "small", + srcs = [ + "googletest/test/gtest-unittest-api_test.cc", + ], + deps = [ + ":gtest_main", + ], +) + +cc_test( + name = "gtest-param-test_test", + size = "small", + srcs = [ + "googletest/test/gtest-param-test2_test.cc", + "googletest/test/gtest-param-test_test.cc", + "googletest/test/gtest-param-test_test.h", + ], + deps = [ + ":gtest_main", + ], +) + +""" googletest samples""" + +cc_library( + name = "googletest_sample_lib", + srcs = [ + "googletest/samples/sample1.cc", + "googletest/samples/sample2.cc", + "googletest/samples/sample4.cc", + ], + hdrs = [ + "googletest/samples/prime_tables.h", + "googletest/samples/sample1.h", + "googletest/samples/sample2.h", + "googletest/samples/sample3-inl.h", + "googletest/samples/sample4.h", + ], + deps = ["gtest"], +) + +cc_test( + name = "googletest_samples", + size = "small", + srcs = glob( + include = [ + "googletest/samples/sample*.cc", + "googletest/samples/sample*.h", + ], + exclude = [ + "googletest/samples/sample1.cc", + "googletest/samples/sample2.cc", + "googletest/samples/sample4.cc", + "googletest/samples/prime_tables.h", + "googletest/samples/sample1.h", + "googletest/samples/sample2.h", + "googletest/samples/sample3-inl.h", + "googletest/samples/sample4.h", + "googletest/samples/sample9_unittest.cc", + "googletest/samples/sample10_unittest.cc", + ], + ), + includes = [ + "googletest/samples", + ], + deps = [ + ":googletest_sample_lib", + ":gtest_main", + ], +) + +""" googletest samples 9 and 10 have their own main()""" + +cc_test( + name = "googletest_sample9", + size = "small", + srcs = glob( + include = [ + "googletest/samples/sample9_unittest.cc", + ], + ), + includes = [ + "googletest/samples", + ], + deps = [ + ":gtest", + ], +) + +cc_test( + name = "googletest_sample10", + size = "small", + srcs = glob( + include = [ + "googletest/samples/sample10_unittest.cc", + ], + ), + includes = [ + "googletest/samples", + ], + deps = [ + ":gtest", + ], +) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..eb50f4e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1 @@ +workspace(name = "com_google_googletest") \ No newline at end of file diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc index 0051cd5..6ddb24b 100644 --- a/googletest/samples/sample10_unittest.cc +++ b/googletest/samples/sample10_unittest.cc @@ -35,7 +35,7 @@ #include #include "gtest/gtest.h" - +namespace { using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; @@ -142,3 +142,4 @@ int main(int argc, char **argv) { } return RUN_ALL_TESTS(); } +} // namespace \ No newline at end of file diff --git a/googletest/samples/sample1_unittest.cc b/googletest/samples/sample1_unittest.cc index aefc4f1..861eff9 100644 --- a/googletest/samples/sample1_unittest.cc +++ b/googletest/samples/sample1_unittest.cc @@ -46,7 +46,7 @@ #include #include "sample1.h" #include "gtest/gtest.h" - +namespace { // Step 2. Use the TEST macro to define your tests. // @@ -72,7 +72,6 @@ // // - // Tests Factorial(). // Tests factorial of negative numbers. @@ -100,9 +99,7 @@ TEST(FactorialTest, Negative) { } // Tests factorial of 0. -TEST(FactorialTest, Zero) { - EXPECT_EQ(1, Factorial(0)); -} +TEST(FactorialTest, Zero) { EXPECT_EQ(1, Factorial(0)); } // Tests factorial of positive numbers. TEST(FactorialTest, Positive) { @@ -112,7 +109,6 @@ TEST(FactorialTest, Positive) { EXPECT_EQ(40320, Factorial(8)); } - // Tests IsPrime() // Tests negative input. @@ -139,6 +135,7 @@ TEST(IsPrimeTest, Positive) { EXPECT_FALSE(IsPrime(6)); EXPECT_TRUE(IsPrime(23)); } +} // namespace // Step 3. Call RUN_ALL_TESTS() in main(). // diff --git a/googletest/samples/sample2_unittest.cc b/googletest/samples/sample2_unittest.cc index 4fa19b7..826f2d4 100644 --- a/googletest/samples/sample2_unittest.cc +++ b/googletest/samples/sample2_unittest.cc @@ -42,7 +42,7 @@ #include "sample2.h" #include "gtest/gtest.h" - +namespace { // In this example, we test the MyString class (a simple string). // Tests the default c'tor. @@ -107,3 +107,4 @@ TEST(MyString, Set) { s.Set(NULL); EXPECT_STREQ(NULL, s.c_string()); } +} // namespace \ No newline at end of file diff --git a/googletest/samples/sample3_unittest.cc b/googletest/samples/sample3_unittest.cc index bf3877d..18da0b3 100644 --- a/googletest/samples/sample3_unittest.cc +++ b/googletest/samples/sample3_unittest.cc @@ -67,7 +67,7 @@ #include "gtest/gtest.h" // To use a test fixture, derive a class from testing::Test. -class QueueTest : public testing::Test { +class QueueTestSmpl3 : public testing::Test { protected: // You should make the members protected s.t. they can be // accessed from sub-classes. @@ -120,13 +120,13 @@ class QueueTest : public testing::Test { // instead of TEST. // Tests the default c'tor. -TEST_F(QueueTest, DefaultConstructor) { +TEST_F(QueueTestSmpl3, DefaultConstructor) { // You can access data in the test fixture here. EXPECT_EQ(0u, q0_.Size()); } // Tests Dequeue(). -TEST_F(QueueTest, Dequeue) { +TEST_F(QueueTestSmpl3, Dequeue) { int * n = q0_.Dequeue(); EXPECT_TRUE(n == NULL); @@ -144,7 +144,7 @@ TEST_F(QueueTest, Dequeue) { } // Tests the Queue::Map() function. -TEST_F(QueueTest, Map) { +TEST_F(QueueTestSmpl3, Map) { MapTester(&q0_); MapTester(&q1_); MapTester(&q2_); diff --git a/googletest/samples/sample4_unittest.cc b/googletest/samples/sample4_unittest.cc index fa5afc7..2d13a8b 100644 --- a/googletest/samples/sample4_unittest.cc +++ b/googletest/samples/sample4_unittest.cc @@ -31,7 +31,7 @@ #include "gtest/gtest.h" #include "sample4.h" - +namespace { // Tests the Increment() method. TEST(Counter, Increment) { Counter c; @@ -43,3 +43,4 @@ TEST(Counter, Increment) { EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); } +} // namespace \ No newline at end of file diff --git a/googletest/samples/sample5_unittest.cc b/googletest/samples/sample5_unittest.cc index 43d8e57..3099930 100644 --- a/googletest/samples/sample5_unittest.cc +++ b/googletest/samples/sample5_unittest.cc @@ -49,7 +49,7 @@ #include "sample3-inl.h" #include "gtest/gtest.h" #include "sample1.h" - +namespace { // In this sample, we want to ensure that every test finishes within // ~5 seconds. If a test takes longer to run, we consider it a // failure. @@ -191,7 +191,7 @@ TEST_F(QueueTest, Dequeue) { EXPECT_EQ(1u, q2_.Size()); delete n; } - +} // namespace // If necessary, you can derive further test fixtures from a derived // fixture itself. For example, you can derive another fixture from // QueueTest. Google Test imposes no limit on how deep the hierarchy diff --git a/googletest/samples/sample6_unittest.cc b/googletest/samples/sample6_unittest.cc index 8f2036a..7b603a2 100644 --- a/googletest/samples/sample6_unittest.cc +++ b/googletest/samples/sample6_unittest.cc @@ -36,7 +36,7 @@ #include "prime_tables.h" #include "gtest/gtest.h" - +namespace { // First, we define some factory functions for creating instances of // the implementations. You may be able to skip this step if all your // implementations can be constructed the same way. @@ -222,3 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name PrimeTableImplementations); // Type list #endif // GTEST_HAS_TYPED_TEST_P +} // namespace \ No newline at end of file diff --git a/googletest/samples/sample7_unittest.cc b/googletest/samples/sample7_unittest.cc index 1b651a2..44f534b 100644 --- a/googletest/samples/sample7_unittest.cc +++ b/googletest/samples/sample7_unittest.cc @@ -39,7 +39,7 @@ #include "prime_tables.h" #include "gtest/gtest.h" - +namespace { #if GTEST_HAS_PARAM_TEST using ::testing::TestWithParam; @@ -65,9 +65,9 @@ PrimeTable* CreatePreCalculatedPrimeTable() { // can refer to the test parameter by GetParam(). In this case, the test // parameter is a factory function which we call in fixture's SetUp() to // create and store an instance of PrimeTable. -class PrimeTableTest : public TestWithParam { +class PrimeTableTestSmpl7 : public TestWithParam { public: - virtual ~PrimeTableTest() { delete table_; } + virtual ~PrimeTableTestSmpl7() { delete table_; } virtual void SetUp() { table_ = (*GetParam())(); } virtual void TearDown() { delete table_; @@ -78,7 +78,7 @@ class PrimeTableTest : public TestWithParam { PrimeTable* table_; }; -TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { +TEST_P(PrimeTableTestSmpl7, ReturnsFalseForNonPrimes) { EXPECT_FALSE(table_->IsPrime(-5)); EXPECT_FALSE(table_->IsPrime(0)); EXPECT_FALSE(table_->IsPrime(1)); @@ -87,7 +87,7 @@ TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { EXPECT_FALSE(table_->IsPrime(100)); } -TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { +TEST_P(PrimeTableTestSmpl7, ReturnsTrueForPrimes) { EXPECT_TRUE(table_->IsPrime(2)); EXPECT_TRUE(table_->IsPrime(3)); EXPECT_TRUE(table_->IsPrime(5)); @@ -96,7 +96,7 @@ TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { EXPECT_TRUE(table_->IsPrime(131)); } -TEST_P(PrimeTableTest, CanGetNextPrime) { +TEST_P(PrimeTableTestSmpl7, CanGetNextPrime) { EXPECT_EQ(2, table_->GetNextPrime(0)); EXPECT_EQ(3, table_->GetNextPrime(2)); EXPECT_EQ(5, table_->GetNextPrime(3)); @@ -112,10 +112,9 @@ TEST_P(PrimeTableTest, CanGetNextPrime) { // // Here, we instantiate our tests with a list of two PrimeTable object // factory functions: -INSTANTIATE_TEST_CASE_P( - OnTheFlyAndPreCalculated, - PrimeTableTest, - Values(&CreateOnTheFlyPrimeTable, &CreatePreCalculatedPrimeTable<1000>)); +INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7, + Values(&CreateOnTheFlyPrimeTable, + &CreatePreCalculatedPrimeTable<1000>)); #else @@ -128,3 +127,4 @@ INSTANTIATE_TEST_CASE_P( TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {} #endif // GTEST_HAS_PARAM_TEST +} \ No newline at end of file diff --git a/googletest/samples/sample8_unittest.cc b/googletest/samples/sample8_unittest.cc index 7274334..4ce9667 100644 --- a/googletest/samples/sample8_unittest.cc +++ b/googletest/samples/sample8_unittest.cc @@ -37,7 +37,7 @@ #include "prime_tables.h" #include "gtest/gtest.h" - +namespace { #if GTEST_HAS_COMBINE // Suppose we want to introduce a new, improved implementation of PrimeTable @@ -171,3 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} #endif // GTEST_HAS_COMBINE +} \ No newline at end of file diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc index b2e2079..87ddca7 100644 --- a/googletest/samples/sample9_unittest.cc +++ b/googletest/samples/sample9_unittest.cc @@ -35,7 +35,7 @@ #include #include "gtest/gtest.h" - +namespace { using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; @@ -158,3 +158,4 @@ int main(int argc, char **argv) { return ret_val; } +} // namespace \ No newline at end of file -- cgit v0.12 From b3edada2907032f15b1a61e6a49f4e3ece091888 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 1 Aug 2017 14:50:59 -0400 Subject: WIP --- .gitignore | 5 +++++ BUILD.bazel | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6c1b18f..da68162 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ build/ xcuserdata cmake-build-debug/ .idea/ +bazel-bin +bazel-genfiles +bazel-googletest +bazel-out +bazel-testlogs diff --git a/BUILD.bazel b/BUILD.bazel index 50a6aca..aa53a13 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -86,7 +86,7 @@ cc_library( deps = [":gmock"], ) -"""googletest own tests """ +"""gtest own tests """ #on windows exclude gtest-tuple.h and gtest-tuple_test.cc filegroup( @@ -211,7 +211,7 @@ cc_test( """ googletest samples""" cc_library( - name = "googletest_sample_lib", + name = "gtest_sample_lib", srcs = [ "googletest/samples/sample1.cc", "googletest/samples/sample2.cc", @@ -228,7 +228,7 @@ cc_library( ) cc_test( - name = "googletest_samples", + name = "gtest_samples", size = "small", srcs = glob( include = [ @@ -252,7 +252,7 @@ cc_test( "googletest/samples", ], deps = [ - ":googletest_sample_lib", + ":gtest_sample_lib", ":gtest_main", ], ) @@ -260,7 +260,7 @@ cc_test( """ googletest samples 9 and 10 have their own main()""" cc_test( - name = "googletest_sample9", + name = "gtest_sample9", size = "small", srcs = glob( include = [ @@ -271,12 +271,12 @@ cc_test( "googletest/samples", ], deps = [ - ":gtest", + ":gtest_main", ], ) cc_test( - name = "googletest_sample10", + name = "gtest_sample10", size = "small", srcs = glob( include = [ @@ -287,6 +287,6 @@ cc_test( "googletest/samples", ], deps = [ - ":gtest", + ":gtest_main", ], ) -- cgit v0.12 From 6615f7df11c812ed15d0be13a4d4c92aaee26dfb Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 2 Aug 2017 14:36:39 -0400 Subject: WIP --- BUILD.bazel | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index aa53a13..4977d1b 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -86,7 +86,7 @@ cc_library( deps = [":gmock"], ) -"""gtest own tests """ +""" gtest own tests """ #on windows exclude gtest-tuple.h and gtest-tuple_test.cc filegroup( @@ -157,8 +157,7 @@ cc_test( deps = [":gtest_main"], ) -""" these googletest tests have their own main()""" - +#These googletest tests have their own main() cc_test( name = "gtest-death-test", size = "small", @@ -208,8 +207,7 @@ cc_test( ], ) -""" googletest samples""" - +# The following rules build samples of how to use gTest. cc_library( name = "gtest_sample_lib", srcs = [ @@ -224,41 +222,35 @@ cc_library( "googletest/samples/sample3-inl.h", "googletest/samples/sample4.h", ], - deps = ["gtest"], ) cc_test( name = "gtest_samples", size = "small", srcs = glob( + # All Samples here except + # Sample9 is designed to fail on purpose + # Sample10 can be run with --check_for_leaks command line flag, should be separate include = [ - "googletest/samples/sample*.cc", - "googletest/samples/sample*.h", - ], - exclude = [ - "googletest/samples/sample1.cc", - "googletest/samples/sample2.cc", - "googletest/samples/sample4.cc", - "googletest/samples/prime_tables.h", - "googletest/samples/sample1.h", - "googletest/samples/sample2.h", - "googletest/samples/sample3-inl.h", - "googletest/samples/sample4.h", - "googletest/samples/sample9_unittest.cc", - "googletest/samples/sample10_unittest.cc", + "googletest/samples/sample1_unitest.cc", + "googletest/samples/sample2_unitest.cc", + "googletest/samples/sample3_unitest.cc", + "googletest/samples/sample4_unitest.cc", + "googletest/samples/sample5_unitest.cc", + "googletest/samples/sample6_unitest.cc", + "googletest/samples/sample7_unitest.cc", + "googletest/samples/sample8_unitest.cc", ], ), includes = [ "googletest/samples", ], deps = [ - ":gtest_sample_lib", ":gtest_main", + ":gtest_sample_lib", ], ) -""" googletest samples 9 and 10 have their own main()""" - cc_test( name = "gtest_sample9", size = "small", -- cgit v0.12 From aa31cb67c2a9db4e6a93839bc2a29fe45e1dbd73 Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 2 Aug 2017 15:40:14 -0400 Subject: WIP --- BUILD.bazel | 56 ++++++++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 4977d1b..9922e8f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -207,6 +207,7 @@ cc_test( ], ) + # The following rules build samples of how to use gTest. cc_library( name = "gtest_sample_lib", @@ -228,57 +229,40 @@ cc_test( name = "gtest_samples", size = "small", srcs = glob( - # All Samples here except - # Sample9 is designed to fail on purpose - # Sample10 can be run with --check_for_leaks command line flag, should be separate include = [ - "googletest/samples/sample1_unitest.cc", - "googletest/samples/sample2_unitest.cc", - "googletest/samples/sample3_unitest.cc", - "googletest/samples/sample4_unitest.cc", - "googletest/samples/sample5_unitest.cc", - "googletest/samples/sample6_unitest.cc", - "googletest/samples/sample7_unitest.cc", - "googletest/samples/sample8_unitest.cc", + #All Samples here except: + #sample9 designed to fail + #sample10 takes a command line option and needs to be separate + "googletest/samples/sample1_unittest.cc", + "googletest/samples/sample2_unittest.cc", + "googletest/samples/sample3_unittest.cc", + "googletest/samples/sample4_unittest.cc", + "googletest/samples/sample5_unittest.cc", + "googletest/samples/sample6_unittest.cc", + "googletest/samples/sample7_unittest.cc", + "googletest/samples/sample8_unittest.cc", ], ), - includes = [ - "googletest/samples", - ], deps = [ + "gtest_sample_lib", ":gtest_main", - ":gtest_sample_lib", ], ) cc_test( - name = "gtest_sample9", + name = "sample9_unittest", size = "small", - srcs = glob( - include = [ - "googletest/samples/sample9_unittest.cc", - ], - ), - includes = [ - "googletest/samples", - ], - deps = [ - ":gtest_main", - ], + srcs = ["googletest/samples/sample9_unittest.cc"], + deps = [":gtest_main"], ) cc_test( - name = "gtest_sample10", + name = "sample10_unittest", size = "small", - srcs = glob( - include = [ - "googletest/samples/sample10_unittest.cc", - ], - ), - includes = [ - "googletest/samples", - ], + srcs = ["googletest/samples/sample10_unittest.cc"], deps = [ ":gtest_main", ], ) + + -- cgit v0.12 From 52a9c14c48ed8f3c68d1d10e53a5be761a901a17 Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 7 Aug 2017 13:20:57 -0400 Subject: Samples changes upstreaming --- googletest/samples/sample10_unittest.cc | 6 +----- googletest/samples/sample1_unittest.cc | 6 +++++- googletest/samples/sample2_unittest.cc | 2 +- googletest/samples/sample3_unittest.cc | 3 ++- googletest/samples/sample4_unittest.cc | 2 +- googletest/samples/sample6_unittest.cc | 2 +- googletest/samples/sample7_unittest.cc | 2 +- googletest/samples/sample8_unittest.cc | 2 +- googletest/samples/sample9_unittest.cc | 8 ++------ 9 files changed, 15 insertions(+), 18 deletions(-) diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc index 6ddb24b..4c4dcf8 100644 --- a/googletest/samples/sample10_unittest.cc +++ b/googletest/samples/sample10_unittest.cc @@ -34,8 +34,7 @@ #include #include -#include "gtest/gtest.h" -namespace { +#include "third_party/gtest/include/gtest/gtest.h" using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; @@ -46,7 +45,6 @@ using ::testing::TestPartResult; using ::testing::UnitTest; namespace { - // We will track memory used by this class. class Water { public: @@ -106,7 +104,6 @@ TEST(ListenersTest, LeaksWater) { Water* water = new Water; EXPECT_TRUE(water != NULL); } - } // namespace int main(int argc, char **argv) { @@ -142,4 +139,3 @@ int main(int argc, char **argv) { } return RUN_ALL_TESTS(); } -} // namespace \ No newline at end of file diff --git a/googletest/samples/sample1_unittest.cc b/googletest/samples/sample1_unittest.cc index 861eff9..8376bb4 100644 --- a/googletest/samples/sample1_unittest.cc +++ b/googletest/samples/sample1_unittest.cc @@ -72,6 +72,7 @@ namespace { // // + // Tests Factorial(). // Tests factorial of negative numbers. @@ -99,7 +100,9 @@ TEST(FactorialTest, Negative) { } // Tests factorial of 0. -TEST(FactorialTest, Zero) { EXPECT_EQ(1, Factorial(0)); } +TEST(FactorialTest, Zero) { + EXPECT_EQ(1, Factorial(0)); +} // Tests factorial of positive numbers. TEST(FactorialTest, Positive) { @@ -109,6 +112,7 @@ TEST(FactorialTest, Positive) { EXPECT_EQ(40320, Factorial(8)); } + // Tests IsPrime() // Tests negative input. diff --git a/googletest/samples/sample2_unittest.cc b/googletest/samples/sample2_unittest.cc index 826f2d4..df522da 100644 --- a/googletest/samples/sample2_unittest.cc +++ b/googletest/samples/sample2_unittest.cc @@ -107,4 +107,4 @@ TEST(MyString, Set) { s.Set(NULL); EXPECT_STREQ(NULL, s.c_string()); } -} // namespace \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample3_unittest.cc b/googletest/samples/sample3_unittest.cc index 18da0b3..b2f4924 100644 --- a/googletest/samples/sample3_unittest.cc +++ b/googletest/samples/sample3_unittest.cc @@ -65,7 +65,7 @@ #include "sample3-inl.h" #include "gtest/gtest.h" - +namespace{ // To use a test fixture, derive a class from testing::Test. class QueueTestSmpl3 : public testing::Test { protected: // You should make the members protected s.t. they can be @@ -149,3 +149,4 @@ TEST_F(QueueTestSmpl3, Map) { MapTester(&q1_); MapTester(&q2_); } +} // namespace diff --git a/googletest/samples/sample4_unittest.cc b/googletest/samples/sample4_unittest.cc index 2d13a8b..948266e 100644 --- a/googletest/samples/sample4_unittest.cc +++ b/googletest/samples/sample4_unittest.cc @@ -43,4 +43,4 @@ TEST(Counter, Increment) { EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); } -} // namespace \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample6_unittest.cc b/googletest/samples/sample6_unittest.cc index 7b603a2..1faf0c3 100644 --- a/googletest/samples/sample6_unittest.cc +++ b/googletest/samples/sample6_unittest.cc @@ -222,4 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name PrimeTableImplementations); // Type list #endif // GTEST_HAS_TYPED_TEST_P -} // namespace \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample7_unittest.cc b/googletest/samples/sample7_unittest.cc index 44f534b..b59e1d9 100644 --- a/googletest/samples/sample7_unittest.cc +++ b/googletest/samples/sample7_unittest.cc @@ -127,4 +127,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7, TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {} #endif // GTEST_HAS_PARAM_TEST -} \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample8_unittest.cc b/googletest/samples/sample8_unittest.cc index 4ce9667..b0ff2d1 100644 --- a/googletest/samples/sample8_unittest.cc +++ b/googletest/samples/sample8_unittest.cc @@ -171,4 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} #endif // GTEST_HAS_COMBINE -} \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc index 87ddca7..fb35a3a 100644 --- a/googletest/samples/sample9_unittest.cc +++ b/googletest/samples/sample9_unittest.cc @@ -34,8 +34,8 @@ #include -#include "gtest/gtest.h" -namespace { +#include "third_party/gtest/include/gtest/gtest.h" + using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; @@ -44,9 +44,7 @@ using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; using ::testing::UnitTest; - namespace { - // Provides alternative output mode which produces minimal amount of // information about tests. class TersePrinter : public EmptyTestEventListener { @@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) { EXPECT_EQ(1, 2) << "This test fails in order to demonstrate alternative failure messages"; } - } // namespace int main(int argc, char **argv) { @@ -158,4 +155,3 @@ int main(int argc, char **argv) { return ret_val; } -} // namespace \ No newline at end of file -- cgit v0.12 From aecea3842c3a0dbe74ac982b67a240e4cc466cf6 Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 7 Aug 2017 13:25:03 -0400 Subject: Samples changes upstreaming --- googletest/samples/sample10_unittest.cc | 2 +- googletest/samples/sample9_unittest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc index 4c4dcf8..977e5ff 100644 --- a/googletest/samples/sample10_unittest.cc +++ b/googletest/samples/sample10_unittest.cc @@ -34,7 +34,7 @@ #include #include -#include "third_party/gtest/include/gtest/gtest.h" +#include "gtest/gtest.h" using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc index fb35a3a..75584bb 100644 --- a/googletest/samples/sample9_unittest.cc +++ b/googletest/samples/sample9_unittest.cc @@ -34,7 +34,7 @@ #include -#include "third_party/gtest/include/gtest/gtest.h" +#include "gtest/gtest.h" using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; -- cgit v0.12 From 8815087cfa124b8b7f6e991189ec50a6bd439c83 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 8 Aug 2017 15:17:56 -0400 Subject: WIP --- BUILD.bazel | 202 +++++++++++++------------------------------- googletest/test/BUILD.bazel | 133 +++++++++++++++++++++++++++++ 2 files changed, 193 insertions(+), 142 deletions(-) create mode 100644 googletest/test/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel index 9922e8f..9731504 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,12 +1,13 @@ +# Copyright 2017 Google Inc. All Rights Reserved. +# Author: misterg@google.com (Gennadiy Civil) +# +# Description: +# Bazel BUILD file for googletest, initial revision +# package(default_visibility = ["//visibility:public"]) licenses(["notice"]) -config_setting( - name = "win", - values = {"cpu": "x64_windows_msvc"}, -) - cc_library( name = "gmock", srcs = glob( @@ -34,6 +35,18 @@ cc_library( ], ) +# gtest public API. +GTEST_HDRS = \ + glob([ + "googletest/include/gtest/*.h", + ]) + +config_setting( + name = "win", + values = {"cpu": "x64_windows_msvc"}, +) + +# Google Test cc_library( name = "gtest", srcs = glob( @@ -47,9 +60,7 @@ cc_library( "googletest/src/gtest_main.cc", ], ), - hdrs = glob([ - "googletest/include/gtest/*.h", - ]), + hdrs = GTEST_HDRS, copts = select( { ":win": [], @@ -68,85 +79,30 @@ cc_library( }), ) +## Google Test with exceptions enabled. cc_library( - name = "gtest_main", + name = "gtest_ex", srcs = glob( include = [ - "googletest/src/gtest_main.cc", - ], - ), - hdrs = glob([ - "googletest/include/gtest/*.h", - "googletest/include/gtest/**/*.h", - ]), - includes = [ - "googletest", - "googletest/include", - ], - deps = [":gmock"], -) - -""" gtest own tests """ - -#on windows exclude gtest-tuple.h and gtest-tuple_test.cc -filegroup( - name = "win_only_test_files", - srcs = glob( - include = [ - "googletest/test/gtest-*.cc", - "googletest/test/*.h", + "googletest/src/*.cc", + "googletest/src/*.h", "googletest/include/gtest/**/*.h", ], exclude = [ - "googletest/src/gtest-unittest-api_test.cc", - "googletest/include/gtest/internal/gtest-tuple.h", - "googletest/test/gtest-tuple_test.cc", "googletest/src/gtest-all.cc", - "googletest/test/gtest_all_test.cc", - "googletest/test/gtest-death-test_ex_test.cc", - "googletest/test/gtest-listener_test.cc", - "googletest/test/gtest-unittest-api_test.cc", - "googletest/test/gtest-param-test_test.cc", + "googletest/src/gtest_main.cc", ], ), -) - -filegroup( - name = "default_test_files", - srcs = glob( - include = [ - "googletest/test/gtest-*.cc", - "googletest/test/*.h", - "googletest/include/gtest/**/*.h", - ], - exclude = [ - "googletest/src/gtest-unittest-api_test.cc", - "googletest/src/gtest-all.cc", - "googletest/test/gtest_all_test.cc", - "googletest/test/gtest-death-test_ex_test.cc", - "googletest/test/gtest-listener_test.cc", - "googletest/test/gtest-unittest-api_test.cc", - "googletest/test/gtest-param-test_test.cc", - ], + hdrs = GTEST_HDRS, + copts = ["-fexceptions"] + select( + { + ":win": [], + "//conditions:default": ["-pthread"], + }, ), -) - -cc_test( - name = "gtest_all_test", - size = "small", - srcs = select({ - ":win": [":win_only_test_files"], - "//conditions:default": [":default_test_files"], - }), - copts = select({ - ":win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], - "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], - }), includes = [ "googletest", "googletest/include", - "googletest/include/internal", - "googletest/test", ], linkopts = select({ ":win": [], @@ -154,60 +110,26 @@ cc_test( "-pthread", ], }), - deps = [":gtest_main"], ) -#These googletest tests have their own main() -cc_test( - name = "gtest-death-test", - size = "small", - srcs = [ - "googletest/test/gtest-death-test_ex_test.cc", - ], - copts = [ - "-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1", - ], - deps = [ - ":gtest_main", - ], -) - -cc_test( - name = "gtest-listener_test", - size = "small", - srcs = [ - "googletest/test/gtest-listener_test.cc", - ], - deps = [ - ":gtest_main", - ], -) - -cc_test( - name = "gtest-unittest-api_test", - size = "small", - srcs = [ - "googletest/test/gtest-unittest-api_test.cc", - ], - deps = [ - ":gtest_main", - ], -) - -cc_test( - name = "gtest-param-test_test", - size = "small", - srcs = [ - "googletest/test/gtest-param-test2_test.cc", - "googletest/test/gtest-param-test_test.cc", - "googletest/test/gtest-param-test_test.h", - ], - deps = [ - ":gtest_main", +cc_library( + name = "gtest_main", + srcs = glob( + include = [ + "googletest/src/gtest_main.cc", + ], + ), + hdrs = glob([ + "googletest/include/gtest/*.h", + "googletest/include/gtest/**/*.h", + ]), + includes = [ + "googletest", + "googletest/include", ], + deps = ["//:gtest"], ) - # The following rules build samples of how to use gTest. cc_library( name = "gtest_sample_lib", @@ -228,21 +150,19 @@ cc_library( cc_test( name = "gtest_samples", size = "small", - srcs = glob( - include = [ - #All Samples here except: - #sample9 designed to fail - #sample10 takes a command line option and needs to be separate - "googletest/samples/sample1_unittest.cc", - "googletest/samples/sample2_unittest.cc", - "googletest/samples/sample3_unittest.cc", - "googletest/samples/sample4_unittest.cc", - "googletest/samples/sample5_unittest.cc", - "googletest/samples/sample6_unittest.cc", - "googletest/samples/sample7_unittest.cc", - "googletest/samples/sample8_unittest.cc", - ], - ), + #All Samples except: + #sample9 ( main ) + #sample10 (main and takes a command line option and needs to be separate) + srcs = [ + "googletest/samples/sample1_unittest.cc", + "googletest/samples/sample2_unittest.cc", + "googletest/samples/sample3_unittest.cc", + "googletest/samples/sample4_unittest.cc", + "googletest/samples/sample5_unittest.cc", + "googletest/samples/sample6_unittest.cc", + "googletest/samples/sample7_unittest.cc", + "googletest/samples/sample8_unittest.cc", + ], deps = [ "gtest_sample_lib", ":gtest_main", @@ -253,7 +173,7 @@ cc_test( name = "sample9_unittest", size = "small", srcs = ["googletest/samples/sample9_unittest.cc"], - deps = [":gtest_main"], + deps = [":gtest"], ) cc_test( @@ -261,8 +181,6 @@ cc_test( size = "small", srcs = ["googletest/samples/sample10_unittest.cc"], deps = [ - ":gtest_main", + ":gtest", ], ) - - diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel new file mode 100644 index 0000000..3281efb --- /dev/null +++ b/googletest/test/BUILD.bazel @@ -0,0 +1,133 @@ +# Copyright 2017 Google Inc. All Rights Reserved. +# Author: misterg@google.com (Gennadiy Civil) +# +# Description: +# Bazel BUILD file for googletest/test, initial revision +# +licenses(["notice"]) + +""" gtest own tests """ + +#on windows exclude gtest-tuple.h and gtest-tuple_test.cc +filegroup( + name = "win_only_test_files", + srcs = glob( + include = [ + "gtest-*.cc", + "*.h", + "googletest/include/gtest/**/*.h", + ], + exclude = [ + "googletest/src/gtest-unittest-api_test.cc", + "googletest/include/gtest/internal/gtest-tuple.h", + "gtest-tuple_test.cc", + "googletest/src/gtest-all.cc", + "gtest_all_test.cc", + "gtest-death-test_ex_test.cc", + "gtest-listener_test.cc", + "gtest-unittest-api_test.cc", + "gtest-param-test_test.cc", + ], + ), +) + +filegroup( + name = "default_test_files", + srcs = glob( + include = [ + "gtest-*.cc", + "*.h", + "googletest/include/gtest/**/*.h", + ], + exclude = [ + "googletest/src/gtest-unittest-api_test.cc", + "googletest/src/gtest-all.cc", + "gtest_all_test.cc", + "gtest-death-test_ex_test.cc", + "gtest-listener_test.cc", + "gtest-unittest-api_test.cc", + "gtest-param-test_test.cc", + ], + ), +) + +cc_test( + name = "gtest_all_test", + size = "small", + srcs = select({ + "//:win": [":win_only_test_files"], + "//conditions:default": [":default_test_files"], + }), + copts = select({ + "//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], + "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], + }), + includes = [ + "googletest", + "googletest/include", + "googletest/include/internal", + "googletest/test", + ], + linkopts = select({ + "//:win": [], + "//conditions:default": [ + "-pthread", + ], + }), + deps = ["//:gtest_main"], +) + +#These googletest tests have their own main() +cc_test( + name = "gtest-listener_test", + size = "small", + srcs = [ + "gtest-listener_test.cc", + ], + deps = [ + "//:gtest_main", + ], +) + +cc_test( + name = "gtest-unittest-api_test", + size = "small", + srcs = [ + "gtest-unittest-api_test.cc", + ], + deps = [ + "//:gtest_main", + ], +) + +cc_test( + name = "gtest-param-test_test", + size = "small", + srcs = [ + "gtest-param-test2_test.cc", + "gtest-param-test_test.cc", + "gtest-param-test_test.h", + ], + deps = [ + "//:gtest_main", + ], +) + +#Verifies interaction of death tests and exceptions. +cc_test( + name = "gtest-death-test_ex_catch_test", + size = "small", + srcs = ["gtest-death-test_ex_test.cc"], + copts = ["-fexceptions"], + defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], + deps = ["//:gtest_ex"], +) + +cc_test( + name = "gtest-death-test_ex_nocatch_test", + size = "small", + srcs = ["gtest-death-test_ex_test.cc"], + copts = ["-fexceptions"], + defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], + deps = ["//:gtest_ex"], +) -- cgit v0.12 From c75de0aa924da36f67de9a7f18d55fc0f6ba63e2 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 8 Aug 2017 15:32:30 -0400 Subject: WIP, windows testing --- googletest/test/BUILD.bazel | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 3281efb..3818ba4 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -118,7 +118,10 @@ cc_test( name = "gtest-death-test_ex_catch_test", size = "small", srcs = ["gtest-death-test_ex_test.cc"], - copts = ["-fexceptions"], + copts = select({ + "//:win": [], + "//conditions:default": [""-fexceptions""], + }), defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], deps = ["//:gtest_ex"], ) @@ -127,7 +130,10 @@ cc_test( name = "gtest-death-test_ex_nocatch_test", size = "small", srcs = ["gtest-death-test_ex_test.cc"], - copts = ["-fexceptions"], - defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], + copts = select({ + "//:win": [], + "//conditions:default": [""-fexceptions""], + }), + defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], deps = ["//:gtest_ex"], ) -- cgit v0.12 From a2006b2ab0347851531f126aac6edcc8c7305064 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 8 Aug 2017 15:34:40 -0400 Subject: WIP, windows testing --- googletest/test/BUILD.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 3818ba4..5faf361 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -120,7 +120,7 @@ cc_test( srcs = ["gtest-death-test_ex_test.cc"], copts = select({ "//:win": [], - "//conditions:default": [""-fexceptions""], + "//conditions:default": ["-fexceptions"], }), defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], deps = ["//:gtest_ex"], @@ -132,7 +132,7 @@ cc_test( srcs = ["gtest-death-test_ex_test.cc"], copts = select({ "//:win": [], - "//conditions:default": [""-fexceptions""], + "//conditions:default": ["-fexceptions"], }), defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], deps = ["//:gtest_ex"], -- cgit v0.12 From 40a909b4e543f865b4c35e9b31ad0f485ed32e62 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 8 Aug 2017 15:37:38 -0400 Subject: WIP, windows testing --- googletest/test/BUILD.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 5faf361..4eb70b2 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -119,7 +119,7 @@ cc_test( size = "small", srcs = ["gtest-death-test_ex_test.cc"], copts = select({ - "//:win": [], + "//:win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], "//conditions:default": ["-fexceptions"], }), defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], @@ -131,7 +131,7 @@ cc_test( size = "small", srcs = ["gtest-death-test_ex_test.cc"], copts = select({ - "//:win": [], + "//:win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], "//conditions:default": ["-fexceptions"], }), defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], -- cgit v0.12 From e66b6bc868055f92a35ae0784a11ce87ec936c4d Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 8 Aug 2017 15:41:44 -0400 Subject: WIP, win testing --- BUILD.bazel | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 9731504..35123b8 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -94,10 +94,10 @@ cc_library( ], ), hdrs = GTEST_HDRS, - copts = ["-fexceptions"] + select( + copts = select( { - ":win": [], - "//conditions:default": ["-pthread"], + ":win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], + "//conditions:default": ["-fexceptions","-pthread"], }, ), includes = [ -- cgit v0.12 From ab8f2b0d09eb926a31b582482550c7d5c52d2fe9 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 8 Aug 2017 15:54:36 -0400 Subject: WIP, win testing --- googletest/test/BUILD.bazel | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 4eb70b2..873638e 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -116,24 +116,27 @@ cc_test( #Verifies interaction of death tests and exceptions. cc_test( name = "gtest-death-test_ex_catch_test", - size = "small", + size = "medium", srcs = ["gtest-death-test_ex_test.cc"], copts = select({ "//:win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], "//conditions:default": ["-fexceptions"], }), - defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], + defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], deps = ["//:gtest_ex"], ) cc_test( name = "gtest-death-test_ex_nocatch_test", - size = "small", + size = "medium", srcs = ["gtest-death-test_ex_test.cc"], copts = select({ "//:win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], "//conditions:default": ["-fexceptions"], }), - defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], + defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], deps = ["//:gtest_ex"], ) + + + -- cgit v0.12 From ac885f3ab2a50689f334d2bf3a53ead9312601dc Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 9 Aug 2017 11:47:54 -0400 Subject: WIP --- BUILD.bazel | 78 ++++++--------------------------------------- googletest/test/BUILD.bazel | 32 ++----------------- 2 files changed, 12 insertions(+), 98 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 35123b8..9c58f81 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -8,37 +8,11 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) -cc_library( - name = "gmock", - srcs = glob( - include = [ - "googlemock/src/*.cc", - "googlemock/include/gmock/**/*.h", - ], - exclude = [ - "googlemock/src/gmock-all.cc", - ], - ), - hdrs = glob([ - "googlemock/include/gmock/*.h", - ]), - includes = [ - "googlemock", - "googlemock/include", - ], - linkopts = select({ - ":win": [], - "//conditions:default": ["-pthread"], - }), - deps = [ - ":gtest", - ], -) - # gtest public API. GTEST_HDRS = \ glob([ "googletest/include/gtest/*.h", + "googlemock/include/gmock/*.h", ]) config_setting( @@ -54,10 +28,13 @@ cc_library( "googletest/src/*.cc", "googletest/src/*.h", "googletest/include/gtest/**/*.h", + "googlemock/src/*.cc", + "googlemock/include/gmock/**/*.h", ], exclude = [ "googletest/src/gtest-all.cc", "googletest/src/gtest_main.cc", + "googlemock/src/gmock-all.cc", ], ), hdrs = GTEST_HDRS, @@ -68,39 +45,8 @@ cc_library( }, ), includes = [ - "googletest", - "googletest/include", - ], - linkopts = select({ - ":win": [], - "//conditions:default": [ - "-pthread", - ], - }), -) - -## Google Test with exceptions enabled. -cc_library( - name = "gtest_ex", - srcs = glob( - include = [ - "googletest/src/*.cc", - "googletest/src/*.h", - "googletest/include/gtest/**/*.h", - ], - exclude = [ - "googletest/src/gtest-all.cc", - "googletest/src/gtest_main.cc", - ], - ), - hdrs = GTEST_HDRS, - copts = select( - { - ":win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], - "//conditions:default": ["-fexceptions","-pthread"], - }, - ), - includes = [ + "googlemock", + "googlemock/include", "googletest", "googletest/include", ], @@ -114,15 +60,9 @@ cc_library( cc_library( name = "gtest_main", - srcs = glob( - include = [ - "googletest/src/gtest_main.cc", - ], - ), - hdrs = glob([ - "googletest/include/gtest/*.h", - "googletest/include/gtest/**/*.h", - ]), + srcs = [ + "googletest/src/gtest_main.cc", + ], includes = [ "googletest", "googletest/include", diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 873638e..b9837c8 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -85,7 +85,7 @@ cc_test( "gtest-listener_test.cc", ], deps = [ - "//:gtest_main", + "//:gtest", ], ) @@ -96,7 +96,7 @@ cc_test( "gtest-unittest-api_test.cc", ], deps = [ - "//:gtest_main", + "//:gtest", ], ) @@ -109,34 +109,8 @@ cc_test( "gtest-param-test_test.h", ], deps = [ - "//:gtest_main", + "//:gtest", ], ) -#Verifies interaction of death tests and exceptions. -cc_test( - name = "gtest-death-test_ex_catch_test", - size = "medium", - srcs = ["gtest-death-test_ex_test.cc"], - copts = select({ - "//:win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], - "//conditions:default": ["-fexceptions"], - }), - defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], - deps = ["//:gtest_ex"], -) - -cc_test( - name = "gtest-death-test_ex_nocatch_test", - size = "medium", - srcs = ["gtest-death-test_ex_test.cc"], - copts = select({ - "//:win": ["-DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"], - "//conditions:default": ["-fexceptions"], - }), - defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=0"], - deps = ["//:gtest_ex"], -) - - -- cgit v0.12 From 4f5c01b4c96913e2d773b23ca5b81b92bdc29fd0 Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 9 Aug 2017 12:15:00 -0400 Subject: Added googlemock tests --- googlemock/test/BUILD | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 googlemock/test/BUILD diff --git a/googlemock/test/BUILD b/googlemock/test/BUILD new file mode 100644 index 0000000..ae0a66e --- /dev/null +++ b/googlemock/test/BUILD @@ -0,0 +1,29 @@ +# Copyright 2017 Google Inc. All Rights Reserved. +# Author: misterg@google.com (Gennadiy Civil) +# +# Description: +# Bazel BUILD file for googletest-googlemock, initial revision +# + +""" gmock own tests """ + +cc_test( + name = "gmock_all_test", + size = "small", + srcs = glob( + include = [ + "gmock-*.cc", + ], + ), + copts = select({ + "//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], + "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], + }), + linkopts = select({ + "//:win": [], + "//conditions:default": [ + "-pthread", + ], + }), + deps = ["//:gtest"], +) -- cgit v0.12 From 5a5e3c17bbec88eb48ba92e0ad325ceaa45a81aa Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 9 Aug 2017 12:18:12 -0400 Subject: Added googlemock tests --- googlemock/test/BUILD | 4 ---- 1 file changed, 4 deletions(-) diff --git a/googlemock/test/BUILD b/googlemock/test/BUILD index ae0a66e..ca59700 100644 --- a/googlemock/test/BUILD +++ b/googlemock/test/BUILD @@ -15,10 +15,6 @@ cc_test( "gmock-*.cc", ], ), - copts = select({ - "//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], - "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], - }), linkopts = select({ "//:win": [], "//conditions:default": [ -- cgit v0.12 From 66a036959f09071fa0d5f7af4a5cbf470a2c6137 Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 9 Aug 2017 14:37:58 -0400 Subject: WIP --- BUILD.bazel | 17 +++++++---------- googlemock/test/BUILD.bazel | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 googlemock/test/BUILD.bazel diff --git a/BUILD.bazel b/BUILD.bazel index 9c58f81..1d2f6b8 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -8,19 +8,12 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) -# gtest public API. -GTEST_HDRS = \ - glob([ - "googletest/include/gtest/*.h", - "googlemock/include/gmock/*.h", - ]) - config_setting( name = "win", values = {"cpu": "x64_windows_msvc"}, ) -# Google Test +# Google Test including Google Mock cc_library( name = "gtest", srcs = glob( @@ -35,9 +28,13 @@ cc_library( "googletest/src/gtest-all.cc", "googletest/src/gtest_main.cc", "googlemock/src/gmock-all.cc", + "googlemock/src/gmock_main.cc", ], ), - hdrs = GTEST_HDRS, + hdrs =glob([ + "googletest/include/gtest/*.h", + "googlemock/include/gmock/*.h", + ]), copts = select( { ":win": [], @@ -123,4 +120,4 @@ cc_test( deps = [ ":gtest", ], -) +) \ No newline at end of file diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel new file mode 100644 index 0000000..88e82e6 --- /dev/null +++ b/googlemock/test/BUILD.bazel @@ -0,0 +1,25 @@ +# Copyright 2017 Google Inc. All Rights Reserved. +# Author: misterg@google.com (Gennadiy Civil) +# +# Description: +# Bazel BUILD file for googletest-googlemock/test, initial revision +# + +""" gmock own tests """ + +cc_test( + name = "gmock_all_test", + size = "small", + srcs = glob( + include = [ + "gmock-*.cc", + ], + ), + linkopts = select({ + "//:win": [], + "//conditions:default": [ + "-pthread", + ], + }), + deps = ["//:gtest"], +) -- cgit v0.12 From b98e30b42704e214871f6baba458ba7c1066d0ed Mon Sep 17 00:00:00 2001 From: misterg Date: Thu, 10 Aug 2017 11:54:46 -0400 Subject: Initial Revision, review 164634031 --- BUILD.bazel | 3 ++- googlemock/test/BUILD | 25 ------------------------- googletest/samples/sample3_unittest.cc | 2 +- googletest/test/BUILD.bazel | 2 -- 4 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 googlemock/test/BUILD diff --git a/BUILD.bazel b/BUILD.bazel index 1d2f6b8..dba50cc 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -120,4 +120,5 @@ cc_test( deps = [ ":gtest", ], -) \ No newline at end of file +) +git \ No newline at end of file diff --git a/googlemock/test/BUILD b/googlemock/test/BUILD deleted file mode 100644 index ca59700..0000000 --- a/googlemock/test/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Google Inc. All Rights Reserved. -# Author: misterg@google.com (Gennadiy Civil) -# -# Description: -# Bazel BUILD file for googletest-googlemock, initial revision -# - -""" gmock own tests """ - -cc_test( - name = "gmock_all_test", - size = "small", - srcs = glob( - include = [ - "gmock-*.cc", - ], - ), - linkopts = select({ - "//:win": [], - "//conditions:default": [ - "-pthread", - ], - }), - deps = ["//:gtest"], -) diff --git a/googletest/samples/sample3_unittest.cc b/googletest/samples/sample3_unittest.cc index b2f4924..284bb47 100644 --- a/googletest/samples/sample3_unittest.cc +++ b/googletest/samples/sample3_unittest.cc @@ -65,7 +65,7 @@ #include "sample3-inl.h" #include "gtest/gtest.h" -namespace{ +namespace { // To use a test fixture, derive a class from testing::Test. class QueueTestSmpl3 : public testing::Test { protected: // You should make the members protected s.t. they can be diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index b9837c8..7218122 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -112,5 +112,3 @@ cc_test( "//:gtest", ], ) - - -- cgit v0.12 From cb5b05436dfc247399c8a3cc0dc6199bb00200f8 Mon Sep 17 00:00:00 2001 From: misterg Date: Thu, 10 Aug 2017 12:03:27 -0400 Subject: Added Copyright --- BUILD.bazel | 37 ++++++++++++++++++++++++++++++++----- WORKSPACE | 34 ++++++++++++++++++++++++++++++++++ googlemock/test/BUILD.bazel | 35 +++++++++++++++++++++++++++++++---- googletest/test/BUILD.bazel | 36 ++++++++++++++++++++++++++++++++---- 4 files changed, 129 insertions(+), 13 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index dba50cc..c48e029 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,9 +1,37 @@ -# Copyright 2017 Google Inc. All Rights Reserved. -# Author: misterg@google.com (Gennadiy Civil) +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. # -# Description: -# Bazel BUILD file for googletest, initial revision +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +# Author: misterg@google.com (Gennadiy Civil) +# +# Bazel Build for Google C++ Testing Framework(Google Test) + package(default_visibility = ["//visibility:public"]) licenses(["notice"]) @@ -121,4 +149,3 @@ cc_test( ":gtest", ], ) -git \ No newline at end of file diff --git a/WORKSPACE b/WORKSPACE index eb50f4e..53a05aa 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1 +1,35 @@ +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Author: misterg@google.com (Gennadiy Civil) +# +# Bazel Build for Google C++ Testing Framework(Google Test) + workspace(name = "com_google_googletest") \ No newline at end of file diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel index 88e82e6..6e67f18 100644 --- a/googlemock/test/BUILD.bazel +++ b/googlemock/test/BUILD.bazel @@ -1,9 +1,36 @@ -# Copyright 2017 Google Inc. All Rights Reserved. -# Author: misterg@google.com (Gennadiy Civil) +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: # -# Description: -# Bazel BUILD file for googletest-googlemock/test, initial revision +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Author: misterg@google.com (Gennadiy Civil) +# +# Bazel Build for Google C++ Testing Framework(Google Test)-googlemock """ gmock own tests """ diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 7218122..6223090 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -1,9 +1,37 @@ -# Copyright 2017 Google Inc. All Rights Reserved. -# Author: misterg@google.com (Gennadiy Civil) +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. # -# Description: -# Bazel BUILD file for googletest/test, initial revision +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +# Author: misterg@google.com (Gennadiy Civil) +# +# Bazel BUILD for The Google C++ Testing Framework (Google Test) + licenses(["notice"]) """ gtest own tests """ -- cgit v0.12 From 4e284ee657ffc037dfcf606f94069906dbc4e55c Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 10 Aug 2017 14:47:24 -0400 Subject: Update WORKSPACE Remove comments --- WORKSPACE | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 53a05aa..106b824 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,35 +1 @@ -# Copyright 2017 Google Inc. -# All Rights Reserved. -# -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Author: misterg@google.com (Gennadiy Civil) -# -# Bazel Build for Google C++ Testing Framework(Google Test) - -workspace(name = "com_google_googletest") \ No newline at end of file +workspace(name = "com_google_googletest") -- cgit v0.12 From c3f65335b79f47b05629e79a54685d899bc53b93 Mon Sep 17 00:00:00 2001 From: misterg Date: Thu, 10 Aug 2017 15:33:09 -0400 Subject: Addressing comments --- BUILD.bazel | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index c48e029..a442374 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -86,11 +86,7 @@ cc_library( cc_library( name = "gtest_main", srcs = [ - "googletest/src/gtest_main.cc", - ], - includes = [ - "googletest", - "googletest/include", + "googlemock/src/gmock_main.cc", ], deps = ["//:gtest"], ) -- cgit v0.12 From 97a8498873baaf4bdf8e45ff03fd0cecdf9b1658 Mon Sep 17 00:00:00 2001 From: misterg Date: Thu, 10 Aug 2017 16:33:22 -0400 Subject: Addressing Comments --- googletest/test/BUILD.bazel | 68 +++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 46 deletions(-) diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 6223090..5daa154 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -37,55 +37,31 @@ licenses(["notice"]) """ gtest own tests """ #on windows exclude gtest-tuple.h and gtest-tuple_test.cc -filegroup( - name = "win_only_test_files", - srcs = glob( - include = [ - "gtest-*.cc", - "*.h", - "googletest/include/gtest/**/*.h", - ], - exclude = [ - "googletest/src/gtest-unittest-api_test.cc", - "googletest/include/gtest/internal/gtest-tuple.h", - "gtest-tuple_test.cc", - "googletest/src/gtest-all.cc", - "gtest_all_test.cc", - "gtest-death-test_ex_test.cc", - "gtest-listener_test.cc", - "gtest-unittest-api_test.cc", - "gtest-param-test_test.cc", - ], - ), -) - -filegroup( - name = "default_test_files", - srcs = glob( - include = [ - "gtest-*.cc", - "*.h", - "googletest/include/gtest/**/*.h", - ], - exclude = [ - "googletest/src/gtest-unittest-api_test.cc", - "googletest/src/gtest-all.cc", - "gtest_all_test.cc", - "gtest-death-test_ex_test.cc", - "gtest-listener_test.cc", - "gtest-unittest-api_test.cc", - "gtest-param-test_test.cc", - ], - ), -) - cc_test( name = "gtest_all_test", size = "small", - srcs = select({ - "//:win": [":win_only_test_files"], - "//conditions:default": [":default_test_files"], - }), + srcs = glob( + include = [ + "gtest-*.cc", + "*.h", + "googletest/include/gtest/**/*.h", + ], + exclude = [ + "gtest-unittest-api_test.cc", + "gtest-tuple_test.cc", + "googletest/src/gtest-all.cc", + "gtest_all_test.cc", + "gtest-death-test_ex_test.cc", + "gtest-listener_test.cc", + "gtest-unittest-api_test.cc", + "gtest-param-test_test.cc", + ], + ) + select({ + "//:win": [], + "//conditions:default": [ + "gtest-tuple_test.cc", + ], + }), copts = select({ "//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], -- cgit v0.12