Skip to content

[libc][bazel] Fold "libc_function_deps" into "deps" for libc_tests. #135835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ When performing tests we make sure to always use the internal version.
load("//libc:libc_build_rules.bzl", "libc_common_copts")
load("//libc:libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")

def libc_test(name, libc_function_deps = [], copts = [], deps = [], local_defines = [], **kwargs):
def libc_test(name, copts = [], deps = [], local_defines = [], **kwargs):
"""Add target for a libc test.

Args:
name: Test target name
libc_function_deps: List of libc_function targets used by this test.
copts: The list of options to add to the C++ compilation command.
deps: The list of other libraries to be linked in to the test target.
deps: The list of libc functions and libraries to be linked in.
local_defines: The list of target local_defines if any.
**kwargs: Attributes relevant for a cc_test.
"""
Expand All @@ -37,7 +36,7 @@ def libc_test(name, libc_function_deps = [], copts = [], deps = [], local_define
"//libc:func_free",
"//libc:func_malloc",
"//libc:func_realloc",
] + libc_function_deps + deps,
] + deps,
copts = copts + libc_common_copts(),
linkstatic = 1,
**kwargs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
"CImagTest.h",
func_name + "_test.cpp",
],
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
deps = [
deps = ["//libc:func_name".replace("func_name", func_name)] + [
"//libc:hdr_math_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -29,8 +28,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
"ConjTest.h",
func_name + "_test.cpp",
],
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
deps = [
deps = ["//libc:func_name".replace("func_name", func_name)] + [
"//libc:hdr_math_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -51,8 +49,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
"CprojTest.h",
func_name + "_test.cpp",
],
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
deps = [
deps = ["//libc:func_name".replace("func_name", func_name)] + [
"//libc:hdr_math_macros",
"//libc/test/UnitTest:fp_test_helpers",
] + (["//libc/utils/MPCWrapper:mpc_wrapper"] if func_name == "cprojf" else []),
Expand All @@ -73,8 +70,7 @@ load("//libc/test:libc_test_rules.bzl", "libc_test")
"CRealTest.h",
func_name + "_test.cpp",
],
libc_function_deps = ["//libc:func_name".replace("func_name", func_name)],
deps = [
deps = ["//libc:func_name".replace("func_name", func_name)] + [
"//libc:hdr_math_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand Down
52 changes: 17 additions & 35 deletions utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ libc_test(
"exception_status_test.cpp",
"excepts.h",
],
libc_function_deps = [
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:feclearexcept",
"//libc:feraiseexcept",
"//libc:fesetexcept",
"//libc:fetestexcept",
],
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:hdr_fenv_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -35,11 +33,9 @@ libc_test(
"excepts.h",
"rounding_mode_test.cpp",
],
libc_function_deps = [
deps = [
"//libc:fegetround",
"//libc:fesetround",
],
deps = [
"//libc:hdr_fenv_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -51,16 +47,14 @@ libc_test(
"enabled_exceptions_test.cpp",
"excepts.h",
],
libc_function_deps = [
"//libc:feclearexcept",
"//libc:feraiseexcept",
"//libc:fetestexcept",
],
tags = ["nosan"],
deps = [
"//libc:__support_common",
"//libc:__support_fputil_fenv_impl",
"//libc:__support_macros_properties_architectures",
"//libc:feclearexcept",
"//libc:feraiseexcept",
"//libc:fetestexcept",
"//libc:hdr_fenv_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -72,14 +66,12 @@ libc_test(
"excepts.h",
"feholdexcept_test.cpp",
],
libc_function_deps = [
"//libc:feholdexcept",
],
tags = ["nosan"],
deps = [
"//libc:__support_common",
"//libc:__support_fputil_fenv_impl",
"//libc:__support_macros_properties_architectures",
"//libc:feholdexcept",
"//libc:hdr_fenv_macros",
"//libc:types_fenv_t",
"//libc/test/UnitTest:fp_test_helpers",
Expand All @@ -92,13 +84,11 @@ libc_test(
"exception_flags_test.cpp",
"excepts.h",
],
libc_function_deps = [
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:fegetexceptflag",
"//libc:fesetexceptflag",
"//libc:fetestexceptflag",
],
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:hdr_fenv_macros",
"//libc:types_fexcept_t",
"//libc/test/UnitTest:fp_test_helpers",
Expand All @@ -111,11 +101,9 @@ libc_test(
"excepts.h",
"feclearexcept_test.cpp",
],
libc_function_deps = [
"//libc:feclearexcept",
],
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:feclearexcept",
"//libc:hdr_fenv_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -127,14 +115,12 @@ libc_test(
"excepts.h",
"feenableexcept_test.cpp",
],
libc_function_deps = [
"//libc:fedisableexcept",
"//libc:feenableexcept",
"//libc:fegetexcept",
],
deps = [
"//libc:__support_common",
"//libc:__support_macros_properties_architectures",
"//libc:fedisableexcept",
"//libc:feenableexcept",
"//libc:fegetexcept",
"//libc:hdr_fenv_macros",
"//libc/test/UnitTest:fp_test_helpers",
],
Expand All @@ -146,11 +132,9 @@ libc_test(
"excepts.h",
"feupdateenv_test.cpp",
],
libc_function_deps = [
"//libc:feupdateenv",
],
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:feupdateenv",
"//libc:hdr_fenv_macros",
"//libc:types_fenv_t",
"//libc/test/UnitTest:fp_test_helpers",
Expand All @@ -163,15 +147,13 @@ libc_test(
"excepts.h",
"getenv_and_setenv_test.cpp",
],
libc_function_deps = [
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:__support_macros_properties_os",
"//libc:fegetenv",
"//libc:fegetround",
"//libc:fesetenv",
"//libc:fesetround",
],
deps = [
"//libc:__support_fputil_fenv_impl",
"//libc:__support_macros_properties_os",
"//libc:hdr_fenv_macros",
"//libc:types_fenv_t",
"//libc/test/UnitTest:fp_test_helpers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ licenses(["notice"])
libc_test(
name = "imaxabs_test",
srcs = ["imaxabs_test.cpp"],
libc_function_deps = [
deps = [
"//libc:imaxabs",
],
)

libc_test(
name = "imaxdiv_test",
srcs = ["imaxdiv_test.cpp"],
libc_function_deps = [
"//libc:imaxdiv",
],
deps = [
"//libc:imaxdiv",
"//libc/test/src/stdlib:div_test_helper",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def math_test(name, hdrs = [], deps = [], **kwargs):
libc_test(
name = test_name,
srcs = [test_name + ".cpp"] + hdrs,
libc_function_deps = ["//libc:func_name".replace("func_name", name)],
deps = [
deps = ["//libc:func_name".replace("func_name", name)] + [
"//libc:__support_cpp_algorithm",
"//libc:__support_cpp_bit",
"//libc:__support_cpp_limits",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ bit_prefix_list = [
libc_test(
name = bit_prefix + bit_suffix + "_test",
srcs = [bit_prefix + bit_suffix + "_test.cpp"],
libc_function_deps = ["//libc:func_name".replace(
"func_name",
bit_prefix + bit_suffix,
)],
deps = ["//libc:__support_cpp_limits"],
deps = [
"//libc:func_name".replace(
"func_name",
bit_prefix + bit_suffix,
),
] + ["//libc:__support_cpp_limits"],
)
for bit_prefix in bit_prefix_list
for bit_suffix in bit_suffix_list
Expand Down
Loading
Loading