| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library("standalone_test_config"); | 5 #library("standalone_test_config"); |
| 6 | 6 |
| 7 #import("../../tools/testing/dart/test_runner.dart"); | 7 #import("../../tools/testing/dart/test_runner.dart"); |
| 8 #import("../../tools/testing/dart/status_file_parser.dart"); | 8 #import("../../tools/testing/dart/status_file_parser.dart"); |
| 9 | 9 |
| 10 class StandaloneTestSuite { | 10 class StandaloneTestSuite { |
| 11 String directoryPath = "tests/standalone/src"; | 11 String directoryPath = "tests/standalone/src"; |
| 12 final String statusFilePath = "tests/standalone/standalone.status"; | 12 final String statusFilePath = "tests/standalone/standalone.status"; |
| 13 Function doTest; | 13 Function doTest; |
| 14 Function doDone; | 14 Function doDone; |
| 15 String shellPath; | 15 String shellPath; |
| 16 String pathSeparator; | 16 String pathSeparator; |
| 17 Map configuration; | 17 Map configuration; |
| 18 TestExpectationsMap testExpectationsMap; | 18 TestExpectationsMap testExpectationsMap; |
| 19 | 19 |
| 20 StandaloneTestSuite(Map this.configuration) { | 20 StandaloneTestSuite(Map this.configuration) { |
| 21 shellPath = getDartShellFileName(configuration) ; | 21 shellPath = getDartShellFileName(configuration) ; |
| 22 pathSeparator = new Platform().pathSeparator(); | 22 pathSeparator = new Platform().pathSeparator(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void forEachTest(Function onTest, [Function onDone = null]) { | 25 void forEachTest(Function onTest, [Function onDone = null]) { |
| 26 doTest = onTest; | 26 doTest = onTest; |
| 27 doDone = onDone; | 27 doDone = (ignore) => onDone(); |
| 28 | 28 |
| 29 // Read test expectations from status file. | 29 // Read test expectations from status file. |
| 30 testExpectationsMap = ReadTestExpectations(statusFilePath, configuration); | 30 testExpectationsMap = ReadTestExpectations(statusFilePath, configuration); |
| 31 | 31 |
| 32 processDirectory(); | 32 processDirectory(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void processDirectory() { | 35 void processDirectory() { |
| 36 directoryPath = getDirname(directoryPath); | 36 directoryPath = getDirname(directoryPath); |
| 37 Directory dir = new Directory(directoryPath); | 37 Directory dir = new Directory(directoryPath); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 int start = filename.lastIndexOf(pathSeparator); | 49 int start = filename.lastIndexOf(pathSeparator); |
| 50 String testName = filename.substring(start + 1, filename.length - 5); | 50 String testName = filename.substring(start + 1, filename.length - 5); |
| 51 Set<String> expectations = testExpectationsMap.expectations(testName); | 51 Set<String> expectations = testExpectationsMap.expectations(testName); |
| 52 | 52 |
| 53 // TODO(whesse): Skip files with internal directives, and multipart files, | 53 // TODO(whesse): Skip files with internal directives, and multipart files, |
| 54 // until they are handled correctly. | 54 // until they are handled correctly. |
| 55 if (expectations.contains(SKIP)) return; | 55 if (expectations.contains(SKIP)) return; |
| 56 | 56 |
| 57 List args = ["--ignore-unrecognized-flags"]; | 57 List args = ["--ignore-unrecognized-flags"]; |
| 58 if (configuration["checked"]) { | 58 if (configuration["checked"]) { |
| 59 args.add("--enable-type-checks"); | 59 args.add("--enable_type_checks"); |
| 60 } |
| 61 if (configuration["component"] == "leg") { |
| 62 args.add("--enable_leg"); |
| 60 } | 63 } |
| 61 args.add(filename); | 64 args.add(filename); |
| 62 | 65 |
| 63 doTest(new TestCase(testName, | 66 doTest(new TestCase(testName, |
| 64 shellPath, | 67 shellPath, |
| 65 args, | 68 args, |
| 69 configuration["timeout"], |
| 66 completeHandler, | 70 completeHandler, |
| 67 expectations)); | 71 expectations)); |
| 68 } | 72 } |
| 69 | 73 |
| 70 void completeHandler(TestCase testCase) { | 74 void completeHandler(TestCase testCase) { |
| 71 } | 75 } |
| 72 } | 76 } |
| OLD | NEW |