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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 if (expectations.contains(SKIP)) return; | 144 if (expectations.contains(SKIP)) return; |
145 | 145 |
146 var args = TestUtils.standardOptions(configuration); | 146 var args = TestUtils.standardOptions(configuration); |
147 args.add(testName); | 147 args.add(testName); |
148 | 148 |
149 doTest(new TestCase(constructedName, | 149 doTest(new TestCase(constructedName, |
150 [new Command(runnerPath, args)], | 150 [new Command(runnerPath, args)], |
151 configuration, | 151 configuration, |
152 completeHandler, | 152 completeHandler, |
153 expectations)); | 153 expectations, |
| 154 usesWebDriver: TestUtils.usesWebDriver)); |
154 } | 155 } |
155 } | 156 } |
156 | 157 |
157 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { | 158 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { |
158 doTest = onTest; | 159 doTest = onTest; |
159 doDone = () => (onDone != null) ? onDone() : null; | 160 doDone = () => (onDone != null) ? onDone() : null; |
160 | 161 |
161 var filesRead = 0; | 162 var filesRead = 0; |
162 void statusFileRead() { | 163 void statusFileRead() { |
163 filesRead++; | 164 filesRead++; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); | 446 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); |
446 Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList"); | 447 Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList"); |
447 | 448 |
448 for (var vmOptions in vmOptionsList) { | 449 for (var vmOptions in vmOptionsList) { |
449 doTest(new TestCase('$suiteName/$testName', | 450 doTest(new TestCase('$suiteName/$testName', |
450 makeCommands(info, vmOptions, commonArguments), | 451 makeCommands(info, vmOptions, commonArguments), |
451 configuration, | 452 configuration, |
452 completeHandler, | 453 completeHandler, |
453 expectations, | 454 expectations, |
454 isNegative: isNegative, | 455 isNegative: isNegative, |
455 info: info)); | 456 info: info, |
| 457 usesWebDriver: TestUtils.usesWebDriver)); |
456 } | 458 } |
457 } | 459 } |
458 | 460 |
459 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { | 461 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { |
460 switch (configuration['compiler']) { | 462 switch (configuration['compiler']) { |
461 case 'dart2js': | 463 case 'dart2js': |
462 args = new List.from(args); | 464 args = new List.from(args); |
463 String tempDir = createOutputDirectory(info.filePath, ''); | 465 String tempDir = createOutputDirectory(info.filePath, ''); |
464 args.add('--out=$tempDir/out.js'); | 466 args.add('--out=$tempDir/out.js'); |
465 List<Command> commands = <Command>[new Command(shellPath(), args)]; | 467 List<Command> commands = <Command>[new Command(shellPath(), args)]; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 String baseName = namePath.filenameWithoutExtension; | 690 String baseName = namePath.filenameWithoutExtension; |
689 Path fromPath = filePath.directoryPath.join(namePath); | 691 Path fromPath = filePath.directoryPath.join(namePath); |
690 commands.add(_compileCommand( | 692 commands.add(_compileCommand( |
691 fromPath.toNativePath(), '$tempDir/$baseName.js', | 693 fromPath.toNativePath(), '$tempDir/$baseName.js', |
692 compiler, tempDir, vmOptions)); | 694 compiler, tempDir, vmOptions)); |
693 } | 695 } |
694 } | 696 } |
695 | 697 |
696 // Construct the command that executes the browser test | 698 // Construct the command that executes the browser test |
697 List<String> args; | 699 List<String> args; |
698 if (runtime == 'ie' || runtime == 'ff' || runtime == 'chrome' || | 700 if (TestUtils.usesWebDriver(runtime)) { |
699 runtime == 'safari' || runtime == 'opera' || runtime == 'dartium') { | |
700 args = [dartDir.append('tools/testing/run_selenium.py').toNativePath(), | 701 args = [dartDir.append('tools/testing/run_selenium.py').toNativePath(), |
701 '--browser=$runtime', | 702 '--browser=$runtime', |
702 '--timeout=${configuration["timeout"] - 2}', | 703 '--timeout=${configuration["timeout"] - 2}', |
703 '--out=$htmlPath']; | 704 '--out=$htmlPath']; |
704 if (runtime == 'dartium') { | 705 if (runtime == 'dartium') { |
705 args.add('--executable=$dartiumFilename'); | 706 args.add('--executable=$dartiumFilename'); |
706 } | 707 } |
707 } else { | 708 } else { |
708 args = [ | 709 args = [ |
709 dartDir.append('tools/testing/drt-trampoline.py').toNativePath(), | 710 dartDir.append('tools/testing/drt-trampoline.py').toNativePath(), |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 // to run for a few minutes. | 1196 // to run for a few minutes. |
1196 Map updatedConfiguration = new Map(); | 1197 Map updatedConfiguration = new Map(); |
1197 configuration.forEach((key, value) { | 1198 configuration.forEach((key, value) { |
1198 updatedConfiguration[key] = value; | 1199 updatedConfiguration[key] = value; |
1199 }); | 1200 }); |
1200 updatedConfiguration['timeout'] *= 3; | 1201 updatedConfiguration['timeout'] *= 3; |
1201 doTest(new TestCase(suiteName, | 1202 doTest(new TestCase(suiteName, |
1202 [new Command('java', args)], | 1203 [new Command('java', args)], |
1203 updatedConfiguration, | 1204 updatedConfiguration, |
1204 completeHandler, | 1205 completeHandler, |
1205 new Set<String>.from([PASS]))); | 1206 new Set<String>.from([PASS]), |
| 1207 usesWebDriver: TestUtils.usesWebDriver)); |
1206 doDone(); | 1208 doDone(); |
1207 } | 1209 } |
1208 | 1210 |
1209 void completeHandler(TestCase testCase) { | 1211 void completeHandler(TestCase testCase) { |
1210 } | 1212 } |
1211 | 1213 |
1212 void computeClassPath() { | 1214 void computeClassPath() { |
1213 classPath = Strings.join( | 1215 classPath = Strings.join( |
1214 ['$buildDir/analyzer/util/analyzer/dart_analyzer.jar', | 1216 ['$buildDir/analyzer/util/analyzer/dart_analyzer.jar', |
1215 '$buildDir/analyzer/dart_analyzer_tests.jar', | 1217 '$buildDir/analyzer/dart_analyzer_tests.jar', |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 return args; | 1403 return args; |
1402 } | 1404 } |
1403 | 1405 |
1404 static String jsshellFileName(Map configuration) { | 1406 static String jsshellFileName(Map configuration) { |
1405 var executableSuffix = executableSuffix('jsshell'); | 1407 var executableSuffix = executableSuffix('jsshell'); |
1406 var executable = 'jsshell$executableSuffix'; | 1408 var executable = 'jsshell$executableSuffix'; |
1407 var jsshellDir = '${dartDir()}/tools/testing/bin'; | 1409 var jsshellDir = '${dartDir()}/tools/testing/bin'; |
1408 return '$jsshellDir/$executable'; | 1410 return '$jsshellDir/$executable'; |
1409 } | 1411 } |
1410 | 1412 |
1411 static bool isBrowserRuntime(String runtime) => Contains( | 1413 static bool usesWebDriver(String runtime) => Contains( |
1412 runtime, | 1414 runtime, const <String>['dartium', |
1413 const <String>['drt', | 1415 'ie9', |
1414 'dartium', | 1416 'safari', |
1415 'ie', | 1417 'opera', |
1416 'safari', | 1418 'chrome', |
1417 'opera', | 1419 'ff']); |
1418 'chrome', | 1420 |
1419 'ff']); | 1421 static bool isBrowserRuntime(String runtime) => |
| 1422 runtime == 'drt' || TestUtils.usesWebDriver(runtime); |
1420 | 1423 |
1421 static bool isJsCommandLineRuntime(String runtime) => | 1424 static bool isJsCommandLineRuntime(String runtime) => |
1422 Contains(runtime, const <String>['d8', 'jsshell']); | 1425 Contains(runtime, const <String>['d8', 'jsshell']); |
1423 | 1426 |
1424 } | 1427 } |
1425 | 1428 |
1426 class SummaryReport { | 1429 class SummaryReport { |
1427 static int total = 0; | 1430 static int total = 0; |
1428 static int skipped = 0; | 1431 static int skipped = 0; |
1429 static int noCrash = 0; | 1432 static int noCrash = 0; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 * $noCrash tests are expected to be flaky but not crash | 1470 * $noCrash tests are expected to be flaky but not crash |
1468 * $pass tests are expected to pass | 1471 * $pass tests are expected to pass |
1469 * $failOk tests are expected to fail that we won't fix | 1472 * $failOk tests are expected to fail that we won't fix |
1470 * $fail tests are expected to fail that we should fix | 1473 * $fail tests are expected to fail that we should fix |
1471 * $crash tests are expected to crash that we should fix | 1474 * $crash tests are expected to crash that we should fix |
1472 * $timeout tests are allowed to timeout | 1475 * $timeout tests are allowed to timeout |
1473 """; | 1476 """; |
1474 print(report); | 1477 print(report); |
1475 } | 1478 } |
1476 } | 1479 } |
OLD | NEW |