Skip to content

Commit

Permalink
[test] Increase internal timeout on test_runner test.
Browse files Browse the repository at this point in the history
In slow configurations, the test subprocesses could
take more than 10 seconds. Increase their timeout,
and use a smaller timeout for the timing-out test.

Change-Id: I218a3b18b763f4ea9c4868b2841b2519ef3b9746
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306360
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: William Hesse <whesse@google.com>
  • Loading branch information
whesse authored and Commit Queue committed May 30, 2023
1 parent 94a541a commit cf07d75
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions pkg/test_runner/test/test_runner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ import 'package:test_runner/src/test_file.dart';
import "package:test_runner/src/test_progress.dart" as progress;
import "package:test_runner/src/test_suite.dart";

final defaultTimeout = 10;

List<String> packageOptions() {
if (Platform.packageConfig != null) {
return <String>['--packages=${Platform.packageConfig}'];
} else {
return <String>[];
}
}
final defaultTimeout = 30;

class TestController {
static int numTests = 0;
Expand Down Expand Up @@ -74,12 +66,15 @@ class CustomTestSuite extends TestSuite {
onTest(testCase);
}

var testCaseCrash = _makeNormalTestCase("crash", [Expectation.crash]);
var testCasePass = _makeNormalTestCase("pass", [Expectation.pass]);
var testCaseFail = _makeNormalTestCase("fail", [Expectation.fail]);
var testCaseTimeout = _makeNormalTestCase("timeout", [Expectation.timeout]);
var testCaseCrash =
_makeTestCase("crash", defaultTimeout, [Expectation.crash]);
var testCasePass =
_makeTestCase("pass", defaultTimeout, [Expectation.pass]);
var testCaseFail =
_makeTestCase("fail", defaultTimeout, [Expectation.fail]);
var testCaseTimeout = _makeTestCase("timeout", 5, [Expectation.timeout]);
var testCaseFailUnexpected =
_makeNormalTestCase("fail-unexpected", [Expectation.pass]);
_makeTestCase("fail-unexpected", defaultTimeout, [Expectation.pass]);

enqueueTestCase(testCaseCrash);
enqueueTestCase(testCasePass);
Expand All @@ -88,17 +83,16 @@ class CustomTestSuite extends TestSuite {
enqueueTestCase(testCaseFailUnexpected);
}

TestCase _makeNormalTestCase(
String name, Iterable<Expectation> expectations) {
var args = packageOptions();
args.addAll([Platform.script.toFilePath(), name]);
var command = ProcessCommand('custom', Platform.executable, args, {});
return _makeTestCase(name, defaultTimeout, command, expectations);
}

TestCase _makeTestCase(String name, timeout, Command command,
Iterable<Expectation> expectations) {
TestCase _makeTestCase(
String name, timeout, Iterable<Expectation> expectations) {
var configuration = OptionsParser().parse(['--timeout', '$timeout'])[0];
final args = [
if (Platform.packageConfig != null)
'--packages=${Platform.packageConfig}',
Platform.script.toFilePath(),
name,
];
final command = ProcessCommand('custom', Platform.executable, args, {});
return TestCase(
name,
[command],
Expand Down

0 comments on commit cf07d75

Please sign in to comment.