From 882f1e2a9ad6ca608c173791c4fad403e93deafb Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Wed, 27 Jul 2022 14:48:24 +0000 Subject: [PATCH] Treat UnitTests failures as presubmit --all errors When upload presubmits are being run then GetUnitTests would treat errors as warnings, so as to not stop developers from uploading their changes. This makes sense when patches are being manually uploaded, but doesn't make sense when running a "git cl presubmit --all --upload" bot. This behavior caused nine failures (but not all failures) to be missed when doing these tests. This change makes these failures errors when testing with --all --upload, but leaves them as warnings for other --upload purposes. Bug: 1309977 Change-Id: Ibf149475e4cdee10bbbbc86fd0ab668b7a679089 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3788227 Reviewed-by: Jesse McKenna Commit-Queue: Bruce Dawson --- presubmit_canned_checks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index d854ce88a..81f91f5f1 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -796,8 +796,9 @@ def GetUnitTests(input_api, maybe_shebang = f.readline() return maybe_shebang.startswith('#!') and 'python3' in maybe_shebang - # We don't want to hinder users from uploading incomplete patches. - if input_api.is_committing: + # We don't want to hinder users from uploading incomplete patches, but we do + # want to report errors as errors when doing presubmit --all testing. + if input_api.is_committing or input_api.no_diffs: message_type = output_api.PresubmitError else: message_type = output_api.PresubmitPromptWarning