summaryrefslogtreecommitdiff
path: root/test/BUILD
blob: 65b2c2fe04680e41cb0a3cc2693d8af601d841eb (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
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 = ["//:__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",
    deps = ["main_objc"],
)