forked from pixie-io/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bazelrc
215 lines (184 loc) · 9.2 KB
/
.bazelrc
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Global bazelrc file, see https://docs.bazel.build/versions/master/guide.html#bazelrc.
build --incompatible_restrict_string_escapes=false
build --incompatible_require_linker_input_cc_api=false
query --incompatible_restrict_string_escapes=false
query --incompatible_require_linker_input_cc_api=false
# This is to flush bazel cache for new version of clang/gcc.
build --action_env=CLANG_COMPILER_VERSION=11.1_0
build --host_action_env=CLANG_COMPILER_VERSION=11.1_0
build:clang --action_env=CC=/opt/clang-11.1/bin/clang
build:clang --host_action_env=CC=/opt/clang-11.1/bin/clang
build:clang --action_env=CXX=/opt/clang-11.1/bin/clang++
build:clang --host_action_env=CXX=/opt/clang-11.1/bin/clang++
# Get version information into the build.
build --workspace_status_command=bazel/get_workspace_status.sh
# We only have support for python3 on the Ubuntu 20.04 image.
build --host_force_python=PY3
# Limit memory for JVM to reduce runaway usage.
startup --host_jvm_args=-Xmx1g
# For all builds, by default, exclude tests that require root or BPF privileges.
# To run a test that was filtered out:
# bazel test //path/to:test --test_tag_filter=
# Which reset the filter to empty.
build --test_tag_filters=-requires_root,-requires_bpf,-disabled
# Sets the default Apple platform to macOS.
build --apple_platform_type=macos
# Keep debug symbols (required for go binaries).
# Unfortunately, this affects C++ with -c fastbuild too.
# Upgrading io_bazel_rules_go provides a better way to do this, but that upgrade is a tangled web.
# TODO(oazizi): Remove after upgrading io_bazel_rules_go.
build --strip=never
# Give each sandbox its own tmp directory.
# This is important for //src/stirling/utils:java_test, which otherwise creates conflicting writes
# when multiple instances are running simultaneously.
# It is also generally not a bad idea, since it improves heremeticity.
# For more context, see: https://github.com/bazelbuild/bazel/issues/3236
test --sandbox_tmpfs_path=/tmp
# Build for Clang:
build:clang --linkopt -fuse-ld=lld
build:clang --host_linkopt -fuse-ld=lld
build:clang --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build:clang --host_action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build:clang --action_env=BAZEL_LINKOPTS=-lm:-static-libgcc
build:clang --host_action_env=BAZEL_LINKOPTS=-lm:-static-libgcc
# We need this to ensure that external projects are built with
# C++17 support. This is needed in some libraries like absl which
# have different behavior with C++17.
build:clang --action_env=BAZEL_CXXOPTS=-std=c++17
build:clang --host_action_env=BAZEL_CXXOPTS=-std=c++17
build:clang --action_env=BAZEL_COMPILER=clang
build:clang --host_action_env=BAZEL_COMPILER=clang
build:clang --action_env=CC=clang
build:clang --host_action_env=CC=clang
build:clang --action_env=CXX=clang++
build:clang --host_action_env=CXX=clang++
# Build for Clang using Libc++.
build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
build:libc++ --action_env=LDFLAGS=-stdlib=libc++
build:libc++ --action_env=BAZEL_CXXOPTS=-std=c++17:-stdlib=libc++
build:libc++ --action_env=BAZEL_LINKLIBS=-l%:libc++.a:-l%:libc++abi.a:-lm
build:libc++ --action_env=CC=/opt/clang-11.1-libc++/bin/clang
build:libc++ --action_env=CXX=/opt/clang-11.1-libc++/bin/clang++
build:libc++ --define use_libcpp=1
# TODO(zasgar): Remove this in next diff.
build:libc++ --copt -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
build:libc++ --build_tag_filters=-no_libcpp
build:libc++ --test_tag_filters=-no_libcpp,-requires_root,-requires_bpf,-disabled
# Build for GCC.
build:gcc --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build:gcc --action_env=BAZEL_LINKOPTS=-lm:-static-libgcc
# We need this to ensure that external projects are built with
# C++17 support. This is needed in some libraries like absl which
# have different behavior with C++17.
build:gcc --action_env=BAZEL_CXXOPTS=-std=c++17
build:gcc --action_env=BAZEL_COMPILER=gcc
build:gcc --action_env=CC=/usr/bin/gcc-10
build:gcc --action_env=CXX=/usr/bin/g++-10
# These are copts because they apply to both c++ and c files.
# In particular, upb is has issues with this that will hopefully be
# fixed upstream soon.
build:gcc --copt -Wno-error=sign-compare
build:gcc --copt -Wno-error=stringop-truncation
build:gcc --copt -Wno-error=maybe-uninitialized
build:gcc --build_tag_filters=-no_gcc
build:gcc --test_tag_filters=-no_gcc,-requires_root,-requires_bpf,-disabled
# Default build opts:
build --config=clang
# Default mac config. Same as clang except we can't statically link,
# and mac does not use libstdc++.
build:macos --action_env=BAZEL_LINKLIBS
build:macos --action_env=BAZEL_LINKOPTS
# bazel build --config asan ...
build:asan --define PL_CONFIG_ASAN=1
build:asan --copt -DPL_CONFIG_ASAN
build:asan --copt -D__SANITIZE_ADDRESS__
build:asan --copt -fsanitize=address,undefined
build:asan --linkopt -fsanitize=address,undefined
build:asan --copt -fno-sanitize=vptr
build:asan --linkopt -fno-sanitize=vptr
build:asan --copt -fsanitize-recover=all
build:asan --linkopt -ldl
build:asan --define tcmalloc=disabled
build:asan --build_tag_filters=-no_asan
build:asan --test_tag_filters=-no_asan,-requires_root,-requires_bpf,-disabled
build:asan --define signal_trace=disabled
build:asan --copt -DADDRESS_SANITIZER=1
build:asan --test_env=ASAN_SYMBOLIZER_PATH
build:asan --test_env=ASAN_OPTIONS=handle_abort=1:allow_addr2line=true
build:asan --test_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
build:asan --define tcmalloc=disabled
# Clang-10 requires additional linkopts to make sure ubsan is linked in correctly.
build:asan --linkopt=-L/opt/clang-11.1/lib/clang/11.1.0/lib/linux
build:asan --linkopt=-l:libclang_rt.ubsan_standalone-x86_64.a
build:asan --linkopt=-l:libclang_rt.ubsan_standalone_cxx-x86_64.a
# bazel build --config msan
build:msan --define PL_CONFIG_MSAN=1
build:msan --copt -fsanitize=memory
build:msan --linkopt -fsanitize=memory
build:msan --define tcmalloc=disabled
build:msan --build_tag_filters=-no_msan
build:msan --test_tag_filters=-no_msan,-requires_root,-requires_bpf,-disabled
build:msan --copt -fsanitize-memory-track-origins=2
build:msan --define tcmalloc=disabled
build:msan --copt -DMEMORY_SANITIZER=1
# bazel build --config tsan
build:tsan --define PL_CONFIG_TSAN=1
build:tsan --copt -fsanitize=thread
build:tsan --copt -fsanitize-recover=all
build:tsan --linkopt -fsanitize=thread
build:tsan --define tcmalloc=disabled
build:tsan --build_tag_filters=-no_tsan
build:tsan --test_tag_filters=-no_tsan,-requires_root,-requires_bpf,-disabled
build:tsan --define tcmalloc=disabled
build:tsan --copt -DTHREAD_SANITIZER=1
# This is needed to address false positive problem with abseil.
# https://github.com/google/sanitizers/issues/953
build:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0
# Note that we are lumping tests that require root into the BPF tests below
# to minimize number of configs.
# If there are ever a lot of tests with requires_root, a new config is warranted.
# Note 2: BPF tests are limited to --jobs=4, because otherwise the parallel tests
# cause a lot of flakiness. In particular, many of the BPF tests deploy containers,
# and the sudden deployment of too many containers causes some containers to get
# stuck for minutes without actually running.
# bazel build --config bpf
build:bpf --build_tag_filters=requires_bpf,requires_root
build:bpf --test_tag_filters=requires_bpf,requires_root,-disabled
test:bpf --jobs=4 --strategy=TestRunner=standalone
# bazel build --config bpf_asan
# Need to repeat the negative build_tag_filters from config=asan,
# because the positive build_tag_filters here can re-enable such tests.
build:bpf_asan --config=asan
build:bpf_asan --build_tag_filters=requires_bpf,requires_root,-no_asan
build:bpf_asan --test_tag_filters=requires_bpf,requires_root,-no_asan,-disabled
test:bpf_asan --jobs=4 --strategy=TestRunner=standalone
# bazel build --config bpf_tsan
# Need to repeat the negative build_tag_filters from config=tsan,
# because the positive build_tag_filters here can re-enable such tests.
build:bpf_tsan --config=tsan
build:bpf_tsan --build_tag_filters=requires_bpf,requires_root,-no_tsan
build:bpf_tsan --test_tag_filters=requires_bpf,requires_root,-no_tsan,-disabled
test:bpf_tsan --jobs=4 --strategy=TestRunner=standalone
coverage --config=gcc
coverage --cxxopt -fprofile-arcs
coverage --cxxopt -ftest-coverage
coverage --instrument_test_targets
coverage --define PL_COVERAGE=true
coverage --copt -DPL_COVERAGE
coverage --test_tag_filters=-requires_root,-requires_bpf,-no_coverage,-disabled,-no_gcc
# Uploading to BES from the coverage build seems to fail on jenkins.
coverage --experimental_build_event_upload_strategy=local
# Use stable GIT build tag by default.
build --define BUNDLE_VERSION={STABLE_BUILD_TAG}
# jenkins.bazelrc is copied from ci/jenkins.bazelrc by Jenkins workers during the build.
# The intention is to avoid polluting configurations of bazel for developers.
try-import %workspace%/jenkins.bazelrc
# Put your own configurations into user.bazelrc, which is ignored by git.
try-import %workspace%/user.bazelrc
# Import a machine specific bazelrc. This can be used to enable caching.
try-import /etc/bazelrc
try-import %workspace%/bes.bazelrc
# Tensorflow requires this option
common --experimental_repo_remote_exec
# Try Stirling flakes more than the default 3 times.
test --flaky_test_attempts=//src/stirling/source_connectors/socket_tracer/.*bpf_test@5