From 5c1687045f2370b90c7a930c49f378e290689f22 Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Mon, 25 Mar 2024 11:35:47 -0700 Subject: [PATCH] Option to set bazel's `--test_output` flag to another value than `errors`. This is useful to debug long-running or stuck tests, as with `--test_output=errors` the log is only shown when the test fails or times out. PiperOrigin-RevId: 618908605 --- tools/bazel.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/bazel.mk b/tools/bazel.mk index 95acd7e35..7796d58b6 100644 --- a/tools/bazel.mk +++ b/tools/bazel.mk @@ -72,14 +72,18 @@ PRE_BAZEL_INIT ?= ## to control which flags are passed: ## ## STARTUP_OPTIONS - Startup options passed to Bazel. +## BAZEL_TEST_OUTPUT - Test output policy; shown on failures only by +## default, set to "streamed" to show test logs as +## they happen. ## STARTUP_OPTIONS := BAZEL_OPTIONS ?= BAZEL_REMOTE_CACHE ?= BAZEL := bazel $(STARTUP_OPTIONS) BASE_OPTIONS := --color=no --curses=no $(BAZEL_REMOTE_CACHE) +BAZEL_TEST_OUTPUT ?= errors TEST_OPTIONS += $(BASE_OPTIONS) \ - --test_output=errors \ + --test_output=$(BAZEL_TEST_OUTPUT) \ --keep_going \ --verbose_failures=true \ --build_event_json_file=.build_events.json