aboutsummaryrefslogtreecommitdiff
path: root/tests/core/go_binary/BUILD.bazel
blob: 99a2d784925147ca5c878a7ac02d6639aeff26d5 (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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
load(":many_deps.bzl", "many_deps")

test_suite(name = "go_binary")

go_bazel_test(
    name = "configurable_attribute_bad_test",
    srcs = ["configurable_attribute_bad_test.go"],
)

go_bazel_test(
    name = "configurable_attribute_good_test",
    srcs = ["configurable_attribute_good_test.go"],
)

go_binary(
    name = "hello",
    srcs = ["hello.go"],
    visibility = ["//visibility:public"],
)

go_test(
    name = "go_default_test",
    srcs = ["out_test.go"],
    data = [":custom_bin"],
)

go_bazel_test(
    name = "package_conflict_test",
    srcs = ["package_conflict_test.go"],
)

go_binary(
    name = "custom_bin",
    srcs = ["custom_bin.go"],
    out = "alt_bin",
)

go_binary(
    name = "goos_pure_bin",
    srcs = [
        "broken_cgo.go",
        "hello.go",
    ],
    goarch = "amd64",
    goos = "plan9",
)

many_deps(name = "many_deps")

go_test(
    name = "stamp_test",
    srcs = ["stamp_test.go"],
    data = [":stamp_bin"],
    rundir = ".",
    deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"],
)

go_binary(
    name = "stamp_bin",
    srcs = ["stamp_bin.go"],
    embed = [":stamp_embed"],
    x_defs = {
        "Bin": "Bin",
        "example.com/stamp_dep.DepBin": "DepBin",
    },
    deps = [":stamp_dep"],
)

go_library(
    name = "stamp_embed",
    srcs = ["stamp_embed.go"],
    importpath = "example.com/stamp_embed",
    x_defs = {
        "Embed": "Embed",
    },
)

go_library(
    name = "stamp_dep",
    srcs = ["stamp_dep.go"],
    importpath = "example.com/stamp_dep",
    x_defs = {
        "DepSelf": "DepSelf",
    },
)

go_binary(
    name = "hello_pie_bin",
    srcs = ["hello.go"],
    cgo = True,
    linkmode = "pie",
    tags = ["manual"],
)

go_binary(
    name = "hello_nopie_bin",
    srcs = ["hello.go"],
    cgo = True,
    tags = ["manual"],
)

go_test(
    name = "pie_test",
    srcs = [
        "pie_darwin_amd64_test.go",
        "pie_darwin_test.go",
        "pie_linux_test.go",
    ],
    data = select({
        "@io_bazel_rules_go//go/platform:darwin": [
            ":hello_nopie_bin",
            ":hello_pie_bin",
        ],
        "@io_bazel_rules_go//go/platform:linux": [
            ":hello_nopie_bin",
            ":hello_pie_bin",
        ],
        "//conditions:default": [],
    }),
    rundir = ".",
    deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"],
)

go_test(
    name = "static_test",
    srcs = ["static_test.go"],
    data = select({
        "@io_bazel_rules_go//go/platform:linux": [
            ":static_bin",
            ":static_cgo_bin",
            ":static_pure_bin",
        ],
        "//conditions:default": [],
    }),
    rundir = ".",
    deps = ["//go/tools/bazel:go_default_library"],
)

go_binary(
    name = "static_bin",
    srcs = ["static_bin.go"],
    static = "on",
    tags = ["manual"],
    deps = ["@org_golang_x_sys//unix:go_default_library"],
)

go_binary(
    name = "static_cgo_bin",
    srcs = ["static_cgo_bin.go"],
    cgo = True,
    static = "on",
    tags = ["manual"],
)

go_binary(
    name = "static_pure_bin",
    srcs = ["static_pure_bin.go"],
    pure = "on",
    static = "on",
    tags = ["manual"],
)

go_binary(
    name = "tags_bin",
    srcs = [
        "tags_main_bad.go",
        "tags_main_good.go",
    ],
    gotags = ["good"],
    deps = [":tags_lib"],
)

go_library(
    name = "tags_lib",
    srcs = [
        "tags_lib_bad.go",
        "tags_lib_good.go",
    ],
    importpath = "tags_lib",
    tags = ["manual"],
)

go_binary(
    name = "prefix",
    embed = ["//tests/core/go_binary/prefix"],
)

go_bazel_test(
    name = "non_executable_test",
    srcs = ["non_executable_test.go"],
)