Skip to content
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 @@ -4,13 +4,13 @@

# LLVM libc unittest library.

load("//libc:libc_build_rules.bzl", "libc_support_library")
load("//libc/test:libc_test_rules.bzl", "libc_test_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])

libc_support_library(
libc_test_library(
name = "test_logger",
srcs = ["TestLogger.cpp"],
hdrs = ["TestLogger.h"],
Expand All @@ -29,7 +29,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "LibcUnitTest",
srcs = [
"BazelFilePath.cpp",
Expand Down Expand Up @@ -73,7 +73,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "fp_test_helpers",
srcs = [
"FEnvSafeTest.cpp",
Expand Down Expand Up @@ -108,7 +108,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "memory_matcher",
srcs = [
"MemoryMatcher.cpp",
Expand All @@ -127,7 +127,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "printf_matcher",
srcs = [
"PrintfMatcher.cpp",
Expand All @@ -144,7 +144,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "string_utils",
hdrs = [
"StringUtils.h",
Expand Down
18 changes: 18 additions & 0 deletions utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,21 @@ def libc_test(name, srcs, libc_function_deps = [], copts = [], deps = [], local_
linkstatic = 1,
**kwargs
)

def libc_test_library(name, copts = [], local_defines = [], **kwargs):
"""Add target for library used in libc tests.

Args:
name: Library target name.
copts: See cc_library.copts.
local_defines: See cc_library.local_defines.
**kwargs: Other attributes relevant to cc_library (e.g. "deps").
"""
native.cc_library(
name = name,
testonly = True,
copts = copts + libc_common_copts(),
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
linkstatic = 1,
**kwargs
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

# Tests for LLVM libc stdlib.h functions.

load("//libc:libc_build_rules.bzl", "libc_support_library")
load("//libc/test:libc_test_rules.bzl", "libc_test")
load("//libc/test:libc_test_rules.bzl", "libc_test", "libc_test_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -29,7 +28,7 @@ libc_test(
libc_function_deps = ["//libc:llabs"],
)

libc_support_library(
libc_test_library(
name = "div_test_helper",
hdrs = ["DivTest.h"],
deps = ["//libc/test/UnitTest:LibcUnitTest"],
Expand Down Expand Up @@ -65,7 +64,7 @@ libc_test(
],
)

libc_support_library(
libc_test_library(
name = "atoi_test_helper",
hdrs = ["AtoiTest.h"],
deps = [
Expand Down Expand Up @@ -110,7 +109,7 @@ libc_test(
deps = ["//libc:types_size_t"],
)

libc_support_library(
libc_test_library(
name = "qsort_test_helper",
hdrs = ["SortingTest.h"],
deps = [
Expand Down Expand Up @@ -148,7 +147,7 @@ libc_test(
deps = ["//libc:types_size_t"],
)

libc_support_library(
libc_test_library(
name = "strfrom_test_helper",
hdrs = ["StrfromTest.h"],
deps = [
Expand Down Expand Up @@ -179,7 +178,7 @@ libc_test(
deps = [":strfrom_test_helper"],
)

libc_support_library(
libc_test_library(
name = "strtol_test_helper",
hdrs = ["StrtolTest.h"],
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

# Tests for LLVM libc string.h functions.

load("//libc:libc_build_rules.bzl", "libc_support_library")
load("//libc/test:libc_test_rules.bzl", "libc_test")
load("//libc/test:libc_test_rules.bzl", "libc_test", "libc_test_library")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -43,7 +42,7 @@ libc_test(
],
)

libc_support_library(
libc_test_library(
name = "strchr_test_helper",
hdrs = ["StrchrTest.h"],
deps = ["//libc/test/UnitTest:LibcUnitTest"],
Expand Down Expand Up @@ -115,7 +114,7 @@ libc_test(
],
)

libc_support_library(
libc_test_library(
name = "memory_check_utils",
hdrs = ["memory_utils/memory_check_utils.h"],
deps = [
Expand All @@ -127,7 +126,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "protected_pages",
hdrs = ["memory_utils/protected_pages.h"],
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

# Tests for LLVM libc strings.h functions.

load("//libc:libc_build_rules.bzl", "libc_support_library")
load("//libc/test:libc_test_rules.bzl", "libc_test")

package(default_visibility = ["//visibility:public"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# A wrapper library over MPC for use with LLVM libc math unittests.

load("//libc:libc_build_rules.bzl", "libc_support_library")
load("//libc/test:libc_test_rules.bzl", "libc_test_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -26,7 +26,7 @@ cc_library(
),
)

libc_support_library(
libc_test_library(
name = "mpc_wrapper",
srcs = ["MPCUtils.cpp"],
hdrs = ["MPCUtils.h"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# A wrapper library over MPFR for use with LLVM libc math unittests.

load("//libc:libc_build_rules.bzl", "libc_support_library")
load("//libc/test:libc_test_rules.bzl", "libc_test_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -26,7 +26,7 @@ cc_library(
),
)

libc_support_library(
libc_test_library(
name = "mp_common",
srcs = ["MPCommon.cpp"],
hdrs = ["MPCommon.h"],
Expand All @@ -52,7 +52,7 @@ libc_support_library(
],
)

libc_support_library(
libc_test_library(
name = "mpfr_wrapper",
srcs = ["MPFRUtils.cpp"],
hdrs = ["MPFRUtils.h"],
Expand Down