From 4d63202b5301828b1ddc5a6e02b551680293461f Mon Sep 17 00:00:00 2001 From: Jonas Termansen Date: Tue, 11 Dec 2018 15:24:20 +0000 Subject: [PATCH] [infra] Fix warning when pre-approving an already approved failure. This can happen if a test is approved as failing, it then is fixed, and a changelist needs to break it again, and the new failure is pre-approved. This causes approve_results to warn that it can't properly change an approval from one outcome to the exact same outcome, which is of course wrong, it can do that. Change-Id: Ib9ea1d4ea5a204b66808a1789c31fe6ec9c2c9d2 Reviewed-on: https://dart-review.googlesource.com/c/86920 Reviewed-by: William Hesse --- tools/approve_results.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/approve_results.dart b/tools/approve_results.dart index 616a27f7956d..eff1878d3d4f 100755 --- a/tools/approve_results.dart +++ b/tools/approve_results.dart @@ -171,13 +171,14 @@ Future> loadResultsFromBot(String bot, ArgResults options, // there is no approved result yet, use the latest result from the // builder instead. final baseResult = approvedResult ?? result; - if ((!wasFlake && + if (!wasFlake && !tryResult["matches"] && - tryResult["result"] != result["result"])) { + tryResult["result"] != result["result"]) { // The approved_results.json format currently does not natively // support preapproval, so preapproving turning one failure into // another will turn the builder in question red until the CL lands. - if (!baseResult["matches"]) { + if (!baseResult["matches"] && + tryResult["result"] != baseResult["result"]) { print("Warning: Preapproving changed failure modes will turn the " "CI red until the CL is submitted: $bot: $key: " "${baseResult["result"]} -> ${tryResult["result"]}");