diff --git a/build_defs.bzl b/build_defs.bzl index d0e6b7bb614..87eb54bbaac 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -253,7 +253,7 @@ def xnnpack_cxx_library(name, copts = xnnpack_std_cxxopts(), gcc_copts = [], msv **kwargs ) -def xnnpack_unit_test(name, srcs, copts = [], mingw_copts = [], msys_copts = [], deps = [], tags = [], linkopts = [], defines = [], automatic = True, timeout = "short", shard_count = 1, **kwargs): +def xnnpack_unit_test(name, srcs, copts = [], mingw_copts = [], msys_copts = [], deps = [], tags = [], linkopts = [], defines = [], timeout = "short", shard_count = 1, **kwargs): """Unit test binary based on Google Test. Args: @@ -270,81 +270,45 @@ def xnnpack_unit_test(name, srcs, copts = [], mingw_copts = [], msys_copts = [], linkopts: The list of linking options defines: List of predefines macros to be added to the compile line. tags: List of arbitrary text tags. - automatic: Whether to create the test or testable binary. timeout: How long the test is expected to run before returning. shard_count: Specifies the number of parallel shards to use to run the test. **kwargs: Other arguments to pass to the cc_test rule. """ - if automatic: - native.cc_test( - name = name, - srcs = srcs, - copts = xnnpack_std_cxxopts() + [ - "-Iinclude", - "-Isrc", - ] + select({ - "//build_config:windows_x86_64_mingw": mingw_copts, - "//build_config:windows_x86_64_msys": msys_copts, - "//conditions:default": [], - }) + select({ - "//build_config:windows_x86_64_clang": ["/clang:-Wno-unused-function"], - "//build_config:windows_x86_64_mingw": ["-Wno-unused-function"], - "//build_config:windows_x86_64_msys": ["-Wno-unused-function"], - "//build_config:windows_x86_64": [], - "//conditions:default": ["-Wno-unused-function"], - }) + copts, - linkopts = select({ - "//build_config:emscripten": xnnpack_emscripten_test_linkopts(), - "//conditions:default": [], - }) + linkopts, - linkstatic = True, - defines = defines, - deps = [ - "@com_google_googletest//:gtest_main", - ] + deps + select({ - "//build_config:emscripten": xnnpack_emscripten_deps(), - "//conditions:default": [], - }), - tags = tags, - timeout = timeout, - shard_count = shard_count, - **kwargs, - ) - else: - native.cc_binary( - name = name, - srcs = srcs, - copts = xnnpack_std_cxxopts() + [ - "-Iinclude", - "-Isrc", - ] + select({ - "//build_config:windows_x86_64_mingw": mingw_copts, - "//build_config:windows_x86_64_msys": msys_copts, - "//conditions:default": [], - }) + select({ - "//build_config:windows_x86_64_clang": ["/clang:-Wno-unused-function"], - "//build_config:windows_x86_64_mingw": ["-Wno-unused-function"], - "//build_config:windows_x86_64_msys": ["-Wno-unused-function"], - "//build_config:windows_x86_64": [], - "//conditions:default": ["-Wno-unused-function"], - }) + copts, - linkopts = select({ - "//build_config:emscripten": xnnpack_emscripten_test_linkopts(), - "//conditions:default": [], - }), - linkstatic = True, - defines = defines, - deps = [ - "@com_google_googletest//:gtest_main", - ] + deps + select({ - "//build_config:emscripten": xnnpack_emscripten_deps(), - "//conditions:default": [], - }), - testonly = True, - tags = tags, - **kwargs, - ) + native.cc_test( + name = name, + srcs = srcs, + copts = xnnpack_std_cxxopts() + [ + "-Iinclude", + "-Isrc", + ] + select({ + "//build_config:windows_x86_64_mingw": mingw_copts, + "//build_config:windows_x86_64_msys": msys_copts, + "//conditions:default": [], + }) + select({ + "//build_config:windows_x86_64_clang": ["/clang:-Wno-unused-function"], + "//build_config:windows_x86_64_mingw": ["-Wno-unused-function"], + "//build_config:windows_x86_64_msys": ["-Wno-unused-function"], + "//build_config:windows_x86_64": [], + "//conditions:default": ["-Wno-unused-function"], + }) + copts, + linkopts = select({ + "//build_config:emscripten": xnnpack_emscripten_test_linkopts(), + "//conditions:default": [], + }) + linkopts, + linkstatic = True, + defines = defines, + deps = [ + "@com_google_googletest//:gtest_main", + ] + deps + select({ + "//build_config:emscripten": xnnpack_emscripten_deps(), + "//conditions:default": [], + }), + tags = tags, + timeout = timeout, + shard_count = shard_count, + **kwargs, + ) def xnnpack_binary(name, srcs, copts = [], deps = [], linkopts = []): """Minimal binary