| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
| 7 * | 7 * |
| 8 * This library includes: | 8 * This library includes: |
| 9 * | 9 * |
| 10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 if (expectations.contains(SKIP)) return; | 149 if (expectations.contains(SKIP)) return; |
| 150 | 150 |
| 151 var args = TestUtils.standardOptions(configuration); | 151 var args = TestUtils.standardOptions(configuration); |
| 152 args.add(testName); | 152 args.add(testName); |
| 153 | 153 |
| 154 doTest(new TestCase(constructedName, | 154 doTest(new TestCase(constructedName, |
| 155 [new Command(runnerPath, args)], | 155 [new Command(runnerPath, args)], |
| 156 configuration, | 156 configuration, |
| 157 completeHandler, | 157 completeHandler, |
| 158 expectations)); | 158 expectations, |
| 159 usesWebDriver: false)); |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 | 162 |
| 162 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { | 163 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { |
| 163 doTest = onTest; | 164 doTest = onTest; |
| 164 doDone = () => (onDone != null) ? onDone() : null; | 165 doDone = () => (onDone != null) ? onDone() : null; |
| 165 | 166 |
| 166 var filesRead = 0; | 167 var filesRead = 0; |
| 167 void statusFileRead() { | 168 void statusFileRead() { |
| 168 filesRead++; | 169 filesRead++; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); | 451 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); |
| 451 Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList"); | 452 Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList"); |
| 452 | 453 |
| 453 for (var vmOptions in vmOptionsList) { | 454 for (var vmOptions in vmOptionsList) { |
| 454 doTest(new TestCase('$suiteName/$testName', | 455 doTest(new TestCase('$suiteName/$testName', |
| 455 makeCommands(info, vmOptions, commonArguments), | 456 makeCommands(info, vmOptions, commonArguments), |
| 456 configuration, | 457 configuration, |
| 457 completeHandler, | 458 completeHandler, |
| 458 expectations, | 459 expectations, |
| 459 isNegative: isNegative, | 460 isNegative: isNegative, |
| 460 info: info)); | 461 info: info, |
| 462 usesWebDriver: |
| 463 TestUtils.usesWebDriver(configuration['runtime']))); |
| 461 } | 464 } |
| 462 } | 465 } |
| 463 | 466 |
| 464 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { | 467 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { |
| 465 switch (configuration['compiler']) { | 468 switch (configuration['compiler']) { |
| 466 case 'dart2js': | 469 case 'dart2js': |
| 467 args = new List.from(args); | 470 args = new List.from(args); |
| 468 String tempDir = createOutputDirectory(info.filePath, ''); | 471 String tempDir = createOutputDirectory(info.filePath, ''); |
| 469 args.add('--out=$tempDir/out.js'); | 472 args.add('--out=$tempDir/out.js'); |
| 470 List<Command> commands = <Command>[new Command(shellPath(), args)]; | 473 List<Command> commands = <Command>[new Command(shellPath(), args)]; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 args.add(htmlPath); | 732 args.add(htmlPath); |
| 730 if (expectedOutput != null) { | 733 if (expectedOutput != null) { |
| 731 args.add('--out-expectation=${expectedOutput.toNativePath()}'); | 734 args.add('--out-expectation=${expectedOutput.toNativePath()}'); |
| 732 } | 735 } |
| 733 } | 736 } |
| 734 commands.add(new Command('python', args)); | 737 commands.add(new Command('python', args)); |
| 735 | 738 |
| 736 // Create BrowserTestCase and queue it. | 739 // Create BrowserTestCase and queue it. |
| 737 var testCase = new BrowserTestCase('$suiteName/$testName', | 740 var testCase = new BrowserTestCase('$suiteName/$testName', |
| 738 commands, configuration, completeHandler, expectations, | 741 commands, configuration, completeHandler, expectations, |
| 739 info, info.hasCompileError || info.hasRuntimeError); | 742 info, info.hasCompileError || info.hasRuntimeError, |
| 743 useWebDriver: TestUtils.usesWebDriver(runtime)); |
| 740 doTest(testCase); | 744 doTest(testCase); |
| 741 } | 745 } |
| 742 } | 746 } |
| 743 | 747 |
| 744 /** Helper to create a compilation command for a single input file. */ | 748 /** Helper to create a compilation command for a single input file. */ |
| 745 Command _compileCommand(String inputFile, String outputFile, | 749 Command _compileCommand(String inputFile, String outputFile, |
| 746 String compiler, String dir, var vmOptions) { | 750 String compiler, String dir, var vmOptions) { |
| 747 String executable = TestUtils.compilerPath(configuration); | 751 String executable = TestUtils.compilerPath(configuration); |
| 748 List<String> args = TestUtils.standardOptions(configuration); | 752 List<String> args = TestUtils.standardOptions(configuration); |
| 749 switch (compiler) { | 753 switch (compiler) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 // to run for a few minutes. | 1205 // to run for a few minutes. |
| 1202 Map updatedConfiguration = new Map(); | 1206 Map updatedConfiguration = new Map(); |
| 1203 configuration.forEach((key, value) { | 1207 configuration.forEach((key, value) { |
| 1204 updatedConfiguration[key] = value; | 1208 updatedConfiguration[key] = value; |
| 1205 }); | 1209 }); |
| 1206 updatedConfiguration['timeout'] *= 3; | 1210 updatedConfiguration['timeout'] *= 3; |
| 1207 doTest(new TestCase(suiteName, | 1211 doTest(new TestCase(suiteName, |
| 1208 [new Command('java', args)], | 1212 [new Command('java', args)], |
| 1209 updatedConfiguration, | 1213 updatedConfiguration, |
| 1210 completeHandler, | 1214 completeHandler, |
| 1211 new Set<String>.from([PASS]))); | 1215 new Set<String>.from([PASS]), |
| 1216 usesWebDriver: TestUtils.usesWebDriver(runtime))); |
| 1212 doDone(); | 1217 doDone(); |
| 1213 } | 1218 } |
| 1214 | 1219 |
| 1215 void completeHandler(TestCase testCase) { | 1220 void completeHandler(TestCase testCase) { |
| 1216 } | 1221 } |
| 1217 | 1222 |
| 1218 void computeClassPath() { | 1223 void computeClassPath() { |
| 1219 classPath = Strings.join( | 1224 classPath = Strings.join( |
| 1220 ['$buildDir/analyzer/util/analyzer/dart_analyzer.jar', | 1225 ['$buildDir/analyzer/util/analyzer/dart_analyzer.jar', |
| 1221 '$buildDir/analyzer/dart_analyzer_tests.jar', | 1226 '$buildDir/analyzer/dart_analyzer_tests.jar', |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 * $noCrash tests are expected to be flaky but not crash | 1480 * $noCrash tests are expected to be flaky but not crash |
| 1476 * $pass tests are expected to pass | 1481 * $pass tests are expected to pass |
| 1477 * $failOk tests are expected to fail that we won't fix | 1482 * $failOk tests are expected to fail that we won't fix |
| 1478 * $fail tests are expected to fail that we should fix | 1483 * $fail tests are expected to fail that we should fix |
| 1479 * $crash tests are expected to crash that we should fix | 1484 * $crash tests are expected to crash that we should fix |
| 1480 * $timeout tests are allowed to timeout | 1485 * $timeout tests are allowed to timeout |
| 1481 """; | 1486 """; |
| 1482 print(report); | 1487 print(report); |
| 1483 } | 1488 } |
| 1484 } | 1489 } |
| OLD | NEW |