[bazel] Update gtest move to third-party

a11cd0d94ed3cabf0998a0289aead05da94c86eb moved googletest to third-party.

This creates a corresponding BUILD file in third-party/unittest, moved from the chunk in llvm/BUILD.bazel.

We must refine the .bazelignore which is setup to ignore the benchmarking library so that we don't ignore the new dir here.
This commit is contained in:
Jordan Rupprecht 2022-11-09 20:48:11 -08:00
parent 04b449e147
commit f57557de70
7 changed files with 248 additions and 230 deletions

View File

@ -3,4 +3,4 @@ utils/bazel
# Ignore third-party projects. These should be configured separately and some # Ignore third-party projects. These should be configured separately and some
# include Bazel configs. # include Bazel configs.
libcxx/utils/google-benchmark libcxx/utils/google-benchmark
third-party third-party/benchmark

View File

@ -1009,7 +1009,7 @@ cc_library(
":basic", ":basic",
":frontend", ":frontend",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
], ],
) )

View File

@ -30,9 +30,9 @@ cc_test(
"//llvm:Core", "//llvm:Core",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -48,7 +48,7 @@ cc_library(
"//clang:frontend", "//clang:frontend",
"//clang:testing", "//clang:testing",
"//clang:tooling", "//clang:tooling",
"//llvm:gtest", "//third-party/unittest:gtest",
], ],
) )
@ -68,8 +68,8 @@ cc_test(
"//clang:tooling", "//clang:tooling",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -87,8 +87,8 @@ cc_test(
"//clang:frontend", "//clang:frontend",
"//clang:tooling", "//clang:tooling",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -111,9 +111,9 @@ cc_test(
"//clang:parse", "//clang:parse",
"//clang:tooling", "//clang:tooling",
"//llvm:Support", "//llvm:Support",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -137,9 +137,9 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:TestingADT", "//llvm:TestingADT",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -157,9 +157,9 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:config", "//llvm:config",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -183,8 +183,8 @@ cc_test(
"//clang:sema", "//clang:sema",
"//llvm:Core", "//llvm:Core",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -207,9 +207,9 @@ cc_test(
"//clang:frontend", "//clang:frontend",
"//clang:tooling_core", "//clang:tooling_core",
"//llvm:Support", "//llvm:Support",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -231,9 +231,9 @@ cc_test(
"//clang:sema", "//clang:sema",
"//clang:serialization", "//clang:serialization",
"//llvm:Support", "//llvm:Support",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -257,9 +257,9 @@ cc_test(
"//clang:serialization", "//clang:serialization",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -281,7 +281,7 @@ cc_library(
"//clang:tooling", "//clang:tooling",
"//clang:tooling_core", "//clang:tooling_core",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
], ],
) )
@ -306,8 +306,8 @@ cc_test(
"//clang:tooling", "//clang:tooling",
"//clang:tooling_refactoring", "//clang:tooling_refactoring",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -321,8 +321,8 @@ cc_test(
deps = [ deps = [
"//clang:rewrite", "//clang:rewrite",
"//clang:tooling", "//clang:tooling",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -343,9 +343,9 @@ cc_test(
"//clang:sema", "//clang:sema",
"//clang:tooling", "//clang:tooling",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -364,7 +364,7 @@ cc_library(
"//clang:static_analyzer_frontend", "//clang:static_analyzer_frontend",
"//clang:testing", "//clang:testing",
"//clang:tooling", "//clang:tooling",
"//llvm:gtest", "//third-party/unittest:gtest",
], ],
) )
@ -388,8 +388,8 @@ cc_test(
"//clang:tooling", "//clang:tooling",
"//llvm:Support", "//llvm:Support",
"//llvm:config", "//llvm:config",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -421,9 +421,9 @@ cc_test(
"//clang:transformer", "//clang:transformer",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -445,7 +445,7 @@ cc_library(
"//clang:tooling", "//clang:tooling",
"//clang:tooling_core", "//clang:tooling_core",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
], ],
) )
@ -468,9 +468,9 @@ cc_test(
"//clang:tooling_syntax", "//clang:tooling_syntax",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -496,9 +496,9 @@ cc_test(
"//clang:tooling_syntax", "//clang:tooling_syntax",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gmock", "//third-party/unittest:gmock",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -522,7 +522,7 @@ cc_test(
deps = [ deps = [
"//clang:libclang", "//clang:libclang",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )

View File

@ -3700,8 +3700,8 @@ cc_binary(
":BinaryFormat", ":BinaryFormat",
":CodeGen", ":CodeGen",
":DebugInfo", ":DebugInfo",
":Debuginfod",
":DebugInfoDWARF", ":DebugInfoDWARF",
":Debuginfod",
":Demangle", ":Demangle",
":MC", ":MC",
":MCDisassembler", ":MCDisassembler",
@ -4249,97 +4249,6 @@ cc_library(
], ],
) )
# A hacky library to expose some internal headers of gtest to its own
# implementation source files using a stripped include prefix rather than
# file-relative-inclusion.
#
# FIXME: This file should be in `textual_hdrs` instead of `hdrs`, but
# unfortunately that doesn't work with `strip_include_prefix`:
# https://github.com/bazelbuild/bazel/issues/12424
#
# For now, simply disable parsing and header modules.
cc_library(
name = "gtest_internal_headers",
testonly = True,
hdrs = ["utils/unittest/googletest/src/gtest-internal-inl.h"],
features = [
"-parse_headers",
"-header_modules",
],
strip_include_prefix = "utils/unittest/googletest",
)
cc_library(
name = "gtest",
testonly = True,
srcs = glob(
[
"utils/unittest/googletest/include/**/*.h",
"utils/unittest/googletest/src/*.cc",
],
exclude = [
"utils/unittest/googletest/src/gtest-all.cc",
"utils/unittest/googletest/include/gtest/gtest_pred_impl.h",
],
) + [
],
hdrs = ["utils/unittest/googletest/include/gtest/gtest.h"],
copts = llvm_copts,
defines = [
"GTEST_HAS_RTTI=0",
"__STDC_LIMIT_MACROS",
"__STDC_CONSTANT_MACROS",
] + select({
"@bazel_tools//src/conditions:windows": ["GTEST_USE_OWN_TR1_TUPLE=0"],
"//conditions:default": ["GTEST_USE_OWN_TR1_TUPLE=1"],
}),
includes = [
"include",
"utils/unittest/googletest/include",
],
textual_hdrs = [
"utils/unittest/googletest/include/gtest/gtest_pred_impl.h",
],
deps = [
":Support",
":gtest_internal_headers",
],
)
cc_library(
name = "gtest_main",
testonly = True,
srcs = ["utils/unittest/UnitTestMain/TestMain.cpp"],
copts = llvm_copts,
deps = [
":Support",
":gmock",
":gtest",
],
)
cc_library(
name = "gmock",
testonly = True,
srcs = glob(
[
"utils/unittest/googlemock/include/**/*.h",
"utils/unittest/googlemock/src/*.cc",
],
exclude = ["utils/unittest/googlemock/src/gmock-all.cc"],
),
hdrs = [
"utils/unittest/googlemock/include/gmock/gmock.h",
"utils/unittest/googlemock/include/gmock/gmock-matchers.h",
],
copts = llvm_copts,
includes = [
"include",
"utils/unittest/googlemock/include",
],
deps = [":gtest"],
)
py_binary( py_binary(
name = "lit", name = "lit",
testonly = True, testonly = True,
@ -4355,7 +4264,7 @@ cc_library(
copts = llvm_copts, copts = llvm_copts,
deps = [ deps = [
":Support", ":Support",
":gmock", "//third-party/unittest:gmock",
], ],
) )
@ -4373,8 +4282,8 @@ cc_library(
deps = [ deps = [
":Support", ":Support",
":config", ":config",
":gmock", "//third-party/unittest:gmock",
":gtest", "//third-party/unittest:gtest",
], ],
) )

View File

@ -23,8 +23,8 @@ cc_test(
"//llvm:Core", "//llvm:Core",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -49,8 +49,8 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:TransformUtils", "//llvm:TransformUtils",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -65,8 +65,8 @@ cc_test(
"//llvm:AsmParser", "//llvm:AsmParser",
"//llvm:Core", "//llvm:Core",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -83,8 +83,8 @@ cc_test(
"//llvm:BitWriter", "//llvm:BitWriter",
"//llvm:Core", "//llvm:Core",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -99,8 +99,8 @@ cc_test(
"//llvm:BitstreamReader", "//llvm:BitstreamReader",
"//llvm:BitstreamWriter", "//llvm:BitstreamWriter",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -136,8 +136,8 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:Target", "//llvm:Target",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -162,8 +162,8 @@ cc_test(
"//llvm:FileCheckLib", "//llvm:FileCheckLib",
"//llvm:Support", "//llvm:Support",
"//llvm:Target", "//llvm:Target",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -195,8 +195,8 @@ cc_test(
"//llvm:ObjectYAML", "//llvm:ObjectYAML",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -206,8 +206,8 @@ cc_test(
deps = [ deps = [
"//llvm:Debuginfod", "//llvm:Debuginfod",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -225,8 +225,8 @@ cc_test(
"//llvm:ExecutionEngine", "//llvm:ExecutionEngine",
"//llvm:Interpreter", "//llvm:Interpreter",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -251,8 +251,8 @@ cc_test(
"//llvm:MCJIT", "//llvm:MCJIT",
"//llvm:Passes", "//llvm:Passes",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -276,8 +276,8 @@ cc_test(
"//llvm:OrcJIT", "//llvm:OrcJIT",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -292,8 +292,8 @@ cc_test(
"//llvm:FileCheckLib", "//llvm:FileCheckLib",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -320,8 +320,8 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:config", "//llvm:config",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -335,8 +335,8 @@ cc_test(
deps = [ deps = [
"//llvm:LineEditor", "//llvm:LineEditor",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -353,8 +353,8 @@ cc_test(
"//llvm:FrontendOpenMP", "//llvm:FrontendOpenMP",
"//llvm:Passes", "//llvm:Passes",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -370,8 +370,8 @@ cc_test(
"//llvm:Core", "//llvm:Core",
"//llvm:Linker", "//llvm:Linker",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -388,8 +388,8 @@ cc_test(
"//llvm:MC", "//llvm:MC",
"//llvm:MCDisassembler", "//llvm:MCDisassembler",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -407,8 +407,8 @@ cc_test(
"//llvm:Core", "//llvm:Core",
"//llvm:Support", "//llvm:Support",
"//llvm:Target", "//llvm:Target",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -423,8 +423,8 @@ cc_test(
"//llvm:Object", "//llvm:Object",
"//llvm:ObjectYAML", "//llvm:ObjectYAML",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -439,8 +439,8 @@ cc_test(
"//llvm:Object", "//llvm:Object",
"//llvm:ObjectYAML", "//llvm:ObjectYAML",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -457,8 +457,8 @@ cc_test(
"//llvm:ObjectYAML", "//llvm:ObjectYAML",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -515,8 +515,8 @@ cc_test(
":option_tests_gen", ":option_tests_gen",
"//llvm:Option", "//llvm:Option",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -531,9 +531,9 @@ cc_test(
"//llvm:BitReader", "//llvm:BitReader",
"//llvm:Remarks", "//llvm:Remarks",
"//llvm:Support", "//llvm:Support",
"//llvm:gtest",
"//llvm:gtest_main",
"//llvm:remark_linker", "//llvm:remark_linker",
"//third-party/unittest:gtest",
"//third-party/unittest:gtest_main",
], ],
) )
@ -550,8 +550,8 @@ cc_test(
"//llvm:ProfileData", "//llvm:ProfileData",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -584,8 +584,8 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:config", "//llvm:config",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -601,8 +601,8 @@ cc_test(
"//llvm:AllTargetsCodeGens", "//llvm:AllTargetsCodeGens",
"//llvm:Support", "//llvm:Support",
"//llvm:config", "//llvm:config",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -620,9 +620,9 @@ cc_test(
":automata_tables_gen", ":automata_tables_gen",
"//llvm:Support", "//llvm:Support",
"//llvm:TableGen", "//llvm:TableGen",
"//llvm:gtest",
"//llvm:gtest_main",
"//llvm:tblgen", "//llvm:tblgen",
"//third-party/unittest:gtest",
"//third-party/unittest:gtest_main",
], ],
) )
@ -638,8 +638,8 @@ cc_test(
], ],
deps = [ deps = [
"//llvm:AArch64CodeGen", "//llvm:AArch64CodeGen",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -655,8 +655,8 @@ cc_test(
deps = [ deps = [
"//llvm:Support", "//llvm:Support",
"//llvm:TestingADT", "//llvm:TestingADT",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -680,8 +680,8 @@ cc_test(
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:TransformUtils", "//llvm:TransformUtils",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )
@ -706,7 +706,7 @@ cc_test(
"//llvm:MCDisassembler", "//llvm:MCDisassembler",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest", "//third-party/unittest:gtest",
"//llvm:gtest_main", "//third-party/unittest:gtest_main",
], ],
) )

View File

@ -19,9 +19,9 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:IR", "//mlir:IR",
"//mlir/test:TestDialect", "//mlir/test:TestDialect",
"//third-party/unittest:gtest_main",
], ],
) )
@ -34,7 +34,6 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:ControlFlowInterfaces", "//mlir:ControlFlowInterfaces",
"//mlir:DLTIDialect", "//mlir:DLTIDialect",
"//mlir:DataLayoutInterfaces", "//mlir:DataLayoutInterfaces",
@ -43,6 +42,7 @@ cc_test(
"//mlir:InferIntRangeInterface", "//mlir:InferIntRangeInterface",
"//mlir:InferTypeOpInterface", "//mlir:InferTypeOpInterface",
"//mlir:Parser", "//mlir:Parser",
"//third-party/unittest:gtest_main",
], ],
) )
@ -56,8 +56,8 @@ cc_test(
deps = [ deps = [
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:Support", "//mlir:Support",
"//third-party/unittest:gtest_main",
], ],
) )
@ -70,11 +70,11 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:Analysis", "//mlir:Analysis",
"//mlir:FuncDialect", "//mlir:FuncDialect",
"//mlir:IR", "//mlir:IR",
"//mlir:Pass", "//mlir:Pass",
"//third-party/unittest:gtest_main",
], ],
) )
@ -86,9 +86,9 @@ cc_test(
"Rewrite/*.h", "Rewrite/*.h",
]), ]),
deps = [ deps = [
"//llvm:gtest_main",
"//mlir:IR", "//mlir:IR",
"//mlir:Rewrite", "//mlir:Rewrite",
"//third-party/unittest:gtest_main",
], ],
) )
@ -101,8 +101,8 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:Dialect", "//mlir:Dialect",
"//third-party/unittest:gtest_main",
], ],
) )
@ -115,8 +115,8 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:MemRefDialect", "//mlir:MemRefDialect",
"//third-party/unittest:gtest_main",
], ],
) )
@ -129,9 +129,9 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:QuantOps", "//mlir:QuantOps",
"//mlir:Transforms", "//mlir:Transforms",
"//third-party/unittest:gtest_main",
], ],
) )
@ -143,10 +143,10 @@ cc_test(
"Dialect/SCF/*.h", "Dialect/SCF/*.h",
]), ]),
deps = [ deps = [
"//llvm:gtest_main",
"//mlir:FuncDialect", "//mlir:FuncDialect",
"//mlir:Parser", "//mlir:Parser",
"//mlir:SCFDialect", "//mlir:SCFDialect",
"//third-party/unittest:gtest_main",
], ],
) )
@ -159,8 +159,8 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:SparseTensorUtils", "//mlir:SparseTensorUtils",
"//third-party/unittest:gtest_main",
], ],
) )
@ -173,10 +173,10 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:SPIRVDeserialization", "//mlir:SPIRVDeserialization",
"//mlir:SPIRVDialect", "//mlir:SPIRVDialect",
"//mlir:SPIRVSerialization", "//mlir:SPIRVSerialization",
"//third-party/unittest:gtest_main",
], ],
) )
@ -189,9 +189,9 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:FuncDialect", "//mlir:FuncDialect",
"//mlir:TransformDialect", "//mlir:TransformDialect",
"//third-party/unittest:gtest_main",
], ],
) )
@ -204,8 +204,8 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:DialectUtils", "//mlir:DialectUtils",
"//third-party/unittest:gtest_main",
], ],
) )
@ -260,10 +260,10 @@ cc_test(
":PassIncGen", ":PassIncGen",
"//llvm:Support", "//llvm:Support",
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:IR", "//mlir:IR",
"//mlir:TableGen", "//mlir:TableGen",
"//mlir/test:TestDialect", "//mlir/test:TestDialect",
"//third-party/unittest:gtest_main",
], ],
) )
@ -275,13 +275,13 @@ cc_test(
"Transforms/*.h", "Transforms/*.h",
]), ]),
deps = [ deps = [
"//llvm:gtest_main",
"//mlir:AffineAnalysis", "//mlir:AffineAnalysis",
"//mlir:IR", "//mlir:IR",
"//mlir:Parser", "//mlir:Parser",
"//mlir:Pass", "//mlir:Pass",
"//mlir:TransformUtils", "//mlir:TransformUtils",
"//mlir:Transforms", "//mlir:Transforms",
"//third-party/unittest:gtest_main",
], ],
) )
@ -296,11 +296,11 @@ cc_test(
]), ]),
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:AffineAnalysis", "//mlir:AffineAnalysis",
"//mlir:Analysis", "//mlir:Analysis",
"//mlir:IR", "//mlir:IR",
"//mlir:Parser", "//mlir:Parser",
"//third-party/unittest:gtest_main",
], ],
) )
@ -314,9 +314,9 @@ cc_test(
"Conversion/*/*.h", "Conversion/*/*.h",
]), ]),
deps = [ deps = [
"//llvm:gtest_main",
"//mlir:ArithDialect", "//mlir:ArithDialect",
"//mlir:PDLToPDLInterp", "//mlir:PDLToPDLInterp",
"//third-party/unittest:gtest_main",
], ],
) )
@ -332,7 +332,6 @@ cc_test(
], ],
deps = [ deps = [
"//llvm:TestingSupport", "//llvm:TestingSupport",
"//llvm:gtest_main",
"//mlir:AllPassesAndDialects", "//mlir:AllPassesAndDialects",
"//mlir:Analysis", "//mlir:Analysis",
"//mlir:ExecutionEngine", "//mlir:ExecutionEngine",
@ -341,5 +340,6 @@ cc_test(
"//mlir:MemRefToLLVM", "//mlir:MemRefToLLVM",
"//mlir:mlir_c_runner_utils", "//mlir:mlir_c_runner_utils",
"//mlir:mlir_runner_utils", "//mlir:mlir_runner_utils",
"//third-party/unittest:gtest_main",
], ],
) )

View File

@ -0,0 +1,109 @@
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
exports_files(["LICENSE.TXT"])
# It may be tempting to add compiler flags here, but that should be avoided.
# The necessary warnings and other compile flags should be provided by the
# toolchain or the `.bazelrc` file. This is just a workaround until we have a
# widely available feature to enable unlimited stack frame instead of using
# this `Make` variable.
llvm_copts = [
"$(STACK_FRAME_UNLIMITED)",
]
# A hacky library to expose some internal headers of gtest to its own
# implementation source files using a stripped include prefix rather than
# file-relative-inclusion.
#
# FIXME: This file should be in `textual_hdrs` instead of `hdrs`, but
# unfortunately that doesn't work with `strip_include_prefix`:
# https://github.com/bazelbuild/bazel/issues/12424
#
# For now, simply disable parsing and header modules.
cc_library(
name = "gtest_internal_headers",
testonly = True,
hdrs = ["googletest/src/gtest-internal-inl.h"],
features = [
"-parse_headers",
"-header_modules",
],
strip_include_prefix = "googletest",
)
cc_library(
name = "gtest",
testonly = True,
srcs = glob(
[
"googletest/include/**/*.h",
"googletest/src/*.cc",
],
exclude = [
"googletest/src/gtest-all.cc",
"googletest/include/gtest/gtest_pred_impl.h",
],
) + [
],
hdrs = ["googletest/include/gtest/gtest.h"],
copts = llvm_copts,
defines = [
"GTEST_HAS_RTTI=0",
"__STDC_LIMIT_MACROS",
"__STDC_CONSTANT_MACROS",
] + select({
"@bazel_tools//src/conditions:windows": ["GTEST_USE_OWN_TR1_TUPLE=0"],
"//conditions:default": ["GTEST_USE_OWN_TR1_TUPLE=1"],
}),
includes = [
"googletest/include",
"include",
],
textual_hdrs = [
"googletest/include/gtest/gtest_pred_impl.h",
],
deps = [
":gtest_internal_headers",
"//llvm:Support",
],
)
cc_library(
name = "gtest_main",
testonly = True,
srcs = ["UnitTestMain/TestMain.cpp"],
copts = llvm_copts,
deps = [
":gmock",
":gtest",
"//llvm:Support",
],
)
cc_library(
name = "gmock",
testonly = True,
srcs = glob(
[
"googlemock/include/**/*.h",
"googlemock/src/*.cc",
],
exclude = ["googlemock/src/gmock-all.cc"],
),
hdrs = [
"googlemock/include/gmock/gmock.h",
"googlemock/include/gmock/gmock-matchers.h",
],
copts = llvm_copts,
includes = [
"googlemock/include",
"include",
],
deps = [":gtest"],
)