| Index: tools/testing/dart/test_suite.dart
|
| diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
|
| index 3bcab2fbee601a08701543d85e17ea2a79536315..62b267f00823285ffddfd55ca4acea0b36e0e858 100644
|
| --- a/tools/testing/dart/test_suite.dart
|
| +++ b/tools/testing/dart/test_suite.dart
|
| @@ -12,6 +12,98 @@ interface TestSuite {
|
| }
|
|
|
|
|
| +class CCTestListerIsolate extends Isolate {
|
| + CCTestListerIsolate() : super.heavy();
|
| +
|
| + void main() {
|
| + port.receive((String runnerPath, SendPort replyTo) {
|
| + var p = new Process(runnerPath, ["--list"]);
|
| + StringInputStream stdoutStream = new StringInputStream(p.stdout);
|
| + List<String> tests = new List<String>();
|
| + stdoutStream.dataHandler = () {
|
| + String line = stdoutStream.readLine();
|
| + while (line != null) {
|
| + tests.add(line);
|
| + line = stdoutStream.readLine();
|
| + }
|
| + };
|
| + p.exitHandler = (code) {
|
| + if (code < 0) {
|
| + print("Failed to list tests: $runnerPath --list");
|
| + replyTo.send("");
|
| + }
|
| + for (String test in tests) {
|
| + replyTo.send(test);
|
| + }
|
| + replyTo.send("");
|
| + };
|
| + p.start();
|
| + });
|
| + }
|
| +}
|
| +
|
| +
|
| +class CCTestSuite implements TestSuite {
|
| + Map configuration;
|
| + String runnerPath;
|
| + List<String> statusFilePaths;
|
| + Function doTest;
|
| + Function doDone;
|
| + ReceivePort receiveTestName;
|
| + TestExpectations testExpectations;
|
| +
|
| + CCTestSuite(Map this.configuration,
|
| + String runnerName,
|
| + List<String> this.statusFilePaths) {
|
| + runnerPath = TestUtils.getBuildDir(configuration) + runnerName;
|
| + }
|
| +
|
| + void complexStatusMatching() => false;
|
| +
|
| + void testNameHandler(String testName, ignore) {
|
| + if (testName == "") {
|
| + receiveTestName.close();
|
| + } else {
|
| + var timeout = configuration['timeout'];
|
| + var expectations = testExpectations.expectations(testName);
|
| +
|
| + if (expectations.contains(SKIP)) return;
|
| +
|
| + // TODO(ager): Pass extra options to the tests.
|
| + doTest(new TestCase(testName,
|
| + runnerPath,
|
| + [testName],
|
| + timeout,
|
| + completeHandler,
|
| + expectations));
|
| + receiveTestName.receive(testNameHandler);
|
| + }
|
| + }
|
| +
|
| + void forEachTest(Function onTest, [Function onDone]) {
|
| + doTest = onTest;
|
| + onDone = (ignore) => (onDone != null) ? onDone() : null;
|
| +
|
| + testExpectations =
|
| + new TestExpectations(complexMatching: complexStatusMatching());
|
| + for (var statusFilePath in statusFilePaths) {
|
| + ReadTestExpectationsInto(testExpectations,
|
| + statusFilePath,
|
| + configuration);
|
| + }
|
| +
|
| + receiveTestName = new ReceivePort();
|
| + new CCTestListerIsolate().spawn().then((port) {
|
| + port.send(runnerPath, receiveTestName);
|
| + receiveTestName.receive(testNameHandler);
|
| + });
|
| + }
|
| +
|
| + void completeHandler(TestCase testCase) {
|
| + }
|
| +}
|
| +
|
| +
|
| class StandardTestSuite implements TestSuite {
|
| Map configuration;
|
| String directoryPath;
|
| @@ -24,7 +116,7 @@ class StandardTestSuite implements TestSuite {
|
| StandardTestSuite(Map this.configuration,
|
| String this.directoryPath,
|
| List<String> this.statusFilePaths) {
|
| - shellPath = getDartShellFileName(configuration) ;
|
| + shellPath = TestUtils.getDartShellFileName(configuration) ;
|
| }
|
|
|
|
|
| @@ -99,6 +191,7 @@ class StandardTestSuite implements TestSuite {
|
| List<List<String>> argumentLists(String filename, Map optionsFromFile) {
|
| List args = ["--ignore-unrecognized-flags"];
|
| if (configuration["checked"]) {
|
| + args.add('--enable_asserts');
|
| args.add("--enable_type_checks");
|
| }
|
| if (configuration["component"] == "leg") {
|
| @@ -177,3 +270,44 @@ class StandardTestSuite implements TestSuite {
|
| "isNegative" : isNegative };
|
| }
|
| }
|
| +
|
| +
|
| +class TestUtils {
|
| + static String getExecutableName(Map configuration) {
|
| + switch (configuration['component']) {
|
| + case 'vm':
|
| + return 'dart_bin';
|
| + case 'dartc':
|
| + return 'compiler/bin/dartc_test';
|
| + case 'frog':
|
| + case 'leg':
|
| + return 'frog/bin/frog';
|
| + case 'frogsh':
|
| + return 'frog/bin/frogsh';
|
| + default:
|
| + throw "Unknown executable for: ${configuration['component']}";
|
| + }
|
| + }
|
| +
|
| +
|
| + static String getDartShellFileName(Map configuration) {
|
| + var name = getBuildDir(configuration) + getExecutableName(configuration);
|
| + if (!(new File(name)).existsSync()) {
|
| + throw "Executable '$name' does not exist";
|
| + }
|
| + return name;
|
| + }
|
| +
|
| + static String getBuildDir(Map configuration) {
|
| + var buildDir = '';
|
| + var system = configuration['system'];
|
| + if (system == 'linux') {
|
| + buildDir = 'out/';
|
| + } else if (system == 'macos') {
|
| + buildDir = 'xcodebuild/';
|
| + }
|
| + buildDir += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_';
|
| + buildDir += configuration['architecture'] + '/';
|
| + return buildDir;
|
| + }
|
| +}
|
|
|