forked from pixie-io/pixie
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBUILD.bazel
More file actions
91 lines (84 loc) · 3.88 KB
/
BUILD.bazel
File metadata and controls
91 lines (84 loc) · 3.88 KB
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
# Copyright 2018- The Pixie Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
load("@io_bazel_rules_go//go:def.bzl", "go_cross_binary", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary", "pl_go_sdk_version_template_to_label", "pl_supported_go_sdk_versions")
package(default_visibility = ["//src/stirling:__subpackages__"])
go_library(
name = "lib",
srcs = ["test_go_binary.go"],
importpath = "px.dev/pixie/src/stirling/obj_tools/testdata/go",
)
pl_go_binary(
name = "test_go_binary",
embed = [":lib"],
gc_goopts = select({
"//bazel:debug_build": [],
"//conditions:default": [
"-N",
"-l",
],
}),
)
[
go_cross_binary(
name = pl_go_sdk_version_template_to_label("test_go_%s_binary", sdk_version),
sdk_version = sdk_version,
tags = ["manual"],
target = ":test_go_binary",
)
for sdk_version in pl_supported_go_sdk_versions
]
genrule(
name = "test_go_1_19_nm_output_target",
srcs = [":test_go_1_19_binary"],
outs = ["test_go_1_19_nm_output"],
cmd = "$(NM) $(location :test_go_1_19_binary) > $(location test_go_1_19_nm_output)",
toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"],
)
filegroup(
name = "test_binaries",
testonly = True,
srcs = [
"sockshop_payments_service",
# This binary was built with go 1.13 for GOARCH=386. This ensures that the 32 bit little
# endian case buildinfo logic is tested
# (https://github.com/golang/go/blob/1dbbafc70fd3e2c284469ab3e0936c1bb56129f6/src/debug/buildinfo/buildinfo.go#L192-L208).
# Newer versions of go generate the endian agnostic buildinfo header
# (https://github.com/golang/go/blob/1dbbafc70fd3e2c284469ab3e0936c1bb56129f6/src/debug/buildinfo/buildinfo.go#L189-L190)
# and so it cannot be tested without compiling against an older Go version.
# These older 32 bit binaries have been the source of bugs, so this test case verifies we don't
# introduce a regression (https://github.com/pixie-io/pixie/issues/1300).
"test_go1_13_i386_binary",
# This binary was built with go 1.11. This ensures that ReadBuildVersion works for Go 1.11 and earlier
# binaries that don't have the .go.buildinfo section.
"test_go_1_11_binary",
# This binary was built with go 1.17. This ensures that the 64 bit little endian case buildinfo logic is tested.
# (https://github.com/golang/go/blob/1dbbafc70fd3e2c284469ab3e0936c1bb56129f6/src/debug/buildinfo/buildinfo.go#L192-L208).
# Newer versions of go generate the endian agnostic buildinfo header
# (https://github.com/golang/go/blob/1dbbafc70fd3e2c284469ab3e0936c1bb56129f6/src/debug/buildinfo/buildinfo.go#L189-L190)
# and so it cannot be tested without compiling against an older Go version.
"test_go_1_17_binary",
# TODO(ddelnano): rules_go doesn't support populating .buildinfo with dependency information (https://github.com/bazel-contrib/rules_go/issues/3090).
# Once this is supported, test_buildinfo_with_mods should be replaced with a bazel built binary.
"test_buildinfo_with_mods",
":test_go_1_18_binary",
":test_go_1_19_binary",
":test_go_1_20_binary",
":test_go_1_21_binary",
":test_go_1_22_binary",
":test_go_1_23_binary",
],
)