WIP
This commit is contained in:
		
							
								
								
									
										74
									
								
								BUILD.bazel
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								BUILD.bazel
									
									
									
									
									
								
							@@ -8,37 +8,11 @@ package(default_visibility = ["//visibility:public"])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
licenses(["notice"])
 | 
					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 public API.
 | 
				
			||||||
GTEST_HDRS = \
 | 
					GTEST_HDRS = \
 | 
				
			||||||
    glob([
 | 
					    glob([
 | 
				
			||||||
        "googletest/include/gtest/*.h",
 | 
					        "googletest/include/gtest/*.h",
 | 
				
			||||||
 | 
					        "googlemock/include/gmock/*.h",
 | 
				
			||||||
    ])
 | 
					    ])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
config_setting(
 | 
					config_setting(
 | 
				
			||||||
@@ -54,10 +28,13 @@ cc_library(
 | 
				
			|||||||
            "googletest/src/*.cc",
 | 
					            "googletest/src/*.cc",
 | 
				
			||||||
            "googletest/src/*.h",
 | 
					            "googletest/src/*.h",
 | 
				
			||||||
            "googletest/include/gtest/**/*.h",
 | 
					            "googletest/include/gtest/**/*.h",
 | 
				
			||||||
 | 
					            "googlemock/src/*.cc",
 | 
				
			||||||
 | 
					            "googlemock/include/gmock/**/*.h",
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        exclude = [
 | 
					        exclude = [
 | 
				
			||||||
            "googletest/src/gtest-all.cc",
 | 
					            "googletest/src/gtest-all.cc",
 | 
				
			||||||
            "googletest/src/gtest_main.cc",
 | 
					            "googletest/src/gtest_main.cc",
 | 
				
			||||||
 | 
					            "googlemock/src/gmock-all.cc",
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
    ),
 | 
					    ),
 | 
				
			||||||
    hdrs = GTEST_HDRS,
 | 
					    hdrs = GTEST_HDRS,
 | 
				
			||||||
@@ -68,39 +45,8 @@ cc_library(
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
    ),
 | 
					    ),
 | 
				
			||||||
    includes = [
 | 
					    includes = [
 | 
				
			||||||
        "googletest",
 | 
					        "googlemock",
 | 
				
			||||||
        "googletest/include",
 | 
					        "googlemock/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 = [
 | 
					 | 
				
			||||||
        "googletest",
 | 
					        "googletest",
 | 
				
			||||||
        "googletest/include",
 | 
					        "googletest/include",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
@@ -114,15 +60,9 @@ cc_library(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cc_library(
 | 
					cc_library(
 | 
				
			||||||
    name = "gtest_main",
 | 
					    name = "gtest_main",
 | 
				
			||||||
    srcs = glob(
 | 
					    srcs = [
 | 
				
			||||||
        include = [
 | 
					 | 
				
			||||||
        "googletest/src/gtest_main.cc",
 | 
					        "googletest/src/gtest_main.cc",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    ),
 | 
					 | 
				
			||||||
    hdrs = glob([
 | 
					 | 
				
			||||||
        "googletest/include/gtest/*.h",
 | 
					 | 
				
			||||||
        "googletest/include/gtest/**/*.h",
 | 
					 | 
				
			||||||
    ]),
 | 
					 | 
				
			||||||
    includes = [
 | 
					    includes = [
 | 
				
			||||||
        "googletest",
 | 
					        "googletest",
 | 
				
			||||||
        "googletest/include",
 | 
					        "googletest/include",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,7 @@ cc_test(
 | 
				
			|||||||
        "gtest-listener_test.cc",
 | 
					        "gtest-listener_test.cc",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    deps = [
 | 
					    deps = [
 | 
				
			||||||
        "//:gtest_main",
 | 
					        "//:gtest",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -96,7 +96,7 @@ cc_test(
 | 
				
			|||||||
        "gtest-unittest-api_test.cc",
 | 
					        "gtest-unittest-api_test.cc",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    deps = [
 | 
					    deps = [
 | 
				
			||||||
        "//:gtest_main",
 | 
					        "//:gtest",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -109,34 +109,8 @@ cc_test(
 | 
				
			|||||||
        "gtest-param-test_test.h",
 | 
					        "gtest-param-test_test.h",
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    deps = [
 | 
					    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"],
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user