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

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

Issue 9022004: Enable frogium component in test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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_options.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) 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("test_suite"); 5 #library("test_suite");
6 6
7 #import("status_file_parser.dart"); 7 #import("status_file_parser.dart");
8 #import("test_runner.dart"); 8 #import("test_runner.dart");
9 #import("multitest.dart"); 9 #import("multitest.dart");
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 Set<String> expectations = testExpectations.expectations(testName); 249 Set<String> expectations = testExpectations.expectations(testName);
250 if (configuration["report"]) { 250 if (configuration["report"]) {
251 // Tests with multiple VMOptions are counted more than once. 251 // Tests with multiple VMOptions are counted more than once.
252 for (var dummy in optionsFromFile["vmOptions"]) { 252 for (var dummy in optionsFromFile["vmOptions"]) {
253 SummaryReport.add(expectations); 253 SummaryReport.add(expectations);
254 } 254 }
255 } 255 }
256 if (expectations.contains(SKIP)) return; 256 if (expectations.contains(SKIP)) return;
257 257
258 if (configuration['component'] == 'dartium') { 258 switch (configuration['component']) {
259 enqueueDartiumTest(filename, testName, optionsFromFile, 259 case 'dartium':
260 expectations, isNegative); 260 enqueueDartiumTest(filename, testName, optionsFromFile,
Bill Hesse 2011/12/22 13:26:02 I plan to merge Dartium and Chromium/Frogium in th
261 return; 261 expectations, isNegative);
262 } 262 break;
263 if (configuration['component'] == 'chromium') { 263 case 'chromium':
264 enqueueChromiumTest(filename, testName, optionsFromFile, 264 case 'frogium':
265 expectations, isNegative); 265 enqueueChromiumTest(filename, testName, optionsFromFile,
266 return; 266 expectations, isNegative);
Mads Ager (google) 2011/12/22 15:22:59 indentation.
267 } 267 break;
268 default:
269 // Only dartc supports fatal type errors. Enable fatal type
270 // errors with a flag and treat tests that have fatal type
271 // errors as negative.
272 var enableFatalTypeErrors =
273 (info.hasFatalTypeErrors && configuration['component'] == 'dartc');
274 var argumentLists = argumentListsFromFile(filename,
275 optionsFromFile,
276 enableFatalTypeErrors);
277 isNegative = isNegative ||
278 (configuration['checked'] && info.isNegativeIfChecked) ||
279 enableFatalTypeErrors;
268 280
269 // Only dartc supports fatal type errors. Enable fatal type 281 for (var args in argumentLists) {
270 // errors with a flag and treat tests that have fatal type 282 doTest(new TestCase('$suiteName/$testName',
271 // errors as negative. 283 shellPath(),
272 var enableFatalTypeErrors = 284 args,
273 (info.hasFatalTypeErrors && configuration['component'] == 'dartc'); 285 configuration,
274 var argumentLists = argumentListsFromFile(filename, 286 completeHandler,
275 optionsFromFile, 287 expectations,
276 enableFatalTypeErrors); 288 isNegative));
277 isNegative = isNegative || 289 }
278 (configuration['checked'] && info.isNegativeIfChecked) ||
279 enableFatalTypeErrors;
280
281 for (var args in argumentLists) {
282 doTest(new TestCase('$suiteName/$testName',
283 shellPath(),
284 args,
285 configuration,
286 completeHandler,
287 expectations,
288 isNegative));
289 } 290 }
290 } 291 }
291 292
292 Function makeTestCaseCreator(Map optionsFromFile) { 293 Function makeTestCaseCreator(Map optionsFromFile) {
293 return (String filename, 294 return (String filename,
294 bool isNegative, 295 bool isNegative,
295 [bool isNegativeIfChecked = false, 296 [bool isNegativeIfChecked = false,
296 bool hasFatalTypeErrors = false]) { 297 bool hasFatalTypeErrors = false]) {
297 // Cache the test information for each test case. 298 // Cache the test information for each test case.
298 var info = new TestInformation(filename, 299 var info = new TestInformation(filename,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 new Directory(outputDirBase).createSync(); 448 new Directory(outputDirBase).createSync();
448 } 449 }
449 Directory tempDir = new Directory( 450 Directory tempDir = new Directory(
450 '$outputDirBase/${testRelativeDirFlattened}_$testNameBase'); 451 '$outputDirBase/${testRelativeDirFlattened}_$testNameBase');
451 if (!tempDir.existsSync()) { 452 if (!tempDir.existsSync()) {
452 tempDir.createSync(); 453 tempDir.createSync();
453 } 454 }
454 455
455 String dartWrapperFilename = '${tempDir.path}/test.dart'; 456 String dartWrapperFilename = '${tempDir.path}/test.dart';
456 String compiledDartWrapperFilename = '${tempDir.path}/test.js'; 457 String compiledDartWrapperFilename = '${tempDir.path}/test.js';
458 String domInWrapper = 'dart:dom';
Mads Ager (google) 2011/12/22 15:22:59 How about domLibraryImport? I think the name shoul
459 if (configuration['component'] == 'chromium') {
460 domInWrapper = '$dartDir/client/testing/unittest/dom_for_unittest.dart';
461 }
462
457 if (!isWebTest) { 463 if (!isWebTest) {
458 // test.dart will import the dart test directly, if it is a library, 464 // test.dart will import the dart test directly, if it is a library,
459 // or indirectly through test_as_library.dart, if it is not. 465 // or indirectly through test_as_library.dart, if it is not.
460 String dartLibraryFilename; 466 String dartLibraryFilename;
461 if (isLibraryDefinition) { 467 if (isLibraryDefinition) {
462 dartLibraryFilename = testPath; 468 dartLibraryFilename = testPath;
463 } else { 469 } else {
464 dartLibraryFilename = 'test_as_library.dart'; 470 dartLibraryFilename = 'test_as_library.dart';
465 File file = new File('${tempDir.path}/$dartLibraryFilename'); 471 File file = new File('${tempDir.path}/$dartLibraryFilename');
466 RandomAccessFile dartLibrary = file.openSync(writable: true); 472 RandomAccessFile dartLibrary = file.openSync(writable: true);
467 dartLibrary.writeStringSync(WrapDartTestInLibrary(testPath)); 473 dartLibrary.writeStringSync(WrapDartTestInLibrary(testPath));
468 dartLibrary.closeSync(); 474 dartLibrary.closeSync();
469 } 475 }
470 476
471 File file = new File(dartWrapperFilename); 477 File file = new File(dartWrapperFilename);
472 RandomAccessFile dartWrapper = file.openSync(writable: true); 478 RandomAccessFile dartWrapper = file.openSync(writable: true);
473 dartWrapper.writeStringSync(DartTestWrapper( 479 dartWrapper.writeStringSync(DartTestWrapper(
474 '$dartDir/client/testing/unittest/dom_for_unittest.dart', 480 domInWrapper,
475 '$dartDir/tests/isolate/src/TestFramework.dart', 481 '$dartDir/tests/isolate/src/TestFramework.dart',
476 dartLibraryFilename)); 482 dartLibraryFilename));
477 dartWrapper.closeSync(); 483 dartWrapper.closeSync();
478 } else { 484 } else {
479 return; // TODO(whesse): Implement client web tests on dartium. 485 return; // TODO(whesse): Implement client web tests on dartium.
480 } 486 }
481 // Create the HTML file for the test. 487 // Create the HTML file for the test.
482 File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}'); 488 File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}');
483 RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true); 489 RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true);
484 htmlTest.writeStringSync(GetHtmlContents( 490 htmlTest.writeStringSync(GetHtmlContents(
485 filename, 491 filename,
486 '$dartDir/client/testing/unittest/test_controller.js', 492 '$dartDir/client/testing/unittest/test_controller.js',
487 scriptType, 493 scriptType,
488 compiledDartWrapperFilename)); 494 compiledDartWrapperFilename));
489 htmlTest.closeSync(); 495 htmlTest.closeSync();
490 496
491 for (var vmOptions in optionsFromFile["vmOptions"]) { 497 for (var vmOptions in optionsFromFile["vmOptions"]) {
492 List<String> dartcArgs = ['--work', tempDir.path]; 498 List<String> compilerArgs;
493 if (configuration['mode'] == 'release') { 499 String compilerExecutable = TestUtils.compilerPath(configuration);
494 dartcArgs.add('--optimize'); 500 switch (configuration['component']) {
501 case 'chromium':
502 compilerArgs = ['--work', tempDir.path];
503 if (configuration['mode'] == 'release') {
504 compilerArgs.add('--optimize');
505 }
506 compilerArgs.addAll(vmOptions);
507 compilerArgs.add('--ignore-unrecognized-flags');
508 compilerArgs.add('--out');
509 compilerArgs.add(compiledDartWrapperFilename);
510 compilerArgs.add(dartWrapperFilename);
511 // TODO(whesse): Add --fatal-type-errors if needed.
512 break;
513 case 'frogium':
514 compilerArgs = ['--libdir=$dartDir/frog/lib',
515 '--compile-only',
516 '--out=$compiledDartWrapperFilename'];
517 compilerArgs.addAll(vmOptions);
518 compilerArgs.add(dartWrapperFilename);
519 break;
520 default:
521 Expect.fail('unimplemented component ${configuration['component']}');
495 } 522 }
496 dartcArgs.addAll(vmOptions); 523
497 dartcArgs.add('--ignore-unrecognized-flags');
498 dartcArgs.add('--out');
499 dartcArgs.add(compiledDartWrapperFilename);
500 dartcArgs.add(dartWrapperFilename);
501 // TODO(whesse): Add --fatal-type-errors if needed.
502 var args = ['--no-timeout']; 524 var args = ['--no-timeout'];
503 args.add(htmlTestBase.fullPathSync()); 525 args.add(htmlTestBase.fullPathSync());
504 526
505 // Create BrowserTestCase and queue it. 527 // Create BrowserTestCase and queue it.
506 var testCase = new BrowserTestCase( 528 var testCase = new BrowserTestCase(
507 testName, 529 testName,
508 TestUtils.dartcCompilationShellPath(configuration), 530 compilerExecutable,
509 dartcArgs, 531 compilerArgs,
510 dumpRenderTreeFilename, 532 dumpRenderTreeFilename,
511 args, 533 args,
512 configuration, 534 configuration,
513 completeHandler, 535 completeHandler,
514 expectations, 536 expectations,
515 optionsFromFile['isNegative']); 537 optionsFromFile['isNegative']);
516 doTest(testCase); 538 doTest(testCase);
517 } 539 }
518 } 540 }
519 541
520 String get scriptType() { 542 String get scriptType() {
521 switch (configuration['component']) { 543 switch (configuration['component']) {
522 case 'dartium': 544 case 'dartium':
523 return 'application/dart'; 545 return 'application/dart';
524 case 'chromium': 546 case 'chromium':
547 case 'frogium':
525 return 'text/javascript'; 548 return 'text/javascript';
526 default: 549 default:
527 Expect.fail('Unimplemented component scriptType'); 550 Expect.fail('Unimplemented component scriptType');
528 return null; 551 return null;
529 } 552 }
530 } 553 }
531 554
532 String get scriptName() { 555 String get scriptName() {
533 switch (configuration['component']) { 556 switch (configuration['component']) {
534 case 'dartium': 557 case 'dartium':
535 return tempDir.path + 'test.dart'; 558 return tempDir.path + 'test.dart';
536 case 'chromium': 559 case 'chromium':
560 case 'frogium':
537 return tempDir.path + 'test.js'; 561 return tempDir.path + 'test.js';
538 default: 562 default:
539 Expect.fail('Unimplemented component scriptType'); 563 Expect.fail('Unimplemented component scriptType');
540 return null; 564 return null;
541 } 565 }
542 } 566 }
543 567
544 String getHtmlName(String filename) { 568 String getHtmlName(String filename) {
545 switch (configuration['component']) { 569 switch (configuration['component']) {
546 case 'dartium': 570 case 'dartium':
547 return filename.replaceAll(pathSeparator, '_') + 'dartium.html'; 571 return filename.replaceAll(pathSeparator, '_') + 'dartium.html';
548 case 'chromium': 572 case 'chromium':
573 case 'frogium':
549 return 'test.html'; 574 return 'test.html';
550 default: 575 default:
551 Expect.fail('Unimplemented component scriptType'); 576 Expect.fail('Unimplemented component scriptType');
552 return null; 577 return null;
553 } 578 }
554 } 579 }
555 580
556 String get dumpRenderTreeFilename() { 581 String get dumpRenderTreeFilename() {
557 if (new Platform().operatingSystem() == 'macos') { 582 if (new Platform().operatingSystem() == 'macos') {
558 return 'client/tests/drt/DumpRenderTree.app/Contents/' + 583 return 'client/tests/drt/DumpRenderTree.app/Contents/' +
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 expectations); 737 expectations);
713 738
714 void activityStarted() => ++activityCount; 739 void activityStarted() => ++activityCount;
715 740
716 void activityCompleted() { 741 void activityCompleted() {
717 if (--activityCount == 0) { 742 if (--activityCount == 0) {
718 directoryListingDone(true); 743 directoryListingDone(true);
719 } 744 }
720 } 745 }
721 746
722 String shellPath() => TestUtils.dartcCompilationShellPath(configuration); 747 String shellPath() => TestUtils.compilerPath(configuration);
723 748
724 List<String> additionalOptions() { 749 List<String> additionalOptions() {
725 // TODO(ager): potentially register cleanup action to delete the temporary 750 // TODO(ager): potentially register cleanup action to delete the temporary
726 // directories? 751 // directories?
727 var tempDir = new Directory(''); 752 var tempDir = new Directory('');
728 tempDir.createTempSync(); 753 tempDir.createTempSync();
729 return ['-check-only', '-fatal-type-errors', '-Werror', '-out', tempDir.path ]; 754 return ['-check-only', '-fatal-type-errors', '-Werror', '-out', tempDir.path ];
730 } 755 }
731 756
732 void processDirectory() { 757 void processDirectory() {
(...skipping 30 matching lines...) Expand all
763 case 'frog': 788 case 'frog':
764 case 'leg': 789 case 'leg':
765 return 'frog/bin/frog$postfix'; 790 return 'frog/bin/frog$postfix';
766 case 'frogsh': 791 case 'frogsh':
767 return 'frog/bin/frogsh$postfix'; 792 return 'frog/bin/frogsh$postfix';
768 default: 793 default:
769 throw "Unknown executable for: ${configuration['component']}"; 794 throw "Unknown executable for: ${configuration['component']}";
770 } 795 }
771 } 796 }
772 797
798 static String compilerName(Map configuration) {
799 String postfix =
800 (new Platform().operatingSystem() == 'windows') ? '.exe' : '';
801 switch (configuration['component']) {
802 case 'chromium':
Bill Hesse 2011/12/22 13:26:02 Add case 'dartc' here.
803 return 'compiler/bin/dartc$postfix';
804 case 'frogium':
805 return 'frog/bin/frogsh$postfix';
806 default:
807 throw "Unknown compiler for: ${configuration['component']}";
808 }
809 }
810
773 static String dartShellFileName(Map configuration) { 811 static String dartShellFileName(Map configuration) {
774 var name = '${buildDir(configuration)}/${executableName(configuration)}'; 812 var name = '${buildDir(configuration)}/${executableName(configuration)}';
775 if (!(new File(name)).existsSync()) { 813 if (!(new File(name)).existsSync()) {
776 throw "Executable '$name' does not exist"; 814 throw "Executable '$name' does not exist";
777 } 815 }
778 return name; 816 return name;
779 } 817 }
780 818
781 static String dartcCompilationShellPath(Map configuration) { 819 static String compilerPath(Map configuration) {
782 var name = '${buildDir(configuration)}/compiler/bin/dartc'; 820 var name = '${buildDir(configuration)}/${compilerName(configuration)}';
783 if (!(new File(name)).existsSync()) { 821 if (!(new File(name)).existsSync()) {
784 throw "Executable '$name' does not exist"; 822 throw "Executable '$name' does not exist";
785 } 823 }
786 return name; 824 return name;
787 } 825 }
788 826
789 static String outputDir(Map configuration) { 827 static String outputDir(Map configuration) {
790 var outputDir = ''; 828 var outputDir = '';
791 var system = configuration['system']; 829 var system = configuration['system'];
792 if (system == 'linux') { 830 if (system == 'linux') {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 * $noCrash tests are expected to be flaky but not crash 906 * $noCrash tests are expected to be flaky but not crash
869 * $pass tests are expected to pass 907 * $pass tests are expected to pass
870 * $failOk tests are expected to fail that we won't fix 908 * $failOk tests are expected to fail that we won't fix
871 * $fail tests are expected to fail that we should fix 909 * $fail tests are expected to fail that we should fix
872 * $crash tests are expected to crash that we should fix 910 * $crash tests are expected to crash that we should fix
873 * $timeout tests are allowed to timeout\ 911 * $timeout tests are allowed to timeout\
874 """; 912 """;
875 print(report); 913 print(report);
876 } 914 }
877 } 915 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698