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.
This commit is contained in:
parent
ea351694fe
commit
445e02dd63
@ -293,7 +293,6 @@ ArgParser createArgParser(List<String> taskNames) {
|
|||||||
)
|
)
|
||||||
..addFlag(
|
..addFlag(
|
||||||
'exit',
|
'exit',
|
||||||
defaultsTo: true,
|
|
||||||
help: 'Exit on the first test failure. Currently flakes are intentionally (though '
|
help: 'Exit on the first test failure. Currently flakes are intentionally (though '
|
||||||
'incorrectly) not considered to be failures.',
|
'incorrectly) not considered to be failures.',
|
||||||
)
|
)
|
||||||
|
@ -47,8 +47,8 @@ Future<void> runTasks(
|
|||||||
}) async {
|
}) async {
|
||||||
for (final String taskName in taskNames) {
|
for (final String taskName in taskNames) {
|
||||||
TaskResult result = TaskResult.success(null);
|
TaskResult result = TaskResult.success(null);
|
||||||
int retry = 0;
|
int failureCount = 0;
|
||||||
while (retry <= Cocoon.retryNumber) {
|
while (failureCount <= Cocoon.retryNumber) {
|
||||||
result = await rerunTask(
|
result = await rerunTask(
|
||||||
taskName,
|
taskName,
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
@ -66,11 +66,14 @@ Future<void> runTasks(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!result.succeeded) {
|
if (!result.succeeded) {
|
||||||
retry += 1;
|
failureCount += 1;
|
||||||
|
if (exitOnFirstTestFailure) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
section('Flaky status for "$taskName"');
|
section('Flaky status for "$taskName"');
|
||||||
if (retry > 0) {
|
if (failureCount > 0) {
|
||||||
print('Total ${retry+1} executions: $retry failures and 1 false positive.');
|
print('Total ${failureCount+1} executions: $failureCount failures and 1 false positive.');
|
||||||
print('flaky: true');
|
print('flaky: true');
|
||||||
// TODO(ianh): stop ignoring this failure. We should set exitCode=1, and quit
|
// TODO(ianh): stop ignoring this failure. We should set exitCode=1, and quit
|
||||||
// if exitOnFirstTestFailure is true.
|
// if exitOnFirstTestFailure is true.
|
||||||
@ -84,7 +87,7 @@ Future<void> runTasks(
|
|||||||
|
|
||||||
if (!result.succeeded) {
|
if (!result.succeeded) {
|
||||||
section('Flaky status for "$taskName"');
|
section('Flaky status for "$taskName"');
|
||||||
print('Consistently failed across all $retry executions.');
|
print('Consistently failed across all $failureCount executions.');
|
||||||
print('flaky: false');
|
print('flaky: false');
|
||||||
exitCode = 1;
|
exitCode = 1;
|
||||||
if (exitOnFirstTestFailure) {
|
if (exitOnFirstTestFailure) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user