summaryrefslogtreecommitdiff
path: root/test/binary_tests.bzl
blob: db44ee2aeea9497046fa99b6e8a4c9217902d0f7 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
"""Tests verifying produced binaries"""

load(
    "//test/rules:apple_verification_test.bzl",
    "apple_verification_test",
)

def binary_test_suite(name):
    """Test various aspects of binary generation

    Args:
        name: The prefix of each test name
    """

    apple_verification_test(
        name = "{}_macos_binary_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"macos_cpus": "x86_64"},
        expected_platform_type = "macos",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:macos_binary",
    )

    apple_verification_test(
        name = "{}_macos_binary_with_spaces_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"macos_cpus": "x86_64"},
        expected_platform_type = "macos",
        generate_dsym = True,
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:macos_binary_with_spaces",
    )

    apple_verification_test(
        name = "{}_visionos_device_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"visionos_cpus": "arm64"},
        expected_platform_type = "visionos",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:visionos_binary",
    )

    apple_verification_test(
        name = "{}_visionos_arm64_simulator_test".format(name),
        tags = [name],
        build_type = "simulator",
        cpus = {"visionos_cpus": "sim_arm64"},
        expected_platform_type = "visionos",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:visionos_binary",
    )

    apple_verification_test(
        name = "{}_visionos_x86_64_simulator_test".format(name),
        tags = [name],
        build_type = "simulator",
        cpus = {"visionos_cpus": "x86_64"},
        expected_platform_type = "visionos",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:visionos_binary",
    )

    apple_verification_test(
        name = "{}_unused_symbol_is_kept_by_default".format(name),
        build_type = "simulator",
        cpus = {"ios_multi_cpus": "x86_64"},
        compilation_mode = "fastbuild",
        objc_enable_binary_stripping = False,
        verifier_script = "//test:verify_unused_symbol_exists.sh",
        target_under_test = "//test/test_data:ios_app_with_unused_symbol",
        tags = [name],
    )

    apple_verification_test(
        name = "{}_unused_symbol_is_stripped".format(name),
        build_type = "simulator",
        cpus = {"ios_multi_cpus": "x86_64"},
        compilation_mode = "opt",
        objc_enable_binary_stripping = True,
        verifier_script = "//test:verify_stripped_symbols.sh",
        target_under_test = "//test/test_data:ios_app_with_unused_symbol",
        tags = [name],
    )

    apple_verification_test(
        name = "{}_archive_timestamps".format(name),
        build_type = "simulator",
        cpus = {"ios_multi_cpus": "x86_64"},
        verifier_script = "//test:verify_archive_timestamps.sh",
        target_under_test = "//test/test_data:static_lib",
        tags = [name],
    )

    apple_verification_test(
        name = "{}_fat_static_lib".format(name),
        build_type = "simulator",
        cpus = {"ios_multi_cpus": "x86_64,sim_arm64"},
        expected_platform_type = "ios",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:static_lib",
        tags = [name],
    )

    apple_verification_test(
        name = "{}_watchos_device_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"watchos_cpus": "x86_64"},
        expected_platform_type = "watchos",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:watch_binary",
    )

    apple_verification_test(
        name = "{}_watchos_simulator_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"watchos_cpus": "arm64"},
        expected_platform_type = "watchos",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:watch_binary",
    )

    apple_verification_test(
        name = "{}_ios_device_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"ios_multi_cpus": "x86_64,sim_arm64"},
        expected_platform_type = "ios",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:ios_binary",
    )

    apple_verification_test(
        name = "{}_ios_simulator_test".format(name),
        tags = [name],
        build_type = "device",
        cpus = {"ios_multi_cpus": "arm64,arm64e"},
        expected_platform_type = "ios",
        verifier_script = "//test/shell:verify_binary.sh",
        target_under_test = "//test/test_data:ios_binary",
    )