Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 11343008: Land update to tools directory with new binaries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 List<String> statusFilePaths; 120 List<String> statusFilePaths;
121 TestCaseEvent doTest; 121 TestCaseEvent doTest;
122 VoidFunction doDone; 122 VoidFunction doDone;
123 ReceivePort receiveTestName; 123 ReceivePort receiveTestName;
124 TestExpectations testExpectations; 124 TestExpectations testExpectations;
125 125
126 CCTestSuite(Map this.configuration, 126 CCTestSuite(Map this.configuration,
127 String this.suiteName, 127 String this.suiteName,
128 String runnerName, 128 String runnerName,
129 List<String> this.statusFilePaths, 129 List<String> this.statusFilePaths,
130 [this.testPrefix = '']) 130 {this.testPrefix: ''})
131 : dartDir = TestUtils.dartDir().toNativePath() { 131 : dartDir = TestUtils.dartDir().toNativePath() {
132 runnerPath = '${TestUtils.buildDir(configuration)}/$runnerName'; 132 runnerPath = '${TestUtils.buildDir(configuration)}/$runnerName';
133 } 133 }
134 134
135 void testNameHandler(String testName, ignore) { 135 void testNameHandler(String testName, ignore) {
136 if (testName == "") { 136 if (testName == "") {
137 receiveTestName.close(); 137 receiveTestName.close();
138 doDone(); 138 doDone();
139 } else { 139 } else {
140 // Only run the tests that match the pattern. Use the name 140 // Only run the tests that match the pattern. Use the name
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 var testNamePath = filePath.relativeTo(suiteDir); 392 var testNamePath = filePath.relativeTo(suiteDir);
393 Expect.isTrue(testNamePath.extension == 'dart'); 393 Expect.isTrue(testNamePath.extension == 'dart');
394 if (testNamePath.extension == 'dart') { 394 if (testNamePath.extension == 'dart') {
395 testName = testNamePath.directoryPath.append( 395 testName = testNamePath.directoryPath.append(
396 testNamePath.filenameWithoutExtension).toString(); 396 testNamePath.filenameWithoutExtension).toString();
397 } 397 }
398 } 398 }
399 int shards = configuration['shards']; 399 int shards = configuration['shards'];
400 if (shards > 1) { 400 if (shards > 1) {
401 int shard = configuration['shard']; 401 int shard = configuration['shard'];
402 if (testName.hashCode() % shards != shard - 1) { 402 if (testName.hashCode % shards != shard - 1) {
403 return; 403 return;
404 } 404 }
405 } 405 }
406 406
407 Set<String> expectations = testExpectations.expectations(testName); 407 Set<String> expectations = testExpectations.expectations(testName);
408 if (configuration['report']) { 408 if (configuration['report']) {
409 // Tests with multiple VMOptions are counted more than once. 409 // Tests with multiple VMOptions are counted more than once.
410 for (var dummy in getVmOptions(optionsFromFile)) { 410 for (var dummy in getVmOptions(optionsFromFile)) {
411 SummaryReport.add(expectations); 411 SummaryReport.add(expectations);
412 } 412 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // format of the error line 445 // format of the error line
446 if (info.hasFatalTypeErrors) { 446 if (info.hasFatalTypeErrors) {
447 isNegative = true; 447 isNegative = true;
448 } 448 }
449 } 449 }
450 450
451 var commonArguments = commonArgumentsFromFile(info.filePath, 451 var commonArguments = commonArgumentsFromFile(info.filePath,
452 info.optionsFromFile); 452 info.optionsFromFile);
453 453
454 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); 454 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile);
455 Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList"); 455 Expect.isFalse(vmOptionsList.isEmpty, "empty vmOptionsList");
456 456
457 for (var vmOptions in vmOptionsList) { 457 for (var vmOptions in vmOptionsList) {
458 doTest(new TestCase('$suiteName/$testName', 458 doTest(new TestCase('$suiteName/$testName',
459 makeCommands(info, vmOptions, commonArguments), 459 makeCommands(info, vmOptions, commonArguments),
460 configuration, 460 configuration,
461 completeHandler, 461 completeHandler,
462 expectations, 462 expectations,
463 isNegative: isNegative, 463 isNegative: isNegative,
464 info: info)); 464 info: info));
465 } 465 }
(...skipping 16 matching lines...) Expand all
482 var jsshell = TestUtils.jsshellFileName(configuration); 482 var jsshell = TestUtils.jsshellFileName(configuration);
483 commands.add(new Command(jsshell, ['$tempDir/out.js'])); 483 commands.add(new Command(jsshell, ['$tempDir/out.js']));
484 } 484 }
485 return commands; 485 return commands;
486 486
487 case 'dart2dart': 487 case 'dart2dart':
488 var compilerArguments = new List.from(args); 488 var compilerArguments = new List.from(args);
489 var additionalFlags = 489 var additionalFlags =
490 configuration['additional-compiler-flags'].split(' '); 490 configuration['additional-compiler-flags'].split(' ');
491 for (final flag in additionalFlags) { 491 for (final flag in additionalFlags) {
492 if (flag.isEmpty()) continue; 492 if (flag.isEmpty) continue;
493 compilerArguments.add(flag); 493 compilerArguments.add(flag);
494 } 494 }
495 compilerArguments.add('--output-type=dart'); 495 compilerArguments.add('--output-type=dart');
496 String tempDir = createOutputDirectory(info.filePath, ''); 496 String tempDir = createOutputDirectory(info.filePath, '');
497 compilerArguments.add('--out=$tempDir/out.dart'); 497 compilerArguments.add('--out=$tempDir/out.dart');
498 List<Command> commands = 498 List<Command> commands =
499 <Command>[new Command(shellPath(), compilerArguments)]; 499 <Command>[new Command(shellPath(), compilerArguments)];
500 if (info.hasCompileError) { 500 if (info.hasCompileError) {
501 // Do not attempt to run the compiled result. A compilation 501 // Do not attempt to run the compiled result. A compilation
502 // error should be reported by the compilation command. 502 // error should be reported by the compilation command.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 * Those tests which are already HTML web applications (web tests), with 778 * Those tests which are already HTML web applications (web tests), with
779 * resources including CSS files and HTML files, need to be compiled into 779 * resources including CSS files and HTML files, need to be compiled into
780 * a work directory where the relative URLS to the resources work. 780 * a work directory where the relative URLS to the resources work.
781 * We use a subdirectory of the build directory that is the same number 781 * We use a subdirectory of the build directory that is the same number
782 * of levels down in the checkout as the original path of the web test. 782 * of levels down in the checkout as the original path of the web test.
783 */ 783 */
784 String createOutputDirectory(Path testPath, String optionsName) { 784 String createOutputDirectory(Path testPath, String optionsName) {
785 Path relative = testPath.relativeTo(TestUtils.dartDir()); 785 Path relative = testPath.relativeTo(TestUtils.dartDir());
786 relative = relative.directoryPath.append(relative.filenameWithoutExtension); 786 relative = relative.directoryPath.append(relative.filenameWithoutExtension);
787 String testUniqueName = relative.toString().replaceAll('/', '_'); 787 String testUniqueName = relative.toString().replaceAll('/', '_');
788 if (!optionsName.isEmpty()) { 788 if (!optionsName.isEmpty) {
789 testUniqueName = '$testUniqueName-$optionsName'; 789 testUniqueName = '$testUniqueName-$optionsName';
790 } 790 }
791 791
792 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName', 792 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName',
793 // including any intermediate directories that don't exist. 793 // including any intermediate directories that don't exist.
794 var generatedTestPath = Strings.join( 794 var generatedTestPath = Strings.join(
795 [TestUtils.buildDir(configuration), 795 [TestUtils.buildDir(configuration),
796 'generated_tests', 796 'generated_tests',
797 "${configuration['compiler']}-${configuration['runtime']}", 797 "${configuration['compiler']}-${configuration['runtime']}",
798 testUniqueName], '/'); 798 testUniqueName], '/');
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 List<List> result = new List<List>(); 999 List<List> result = new List<List>();
1000 List<String> dartOptions; 1000 List<String> dartOptions;
1001 bool hasCompileError = contents.contains("@compile-error"); 1001 bool hasCompileError = contents.contains("@compile-error");
1002 bool hasRuntimeError = contents.contains("@runtime-error"); 1002 bool hasRuntimeError = contents.contains("@runtime-error");
1003 bool isStaticClean = false; 1003 bool isStaticClean = false;
1004 1004
1005 Iterable<Match> matches = testOptionsRegExp.allMatches(contents); 1005 Iterable<Match> matches = testOptionsRegExp.allMatches(contents);
1006 for (var match in matches) { 1006 for (var match in matches) {
1007 result.add(match[1].split(' ').filter((e) => e != '')); 1007 result.add(match[1].split(' ').filter((e) => e != ''));
1008 } 1008 }
1009 if (result.isEmpty()) result.add([]); 1009 if (result.isEmpty) result.add([]);
1010 1010
1011 matches = dartOptionsRegExp.allMatches(contents); 1011 matches = dartOptionsRegExp.allMatches(contents);
1012 for (var match in matches) { 1012 for (var match in matches) {
1013 if (dartOptions != null) { 1013 if (dartOptions != null) {
1014 throw new Exception( 1014 throw new Exception(
1015 'More than one "// DartOptions=" line in test $filePath'); 1015 'More than one "// DartOptions=" line in test $filePath');
1016 } 1016 }
1017 dartOptions = match[1].split(' ').filter((e) => e != ''); 1017 dartOptions = match[1].split(' ').filter((e) => e != '');
1018 } 1018 }
1019 1019
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 * $noCrash tests are expected to be flaky but not crash 1484 * $noCrash tests are expected to be flaky but not crash
1485 * $pass tests are expected to pass 1485 * $pass tests are expected to pass
1486 * $failOk tests are expected to fail that we won't fix 1486 * $failOk tests are expected to fail that we won't fix
1487 * $fail tests are expected to fail that we should fix 1487 * $fail tests are expected to fail that we should fix
1488 * $crash tests are expected to crash that we should fix 1488 * $crash tests are expected to crash that we should fix
1489 * $timeout tests are allowed to timeout 1489 * $timeout tests are allowed to timeout
1490 """; 1490 """;
1491 print(report); 1491 print(report);
1492 } 1492 }
1493 } 1493 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698