Allow flaky tests to pass or fail and mark web tests as flaky (#34456)
This commit is contained in:
@@ -85,6 +85,7 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
||||
String failureMessage,
|
||||
bool printOutput = true,
|
||||
bool skip = false,
|
||||
bool expectFlaky = false,
|
||||
Duration timeout = _kLongTimeout,
|
||||
}) async {
|
||||
final String commandDescription = '${path.relative(executable, from: workingDirectory)} ${arguments.join(' ')}';
|
||||
@@ -114,9 +115,13 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
||||
|
||||
final int exitCode = await process.exitCode.timeout(timeout, onTimeout: () {
|
||||
stderr.writeln('Process timed out after $timeout');
|
||||
return expectNonZeroExit ? 0 : 1;
|
||||
return (expectNonZeroExit || expectFlaky) ? 0 : 1;
|
||||
});
|
||||
print('$clock ELAPSED TIME: $bold${elapsedTime(start)}$reset for $commandDescription in $relativeWorkingDir: ');
|
||||
// If the test is flaky we don't care about the actual exit.
|
||||
if (expectFlaky) {
|
||||
return;
|
||||
}
|
||||
if ((exitCode == 0) == expectNonZeroExit || (expectedExitCode != null && exitCode != expectedExitCode)) {
|
||||
if (failureMessage != null) {
|
||||
print(failureMessage);
|
||||
|
||||
Reference in New Issue
Block a user