From 529b27152068f02fc67dba6e4bb88be918220827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Thu, 22 Aug 2019 10:18:53 +0200 Subject: Don't excessively check all output files for failures This is really just an optimization, but I suspect the author of the code assumed that the bitwise &= operator short-cicuits. (It doesn't). So this patch should then fix the code to have the intended behavior. We don't have to check for failures in the remaining output files once we've found one. pullFiles() returns just a bool indicating if one of the output files has a recorded fail, so checking the remaining output files after the first found failure is just a waste (and ideally they should contain the same failure (however, flaky tests might break this ideal)). Drive-by fix. Change-Id: I951e500a69198e7ed124be32199ac81bbddb9bf7 Reviewed-by: BogDan Vatra --- src/tools/androidtestrunner/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp index a035e068bc..f61d407d4a 100644 --- a/src/tools/androidtestrunner/main.cpp +++ b/src/tools/androidtestrunner/main.cpp @@ -409,7 +409,7 @@ static bool pullFiles() return false; } auto checkerIt = g_options.checkFiles.find(it.key()); - ret &= checkerIt != g_options.checkFiles.end() && checkerIt.value()(output); + ret = ret && checkerIt != g_options.checkFiles.end() && checkerIt.value()(output); if (it.value() == QStringLiteral("-")){ fprintf(stdout, "%s", output.constData()); fflush(stdout); -- cgit v1.2.3