Unverified Commit 445e02dd authored by Andrew Kolos's avatar Andrew Kolos Committed by GitHub

fix `--exit` flag in dev/devicelab/bin/run.dart (#134162)

Fixes #134154 

This PR also changes the default value of the `--exit` flag from `true` to `false`. Effectively, this is not a change in behavior since `--exit` didn't previously work.
parent ea351694
......@@ -293,7 +293,6 @@ ArgParser createArgParser(List<String> taskNames) {
)
..addFlag(
'exit',
defaultsTo: true,
help: 'Exit on the first test failure. Currently flakes are intentionally (though '
'incorrectly) not considered to be failures.',
)
......
......@@ -47,8 +47,8 @@ Future<void> runTasks(
}) async {
for (final String taskName in taskNames) {
TaskResult result = TaskResult.success(null);
int retry = 0;
while (retry <= Cocoon.retryNumber) {
int failureCount = 0;
while (failureCount <= Cocoon.retryNumber) {
result = await rerunTask(
taskName,
deviceId: deviceId,
......@@ -66,11 +66,14 @@ Future<void> runTasks(
);
if (!result.succeeded) {
retry += 1;
failureCount += 1;
if (exitOnFirstTestFailure) {
break;
}
} else {
section('Flaky status for "$taskName"');
if (retry > 0) {
print('Total ${retry+1} executions: $retry failures and 1 false positive.');
if (failureCount > 0) {
print('Total ${failureCount+1} executions: $failureCount failures and 1 false positive.');
print('flaky: true');
// TODO(ianh): stop ignoring this failure. We should set exitCode=1, and quit
// if exitOnFirstTestFailure is true.
......@@ -84,7 +87,7 @@ Future<void> runTasks(
if (!result.succeeded) {
section('Flaky status for "$taskName"');
print('Consistently failed across all $retry executions.');
print('Consistently failed across all $failureCount executions.');
print('flaky: false');
exitCode = 1;
if (exitOnFirstTestFailure) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment