summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-06-02 15:24:33 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-02 15:24:33 -0700
commitb062821d3ec2efa4aacff94ba2b501fc2c05bc1b (patch)
treec1f5aa7b8934cbe50625f34f6bc8cb7684f3e546
parent4b5eae39f201ffbe7f4a0e08a28380099469efe8 (diff)
parent5e4d7072a657be4a8ef1f7fb86c77c09651315e7 (diff)
Merge pull request #2837 from avagin:make-startup-option
PiperOrigin-RevId: 314415164
-rw-r--r--.travis.yml5
-rw-r--r--Makefile4
-rw-r--r--tools/bazel.mk12
3 files changed, 14 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml
index 40c8773fa..fbc0e46d7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,10 @@ jobs:
- os: linux
arch: arm64
script:
- - uname -a && make smoke-test
+ # On arm64, we need to create our own pipes for stderr and stdout,
+ # otherwise we will not be able to open /dev/stderr. This is probably
+ # due to AppArmor rules.
+ - uname -a && make smoke-test 2>&1 | cat
branches:
except:
# Skip copybara branches.
diff --git a/Makefile b/Makefile
index c313e34a7..d6cd9ec03 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@
# Described below.
OPTIONS :=
+STARTUP_OPTIONS :=
TARGETS := //runsc
ARGS :=
@@ -24,7 +25,7 @@ default: runsc
## usage: make <target>
## or
-## make <build|test|copy|run|sudo> OPTIONS="..." TARGETS="..." ARGS="..."
+## make <build|test|copy|run|sudo> STARTUP_OPTIONS="..." OPTIONS="..." TARGETS="..." ARGS="..."
##
## Basic targets.
##
@@ -33,6 +34,7 @@ default: runsc
## requirements.
##
## There are common arguments that may be passed to targets. These are:
+## STARTUP_OPTIONS - Bazel startup options.
## OPTIONS - Build or test options.
## TARGETS - The bazel targets.
## ARGS - Arguments for run or sudo.
diff --git a/tools/bazel.mk b/tools/bazel.mk
index b774c8fab..9f4a40669 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -93,14 +93,16 @@ bazel-server: ## Ensures that the server exists. Used as an internal target.
@docker exec $(DOCKER_NAME) true || $(MAKE) bazel-server-start
.PHONY: bazel-server
-build_paths = docker exec --user $(UID):$(GID) -i $(DOCKER_NAME) sh -o pipefail -c 'bazel build $(OPTIONS) $(TARGETS) 2>&1 \
- | tee /dev/fd/2 \
+build_cmd = docker exec --user $(UID):$(GID) -i $(DOCKER_NAME) sh -o pipefail -c 'bazel $(STARTUP_OPTIONS) build $(OPTIONS) $(TARGETS)'
+
+build_paths = $(build_cmd) 2>&1 \
+ | tee /proc/self/fd/2 \
| grep -E "^ bazel-bin/" \
- | awk "{print $$1;}"' \
+ | awk "{print $$1;}" \
| xargs -n 1 -I {} sh -c "$(1)"
build: bazel-server
- @$(call build_paths,echo {})
+ @$(call build_cmd)
.PHONY: build
copy: bazel-server
@@ -118,5 +120,5 @@ sudo: bazel-server
.PHONY: sudo
test: bazel-server
- @docker exec --user $(UID):$(GID) -i $(DOCKER_NAME) bazel test $(OPTIONS) $(TARGETS)
+ @docker exec --user $(UID):$(GID) -i $(DOCKER_NAME) bazel $(STARTUP_OPTIONS) test $(OPTIONS) $(TARGETS)
.PHONY: test