summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2020-08-04 20:49:00 -0700
committerAdin Scannell <ascannell@google.com>2020-08-04 20:49:00 -0700
commitc5f5806fe69e8d4be99341318f20ce0acfd7be2a (patch)
treea67130ecf0cc3f404fd0952b9cb743f0854991e8 /tools
parentaf2f456735252b8412af676a3d6ff61690fdf9a7 (diff)
Enable "make packetimpact-tests" to work.
This required minor fixes to the bazel wrapper. The "dut_platform" is also changed to "native" to line-up with the system call tests and remove the hard-coded "linux" and "netstack" strings.
Diffstat (limited to 'tools')
-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