| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 if (configuration['report']) { | 320 if (configuration['report']) { |
| 321 // Tests with multiple VMOptions are counted more than once. | 321 // Tests with multiple VMOptions are counted more than once. |
| 322 for (var dummy in optionsFromFile["vmOptions"]) { | 322 for (var dummy in optionsFromFile["vmOptions"]) { |
| 323 SummaryReport.add(expectations); | 323 SummaryReport.add(expectations); |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 if (expectations.contains(SKIP)) return; | 326 if (expectations.contains(SKIP)) return; |
| 327 | 327 |
| 328 switch (configuration['component']) { | 328 switch (configuration['component']) { |
| 329 case 'dartium': | 329 case 'dartium': |
| 330 case 'chromium': | |
| 331 case 'frogium': | 330 case 'frogium': |
| 332 case 'legium': | 331 case 'legium': |
| 333 case 'webdriver': | 332 case 'webdriver': |
| 334 enqueueBrowserTest(filename, testName, optionsFromFile, | 333 enqueueBrowserTest(filename, testName, optionsFromFile, |
| 335 expectations, isNegative); | 334 expectations, isNegative); |
| 336 break; | 335 break; |
| 337 default: | 336 default: |
| 338 isNegative = isNegative || | 337 isNegative = isNegative || |
| 339 (configuration['checked'] && info.isNegativeIfChecked); | 338 (configuration['checked'] && info.isNegativeIfChecked); |
| 340 | 339 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 doTest(testCase); | 567 doTest(testCase); |
| 569 } | 568 } |
| 570 } | 569 } |
| 571 | 570 |
| 572 /** Helper to create a compilation command for a single input file. */ | 571 /** Helper to create a compilation command for a single input file. */ |
| 573 Command _compileCommand(String inputFile, String outputFile, | 572 Command _compileCommand(String inputFile, String outputFile, |
| 574 String component, String dir, var vmOptions) { | 573 String component, String dir, var vmOptions) { |
| 575 String executable = TestUtils.compilerPath(configuration); | 574 String executable = TestUtils.compilerPath(configuration); |
| 576 List<String> args = TestUtils.standardOptions(configuration); | 575 List<String> args = TestUtils.standardOptions(configuration); |
| 577 switch (component) { | 576 switch (component) { |
| 578 // TODO(zundel): Remove chromium now that dartc doesn't generate code? | |
| 579 case 'chromium': | |
| 580 args.addAll(['--work', dir]); | |
| 581 args.addAll(vmOptions); | |
| 582 args.add('--ignore-unrecognized-flags'); | |
| 583 args.add(inputFile); | |
| 584 // TODO(whesse): Add --fatal-type-errors if needed. | |
| 585 break; | |
| 586 case 'frogium': | 577 case 'frogium': |
| 587 case 'legium': | 578 case 'legium': |
| 588 case 'webdriver': | 579 case 'webdriver': |
| 589 String libdir = configuration['froglib']; | 580 String libdir = configuration['froglib']; |
| 590 if (libdir == '') { | 581 if (libdir == '') { |
| 591 libdir = '$dartDir/frog/lib'; | 582 libdir = '$dartDir/frog/lib'; |
| 592 } | 583 } |
| 593 args.addAll(['--libdir=$libdir', | 584 args.addAll(['--libdir=$libdir', |
| 594 '--compile-only', | 585 '--compile-only', |
| 595 '--out=$outputFile']); | 586 '--out=$outputFile']); |
| 596 args.addAll(vmOptions); | 587 args.addAll(vmOptions); |
| 597 args.add(inputFile); | 588 args.add(inputFile); |
| 598 break; | 589 break; |
| 599 default: | 590 default: |
| 600 Expect.fail('unimplemented component $component'); | 591 Expect.fail('unimplemented component $component'); |
| 601 } | 592 } |
| 602 return new Command(executable, args); | 593 return new Command(executable, args); |
| 603 } | 594 } |
| 604 | 595 |
| 605 bool get requiresCleanTemporaryDirectory() => | 596 bool get requiresCleanTemporaryDirectory() => |
| 606 configuration['component'] == 'dartc' || | 597 configuration['component'] == 'dartc'; |
| 607 configuration['component'] == 'chromium'; | |
| 608 | 598 |
| 609 /** | 599 /** |
| 610 * Create a directory for the generated test. If a Dart language test | 600 * Create a directory for the generated test. If a Dart language test |
| 611 * needs to be run in a browser, the Dart test needs to be embedded in | 601 * needs to be run in a browser, the Dart test needs to be embedded in |
| 612 * an HTML page, with a testing framework based on scripting and DOM events. | 602 * an HTML page, with a testing framework based on scripting and DOM events. |
| 613 * These scripts and pages are written to a generated_test directory, | 603 * These scripts and pages are written to a generated_test directory, |
| 614 * usually inside the build directory of the checkout. | 604 * usually inside the build directory of the checkout. |
| 615 * | 605 * |
| 616 * Some tests, such as those using the dartc compiler, need to be run | 606 * Some tests, such as those using the dartc compiler, need to be run |
| 617 * with an empty directory as the compiler's work directory. These | 607 * with an empty directory as the compiler's work directory. These |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 } | 656 } |
| 667 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); | 657 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); |
| 668 return TestUtils.mkdirRecursive(tempDirPath, | 658 return TestUtils.mkdirRecursive(tempDirPath, |
| 669 Strings.join(generatedTestPath, '/')); | 659 Strings.join(generatedTestPath, '/')); |
| 670 } | 660 } |
| 671 | 661 |
| 672 String get scriptType() { | 662 String get scriptType() { |
| 673 switch (configuration['component']) { | 663 switch (configuration['component']) { |
| 674 case 'dartium': | 664 case 'dartium': |
| 675 return 'application/dart'; | 665 return 'application/dart'; |
| 676 case 'chromium': | |
| 677 case 'frogium': | 666 case 'frogium': |
| 678 case 'legium': | 667 case 'legium': |
| 679 case 'webdriver': | 668 case 'webdriver': |
| 680 return 'text/javascript'; | 669 return 'text/javascript'; |
| 681 default: | 670 default: |
| 682 Expect.fail('Unimplemented component scriptType'); | 671 Expect.fail('Unimplemented component scriptType'); |
| 683 return null; | 672 return null; |
| 684 } | 673 } |
| 685 } | 674 } |
| 686 | 675 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 case 'frogsh': | 1081 case 'frogsh': |
| 1093 return 'frog/bin/frogsh$suffix'; | 1082 return 'frog/bin/frogsh$suffix'; |
| 1094 default: | 1083 default: |
| 1095 throw "Unknown executable for: ${configuration['component']}"; | 1084 throw "Unknown executable for: ${configuration['component']}"; |
| 1096 } | 1085 } |
| 1097 } | 1086 } |
| 1098 | 1087 |
| 1099 static String compilerName(Map configuration) { | 1088 static String compilerName(Map configuration) { |
| 1100 String suffix = executableSuffix(configuration['component']); | 1089 String suffix = executableSuffix(configuration['component']); |
| 1101 switch (configuration['component']) { | 1090 switch (configuration['component']) { |
| 1102 case 'chromium': | |
| 1103 case 'dartc': | 1091 case 'dartc': |
| 1104 return 'compiler/bin/dartc$suffix'; | 1092 return 'compiler/bin/dartc$suffix'; |
| 1105 case 'frogium': | 1093 case 'frogium': |
| 1106 case 'legium': | 1094 case 'legium': |
| 1107 case 'webdriver': | 1095 case 'webdriver': |
| 1108 return 'frog/bin/frog$suffix'; | 1096 return 'frog/bin/frog$suffix'; |
| 1109 default: | 1097 default: |
| 1110 throw "Unknown compiler for: ${configuration['component']}"; | 1098 throw "Unknown compiler for: ${configuration['component']}"; |
| 1111 } | 1099 } |
| 1112 } | 1100 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 * $noCrash tests are expected to be flaky but not crash | 1204 * $noCrash tests are expected to be flaky but not crash |
| 1217 * $pass tests are expected to pass | 1205 * $pass tests are expected to pass |
| 1218 * $failOk tests are expected to fail that we won't fix | 1206 * $failOk tests are expected to fail that we won't fix |
| 1219 * $fail tests are expected to fail that we should fix | 1207 * $fail tests are expected to fail that we should fix |
| 1220 * $crash tests are expected to crash that we should fix | 1208 * $crash tests are expected to crash that we should fix |
| 1221 * $timeout tests are allowed to timeout | 1209 * $timeout tests are allowed to timeout |
| 1222 """; | 1210 """; |
| 1223 print(report); | 1211 print(report); |
| 1224 } | 1212 } |
| 1225 } | 1213 } |
| OLD | NEW |