diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py index 5a18e396f..dc3408aa8 100755 --- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py +++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py @@ -280,15 +280,21 @@ CMAKE = (cmake_tests, ) # @filter_paths(endswith=(*format_code.C_FORMAT.extensions, '.bzl', 'BUILD')) def bazel_test(ctx: PresubmitContext): - call('bazel', - 'test', - '//...', - '--verbose_failures', - '--verbose_explanations', - '--worker_verbose', - '--symlink_prefix', - ctx.output_directory.joinpath('bazel-'), - cwd=ctx.repository_root) + try: + call('bazel', + 'test', + '//...', + '--verbose_failures', + '--verbose_explanations', + '--worker_verbose', + '--symlink_prefix', + ctx.output_directory.joinpath('bazel-'), + cwd=ctx.repository_root) + except: + _LOG.info('If the Bazel build inexplicably fails while the ' + 'other builds are passing, try deleting the Bazel cache:\n' + ' rm -rf ~/.cache/bazel') + raise BAZEL = (bazel_test, )