Use bazel flags to silence logs (#3617)
This replaces a custom regex-based solution
diff --git a/scripts/utils.py b/scripts/utils.py
index 18d9f8f..870044b 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -21,11 +21,6 @@
import subprocess
from typing import Sequence
-BAZEL_FILTERS = [
- r'Loading: [0-9]+ packages loaded',
- r'.*Using python binary from PYTHON_BIN = .*'
-]
-
def create_markdown_table(rows: Sequence[Sequence[str]]):
"""Converts a 2D array to a Markdown table."""
@@ -34,8 +29,7 @@
def check_and_get_output_lines(command: Sequence[str],
dry_run: bool = False,
- log_stderr: bool = True,
- stderr_filters: Sequence[str] = ()):
+ log_stderr: bool = True):
print(f'Running: `{" ".join(command)}`')
if dry_run:
return None, None
@@ -46,8 +40,7 @@
if log_stderr:
for line in process.stderr.splitlines():
- if not any(re.match(pattern, line) for pattern in stderr_filters):
- print(line)
+ print(line)
process.check_returncode()
@@ -60,11 +53,18 @@
# We use two queries here because the return code for a failed query is
# unfortunately the same as the return code for a bazel configuration error.
target_dir = test_suite_path.split(':')[0]
- query = ['bazel', 'query', f'{target_dir}/...']
- targets = check_and_get_output_lines(query, stderr_filters=BAZEL_FILTERS)
+ query = [
+ 'bazel', 'query', '--ui_event_filters=-DEBUG',
+ '--noshow_loading_progress', '--noshow_progress', f'{target_dir}/...'
+ ]
+ targets = check_and_get_output_lines(query)
if test_suite_path not in targets:
return []
- query = ['bazel', 'query', f'tests({test_suite_path})']
- tests = check_and_get_output_lines(query, stderr_filters=BAZEL_FILTERS)
+ query = [
+ 'bazel', 'query', '--ui_event_filters=-DEBUG',
+ '--noshow_loading_progress', '--noshow_progress',
+ f'tests({test_suite_path})'
+ ]
+ tests = check_and_get_output_lines(query)
return tests