summaryrefslogtreecommitdiffhomepage
path: root/tools/bazel.mk
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-06 11:30:03 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-06 11:30:03 -0700
commit0d69bfa8aacb864274e11b5c66f19cd8c0d07e5c (patch)
treecf18a398cb913dd3404b35f1166e5667f169391a /tools/bazel.mk
parent72b528c840342111c6e9dd5b13cc5c893707dad6 (diff)
parentc5f5806fe69e8d4be99341318f20ce0acfd7be2a (diff)
Merge pull request #3511 from amscanne:packetimpact-tests
PiperOrigin-RevId: 325269275
Diffstat (limited to 'tools/bazel.mk')
-rw-r--r--tools/bazel.mk13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk
index 82fe11a03..3e27af7d1 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -33,8 +33,8 @@ GCLOUD_CONFIG := $(shell readlink -m ~/.config/gcloud/)
DOCKER_SOCKET := /var/run/docker.sock
# Bazel flags.
-OPTIONS += --test_output=errors --keep_going --verbose_failures=true
BAZEL := bazel $(STARTUP_OPTIONS)
+OPTIONS += --color=no --curses=no
# Basic options.
UID := $(shell id -u ${USER})
@@ -143,12 +143,13 @@ bazel-server: ## Ensures that the server exists. Used as an internal target.
@docker exec $(FULL_DOCKER_EXEC_OPTIONS) $(DOCKER_NAME) true || $(MAKE) bazel-server-start
.PHONY: bazel-server
-build_cmd = docker exec $(FULL_DOCKER_EXEC_OPTIONS) $(DOCKER_NAME) sh -o pipefail -c '$(BAZEL) build $(OPTIONS) $(TARGETS)'
+build_cmd = docker exec $(FULL_DOCKER_EXEC_OPTIONS) $(DOCKER_NAME) sh -o pipefail -c '$(BAZEL) build $(OPTIONS) "$(TARGETS)"'
build_paths = $(build_cmd) 2>&1 \
| tee /proc/self/fd/2 \
| grep -E "^ bazel-bin/" \
- | awk "{print $$1;}" \
+ | tr -d '\r' \
+ | awk '{$$1=$$1};1' \
| xargs -n 1 -I {} sh -c "$(1)"
build: bazel-server
@@ -169,10 +170,12 @@ sudo: bazel-server
@$(call build_paths,sudo -E {} $(ARGS))
.PHONY: sudo
+test: OPTIONS += --test_output=errors --keep_going --verbose_failures=true
test: bazel-server
@docker exec $(FULL_DOCKER_EXEC_OPTIONS) $(DOCKER_NAME) $(BAZEL) test $(OPTIONS) $(TARGETS)
.PHONY: test
-query: bazel-server
- @docker exec $(FULL_DOCKER_EXEC_OPTIONS) $(DOCKER_NAME) $(BAZEL) query $(OPTIONS) '$(TARGETS)'
+query:
+ @$(MAKE) bazel-server >&2 # If we need to start, ensure stdout is not polluted.
+ @docker exec $(FULL_DOCKER_EXEC_OPTIONS) $(DOCKER_NAME) sh -o pipefail -c '$(BAZEL) query $(OPTIONS) "$(TARGETS)" 2>/dev/null'
.PHONY: query