summaryrefslogtreecommitdiff
path: root/test/BUILD
blob: fb1757602c4821293538bc97a038b26a9dfdce07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
load("//rules:apple_genrule.bzl", "apple_genrule")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load(":apple_support_test.bzl", "apple_support_test")
load(":universal_binary_test.bzl", "universal_binary_test")
load(":xcode_support_test.bzl", "xcode_support_test")
load(":starlark_apple_binary.bzl", "starlark_apple_binary")
load(":binary_tests.bzl", "binary_test_suite")
load(":linking_tests.bzl", "linking_test_suite")

licenses(["notice"])

# Custom rules that test rule-context APIs. Check their implementations for more details.
apple_support_test(name = "apple_support_test")

xcode_support_test(name = "xcode_support_test")

binary_test_suite(name = "binary")

linking_test_suite(name = "linking")

# Test to ensure the environment variable contract of apple_genrule.
sh_test(
    name = "apple_genrule_test",
    size = "small",
    srcs = ["apple_genrule_test.sh"],
    args = ["$(location simple_genrule.txt)"],
    data = ["simple_genrule.txt"],
)

build_test(
    name = "touched_test",
    targets = [":touched"],
)

apple_genrule(
    name = "simple_genrule",
    outs = ["simple_genrule.txt"],
    cmd = "printenv | grep \"^\\(DEVELOPER_DIR\\|SDKROOT\\)\" > $(@)",
)

apple_genrule(
    name = "touched",
    outs = ["genrule_touched.txt"],
    cmd = "touch $(OUTS)",
)

bzl_library(
    name = "starlark_tests_bzls",
    srcs = glob(["*.bzl"]),
    deps = [
        "//lib:apple_support",
        "//lib:xcode_support",
    ],
)

universal_binary_test(
    name = "universal_binary_test_x86_64",
    binary_contains_symbols = [
        "__Z19function_for_x86_64v",
        "__Z19function_for_arch64v",
    ],
    cpu = "darwin_x86_64",
    target_under_test = "//test/test_data:multi_arch_cc_binary",
)

universal_binary_test(
    name = "universal_binary_test_arm64",
    binary_contains_symbols = [
        "__Z19function_for_x86_64v",
        "__Z19function_for_arch64v",
    ],
    cpu = "darwin_arm64",
    target_under_test = "//test/test_data:multi_arch_cc_binary",
)

# Consumed by bazel tests.
filegroup(
    name = "for_bazel_tests",
    testonly = True,
    srcs = glob(["**"]),
    visibility = ["//test/shell:__pkg__"],
)

cc_binary(
    name = "main_c",
    srcs = ["main.c"],
)

cc_binary(
    name = "main_cpp",
    srcs = ["main.cc"],
)

objc_library(
    name = "main_objc",
    srcs = ["main.m"],
)

starlark_apple_binary(
    name = "main_apple",
    minimum_os_version = "13.0",
    platform_type = "macos",
    deps = ["main_objc"],
)

cc_library(
    name = "underlying_lib",
    hdrs = ["underlying_lib.h"],
    tags = ["manual"],
)

objc_library(
    name = "objc_lib",
    srcs = ["objc_lib.m"],
    hdrs = ["objc_lib.h"],
    tags = ["manual"],
    deps = [":underlying_lib"],
    alwayslink = True,
)

cc_test(
    name = "cc_test_with_objc_deps",
    srcs = ["cc_test_with_objc_deps.cc"],
    deps = [":objc_lib"],
)