From d757716cad143d49fa4f8c9108f30130631e02ec Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 16 Feb 2023 12:21:15 -0800 Subject: [PATCH] Disable cgo by default * We build all binaries in a build container but then we execute them in another evironments, so we don't want to have a dependency on glibc. * runsc is build without cgo, so it looks reasonable to build tests with the same flags. * If we build all packeges with the same flags, they all shares the same cache. This change adds the race config to build with the race detector: --- .bazelrc | 6 ++++++ tools/bazel.mk | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 4b85c0c94..273f5b0df 100644 --- a/.bazelrc +++ b/.bazelrc @@ -21,6 +21,12 @@ build --cxxopt=-std=c++17 # Display the current git revision in the info block. build --stamp --workspace_status_command tools/workspace_status.sh +build:race --@io_bazel_rules_go//go/config:race --@io_bazel_rules_go//go/config:pure=false +test:race --@io_bazel_rules_go//go/config:race --@io_bazel_rules_go//go/config:pure=false + +build --@io_bazel_rules_go//go/config:pure +test --@io_bazel_rules_go//go/config:pure + # Set flags for x86_64. build:x86_64 --crosstool_top=@crosstool//:toolchains build:x86_64 --cpu=k8 diff --git a/tools/bazel.mk b/tools/bazel.mk index 5d7466677..fbbbce001 100644 --- a/tools/bazel.mk +++ b/tools/bazel.mk @@ -47,7 +47,7 @@ BRANCH_NAME := $(shell (git branch --show-current 2>/dev/null || \ git rev-parse --abbrev-ref HEAD 2>/dev/null) | \ xargs -n 1 basename 2>/dev/null) BUILD_ROOTS := bazel-bin/ bazel-out/ -RACE_FLAGS := --@io_bazel_rules_go//go/config:race +RACE_FLAGS := --config=race # Bazel container configuration (see below). USER := $(shell whoami)