Skip to content

Commit

Permalink
fix --exit flag in dev/devicelab/bin/run.dart (#134162)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewkolos authored Sep 7, 2023
1 parent ea35169 commit 445e02d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion dev/devicelab/bin/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
)
Expand Down
15 changes: 9 additions & 6 deletions dev/devicelab/lib/framework/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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) {
Expand Down

0 comments on commit 445e02d

Please sign in to comment.