| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 doTest(testCase); | 579 doTest(testCase); |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 /** Helper to create a compilation command for a single input file. */ | 583 /** Helper to create a compilation command for a single input file. */ |
| 584 Command _compileCommand(String inputFile, String outputFile, | 584 Command _compileCommand(String inputFile, String outputFile, |
| 585 String component, String dir, var vmOptions) { | 585 String component, String dir, var vmOptions) { |
| 586 String executable = TestUtils.compilerPath(configuration); | 586 String executable = TestUtils.compilerPath(configuration); |
| 587 List<String> args = TestUtils.standardOptions(configuration); | 587 List<String> args = TestUtils.standardOptions(configuration); |
| 588 switch (component) { | 588 switch (component) { |
| 589 // TODO(zundel): Remove chromium now that dartc doesn't generate code? | |
| 590 case 'chromium': | |
| 591 args.addAll(['--work', dir]); | |
| 592 args.addAll(vmOptions); | |
| 593 args.add('--ignore-unrecognized-flags'); | |
| 594 args.add(inputFile); | |
| 595 // TODO(whesse): Add --fatal-type-errors if needed. | |
| 596 break; | |
| 597 case 'frogium': | 589 case 'frogium': |
| 598 case 'legium': | 590 case 'legium': |
| 599 case 'webdriver': | 591 case 'webdriver': |
| 600 String libdir = configuration['froglib']; | 592 String libdir = configuration['froglib']; |
| 601 if (libdir == '') { | 593 if (libdir == '') { |
| 602 libdir = '$dartDir/frog/lib'; | 594 libdir = '$dartDir/frog/lib'; |
| 603 } | 595 } |
| 604 args.addAll(['--libdir=$libdir', | 596 args.addAll(['--libdir=$libdir', |
| 605 '--compile-only', | 597 '--compile-only', |
| 606 '--out=$outputFile']); | 598 '--out=$outputFile']); |
| 607 args.addAll(vmOptions); | 599 args.addAll(vmOptions); |
| 608 args.add(inputFile); | 600 args.add(inputFile); |
| 609 break; | 601 break; |
| 610 default: | 602 default: |
| 611 Expect.fail('unimplemented component $component'); | 603 Expect.fail('unimplemented component $component'); |
| 612 } | 604 } |
| 613 return new Command(executable, args); | 605 return new Command(executable, args); |
| 614 } | 606 } |
| 615 | 607 |
| 616 bool get requiresCleanTemporaryDirectory() => | 608 bool get requiresCleanTemporaryDirectory() => |
| 617 configuration['component'] == 'dartc' || | 609 configuration['component'] == 'dartc'; |
| 618 configuration['component'] == 'chromium'; | |
| 619 | 610 |
| 620 /** | 611 /** |
| 621 * Create a directory for the generated test. If a Dart language test | 612 * Create a directory for the generated test. If a Dart language test |
| 622 * needs to be run in a browser, the Dart test needs to be embedded in | 613 * needs to be run in a browser, the Dart test needs to be embedded in |
| 623 * an HTML page, with a testing framework based on scripting and DOM events. | 614 * an HTML page, with a testing framework based on scripting and DOM events. |
| 624 * These scripts and pages are written to a generated_test directory, | 615 * These scripts and pages are written to a generated_test directory, |
| 625 * usually inside the build directory of the checkout. | 616 * usually inside the build directory of the checkout. |
| 626 * | 617 * |
| 627 * Some tests, such as those using the dartc compiler, need to be run | 618 * Some tests, such as those using the dartc compiler, need to be run |
| 628 * with an empty directory as the compiler's work directory. These | 619 * with an empty directory as the compiler's work directory. These |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 669 } |
| 679 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); | 670 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); |
| 680 return TestUtils.mkdirRecursive(tempDirPath, | 671 return TestUtils.mkdirRecursive(tempDirPath, |
| 681 Strings.join(generatedTestPath, '/')); | 672 Strings.join(generatedTestPath, '/')); |
| 682 } | 673 } |
| 683 | 674 |
| 684 String get scriptType() { | 675 String get scriptType() { |
| 685 switch (configuration['component']) { | 676 switch (configuration['component']) { |
| 686 case 'dartium': | 677 case 'dartium': |
| 687 return 'application/dart'; | 678 return 'application/dart'; |
| 688 case 'chromium': | |
| 689 case 'frogium': | 679 case 'frogium': |
| 690 case 'legium': | 680 case 'legium': |
| 691 case 'webdriver': | 681 case 'webdriver': |
| 692 return 'text/javascript'; | 682 return 'text/javascript'; |
| 693 default: | 683 default: |
| 694 Expect.fail('Unimplemented component scriptType'); | 684 Expect.fail('Unimplemented component scriptType'); |
| 695 return null; | 685 return null; |
| 696 } | 686 } |
| 697 } | 687 } |
| 698 | 688 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 case 'frogsh': | 1094 case 'frogsh': |
| 1105 return 'frog/bin/frogsh$suffix'; | 1095 return 'frog/bin/frogsh$suffix'; |
| 1106 default: | 1096 default: |
| 1107 throw "Unknown executable for: ${configuration['component']}"; | 1097 throw "Unknown executable for: ${configuration['component']}"; |
| 1108 } | 1098 } |
| 1109 } | 1099 } |
| 1110 | 1100 |
| 1111 static String compilerName(Map configuration) { | 1101 static String compilerName(Map configuration) { |
| 1112 String suffix = executableSuffix(configuration['component']); | 1102 String suffix = executableSuffix(configuration['component']); |
| 1113 switch (configuration['component']) { | 1103 switch (configuration['component']) { |
| 1114 case 'chromium': | |
| 1115 case 'dartc': | 1104 case 'dartc': |
| 1116 return 'compiler/bin/dartc$suffix'; | 1105 return 'compiler/bin/dartc$suffix'; |
| 1117 case 'frogium': | 1106 case 'frogium': |
| 1118 case 'legium': | 1107 case 'legium': |
| 1119 case 'webdriver': | 1108 case 'webdriver': |
| 1120 return 'frog/bin/frog$suffix'; | 1109 return 'frog/bin/frog$suffix'; |
| 1121 default: | 1110 default: |
| 1122 throw "Unknown compiler for: ${configuration['component']}"; | 1111 throw "Unknown compiler for: ${configuration['component']}"; |
| 1123 } | 1112 } |
| 1124 } | 1113 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 * $noCrash tests are expected to be flaky but not crash | 1223 * $noCrash tests are expected to be flaky but not crash |
| 1235 * $pass tests are expected to pass | 1224 * $pass tests are expected to pass |
| 1236 * $failOk tests are expected to fail that we won't fix | 1225 * $failOk tests are expected to fail that we won't fix |
| 1237 * $fail tests are expected to fail that we should fix | 1226 * $fail tests are expected to fail that we should fix |
| 1238 * $crash tests are expected to crash that we should fix | 1227 * $crash tests are expected to crash that we should fix |
| 1239 * $timeout tests are allowed to timeout | 1228 * $timeout tests are allowed to timeout |
| 1240 """; | 1229 """; |
| 1241 print(report); | 1230 print(report); |
| 1242 } | 1231 } |
| 1243 } | 1232 } |
| OLD | NEW |