Skip to content

Commit

Permalink
Remove the automatic argument (and accompanying code) from the `xnn…
Browse files Browse the repository at this point in the history
…pack_unit_test()` macro in build_defs.bzl, as none of the current callers ever pass a non-default value for it.

PiperOrigin-RevId: 702798246
  • Loading branch information
xnnpack-bot committed Dec 4, 2024
1 parent 0824101 commit f93237e
Showing 1 changed file with 35 additions and 71 deletions.
106 changes: 35 additions & 71 deletions build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit f93237e

Please sign in to comment.