Chromium Code Reviews| Index: tests/co19/test_config.dart |
| diff --git a/tests/corelib/test_config.dart b/tests/co19/test_config.dart |
| similarity index 63% |
| copy from tests/corelib/test_config.dart |
| copy to tests/co19/test_config.dart |
| index 8fcaac0577cc30af94693dba068161b3df433233..98e8f195feeecff97dbdb7ef0ed357fc06d88cec 100644 |
| --- a/tests/corelib/test_config.dart |
| +++ b/tests/co19/test_config.dart |
| @@ -2,24 +2,25 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| -#library("corelib_test_config"); |
| +#library("co19_test_config"); |
| #import("../../tools/testing/dart/test_runner.dart"); |
| #import("../../tools/testing/dart/status_file_parser.dart"); |
| -class CorelibTestSuite { |
| - String directoryPath = "tests/corelib/src"; |
| - final String statusFilePath = "tests/corelib/corelib.status"; |
| +class Co19TestSuite { |
| + String directoryPath = "tests/co19/src"; |
| Function doTest; |
| Function doDone; |
| String shellPath; |
| String pathSeparator; |
| Map configuration; |
| - TestExpectationsMap testExpectationsMap; |
| + TestExpectations testExpectations; |
| + RegExp testRegExp; |
| - CorelibTestSuite(Map this.configuration) { |
| + Co19TestSuite(Map this.configuration) { |
| shellPath = getDartShellFileName(configuration) ; |
| pathSeparator = new Platform().pathSeparator(); |
| + testRegExp = new RegExp(@"t[0-9]{2}.dart$"); |
| } |
| void forEachTest(Function onTest, [Function onDone = null]) { |
| @@ -27,24 +28,33 @@ class CorelibTestSuite { |
| doDone = (ignore) => onDone(); |
| // Read test expectations from status file. |
| - testExpectationsMap = ReadTestExpectations(statusFilePath, configuration); |
| - |
| - processDirectory(); |
| + testExpectations = new TestExpectations(complexMatching: true); |
| + ReadTestExpectationsInto(testExpectations, |
| + "tests/co19/co19-compiler.status", |
| + configuration); |
| + ReadTestExpectationsInto(testExpectations, |
| + "tests/co19/co19-frog.status", |
| + configuration); |
| + ReadTestExpectationsInto(testExpectations, |
| + "tests/co19/co19-runtime.status", |
| + configuration); |
| + |
| + processDirectory(directoryPath); |
| } |
| - void processDirectory() { |
| - directoryPath = getDirname(directoryPath); |
| - Directory dir = new Directory(directoryPath); |
| + void processDirectory(String path) { |
| + path = getDirname(path); |
| + Directory dir = new Directory(path); |
| dir.errorHandler = (s) { |
| throw s; |
| }; |
| dir.fileHandler = processFile; |
| dir.doneHandler = doDone; |
| - dir.list(false); |
| + dir.list(recursive: true); |
| } |
| void processFile(String filename) { |
| - if (!filename.endsWith("Test.dart")) return; |
| + if (!testRegExp.hasMatch(filename)) return; |
| // If patterns are given only list the files that match one of the |
| // patterns. |
| @@ -54,12 +64,10 @@ class CorelibTestSuite { |
| return; |
| } |
| - int start = filename.lastIndexOf(pathSeparator); |
| - String testName = filename.substring(start + 1, filename.length - 5); |
| - Set<String> expectations = testExpectationsMap.expectations(testName); |
| + int start = filename.lastIndexOf('src' + pathSeparator); |
| + String testName = filename.substring(start + 4, filename.length - 5); |
| + Set<String> expectations = testExpectations.expectations(testName); |
| - // TODO(whesse): Skip files with internal directives, and multipart files, |
| - // until they are handled correctly. |
| if (expectations.contains(SKIP)) return; |
| List args = ["--ignore-unrecognized-flags"]; |
| @@ -74,6 +82,7 @@ class CorelibTestSuite { |
| List<List<String>> optionsList = optionsFromFile["vmOptions"]; |
| List<String> dartOptions = optionsFromFile["dartOptions"]; |
| args.addAll(dartOptions == null ? [filename] : dartOptions); |
| + if (optionsFromFile["isNegative"]) negateExpectations(expectations); |
| if (optionsList.isEmpty()) { |
| doTest(new TestCase(testName, |
| @@ -91,10 +100,20 @@ class CorelibTestSuite { |
| configuration["timeout"], |
| completeHandler, |
| expectations)); |
| - } |
| + } |
| + } |
| + } |
| + |
| + |
|
Bill Hesse
2011/11/16 11:44:27
We have handling for this in the test runner alrea
Mads Ager (google)
2011/11/16 12:26:38
Good point. Done.
|
| + void negateExpectations(Set<String> expectations) { |
| + if (expectations.remove(PASS)) { |
| + expectations.add(FAIL); |
| + } else if (expectations.remove(FAIL)) { |
| + expectations.add(PASS); |
| } |
| } |
| + |
| Map testOptions(String filename) { |
| RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)"); |
| RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)"); |
| @@ -104,6 +123,7 @@ class CorelibTestSuite { |
| List<List> result = new List<List>(); |
| List<String> dartOptions; |
| + bool isNegative = false; |
| String line; |
| while ((line = lines.readLine()) != null) { |
| Match match = testOptionsRegExp.firstMatch(line); |
| @@ -119,10 +139,19 @@ class CorelibTestSuite { |
| } |
| dartOptions = match[1].split(' ').filter((e) => e != ''); |
| } |
| + |
| + if (line.contains("@compile-error") || line.contains("@runtime-error")) { |
| + isNegative = true; |
| + } else if (line.contains("@dynamic-type-error") && |
| + configuration['checked']) { |
| + isNegative = true; |
| + } |
| } |
| - return {"vmOptions": result, "dartOptions": dartOptions}; |
| + return {"vmOptions": result, |
| + "dartOptions": dartOptions, |
| + "isNegative" : isNegative }; |
| } |
| - |
| + |
| void completeHandler(TestCase testCase) { |
| } |
| } |