Chromium Code Reviews| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 configuration, statusFileRead); | 520 configuration, statusFileRead); |
| 521 } | 521 } |
| 522 | 522 |
| 523 return completer.future; | 523 return completer.future; |
| 524 } | 524 } |
| 525 | 525 |
| 526 Future enqueueTests() { | 526 Future enqueueTests() { |
| 527 Directory dir = new Directory.fromPath(suiteDir); | 527 Directory dir = new Directory.fromPath(suiteDir); |
| 528 return dir.exists().chain((exists) { | 528 return dir.exists().chain((exists) { |
| 529 if (!exists) { | 529 if (!exists) { |
| 530 print('Directory containing tests not found: $suiteDir'); | 530 print('Directory containing tests missing: ${suiteDir.toNativePath()}'); |
| 531 return new Future.immediate(null); | 531 return new Future.immediate(null); |
| 532 } else { | 532 } else { |
| 533 var group = new FutureGroup(); | 533 var group = new FutureGroup(); |
| 534 enqueueDirectory(dir, group); | 534 enqueueDirectory(dir, group); |
| 535 return group.future; | 535 return group.future; |
| 536 } | 536 } |
| 537 }); | 537 }); |
| 538 } | 538 } |
| 539 | 539 |
| 540 void enqueueDirectory(Directory dir, FutureGroup group) { | 540 void enqueueDirectory(Directory dir, FutureGroup group) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 791 if (getVmOptions(optionsFromFile).length > 1) { | 791 if (getVmOptions(optionsFromFile).length > 1) { |
| 792 optionsName = Strings.join(vmOptions, '-').replaceAll('-','') | 792 optionsName = Strings.join(vmOptions, '-').replaceAll('-','') |
| 793 .replaceAll('=','') | 793 .replaceAll('=','') |
| 794 .replaceAll('/',''); | 794 .replaceAll('/',''); |
| 795 } | 795 } |
| 796 final String tempDir = createOutputDirectory(info.filePath, optionsName); | 796 final String tempDir = createOutputDirectory(info.filePath, optionsName); |
| 797 | 797 |
| 798 String dartWrapperFilename = '$tempDir/test.dart'; | 798 String dartWrapperFilename = '$tempDir/test.dart'; |
| 799 String compiledDartWrapperFilename = '$tempDir/test.js'; | 799 String compiledDartWrapperFilename = '$tempDir/test.js'; |
| 800 | 800 |
| 801 String htmlPath = '$tempDir/test.html'; | 801 String htmlPath = '$tempDir/test.html'; |
|
ahe
2012/12/04 11:24:51
I'm getting a feeling that this should have been a
| |
| 802 if (isWrappingRequired && !isWebTest) { | 802 if (isWrappingRequired && !isWebTest) { |
| 803 // test.dart will import the dart test directly, if it is a library, | 803 // test.dart will import the dart test directly, if it is a library, |
| 804 // or indirectly through test_as_library.dart, if it is not. | 804 // or indirectly through test_as_library.dart, if it is not. |
| 805 Path dartLibraryFilename = filePath; | 805 Path dartLibraryFilename = filePath; |
| 806 if (!isLibraryDefinition) { | 806 if (!isLibraryDefinition) { |
| 807 dartLibraryFilename = new Path('test_as_library.dart'); | 807 dartLibraryFilename = new Path('test_as_library.dart'); |
| 808 File file = new File('$tempDir/$dartLibraryFilename'); | 808 File file = new File('$tempDir/$dartLibraryFilename'); |
| 809 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); | 809 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); |
| 810 dartLibrary.writeStringSync(wrapDartTestInLibrary(filePath)); | 810 dartLibrary.writeStringSync(wrapDartTestInLibrary(filePath)); |
| 811 dartLibrary.closeSync(); | 811 dartLibrary.closeSync(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 } | 889 } |
| 890 | 890 |
| 891 // Variables for browser multi-tests. | 891 // Variables for browser multi-tests. |
| 892 List<String> subtestNames = info.optionsFromFile['subtestNames']; | 892 List<String> subtestNames = info.optionsFromFile['subtestNames']; |
| 893 TestCase multitestParentTest; | 893 TestCase multitestParentTest; |
| 894 int subtestIndex = 0; | 894 int subtestIndex = 0; |
| 895 // Construct the command that executes the browser test | 895 // Construct the command that executes the browser test |
| 896 do { | 896 do { |
| 897 List<String> args = <String>[]; | 897 List<String> args = <String>[]; |
| 898 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath : | 898 String fullHtmlPath = htmlPath.startsWith('http:') ? htmlPath : |
| 899 'file://$htmlPath'; | 899 (htmlPath.startsWith('/') ? |
| 900 'file://$htmlPath' : | |
| 901 'file:///$htmlPath'); | |
| 900 if (info.optionsFromFile['isMultiHtmlTest'] | 902 if (info.optionsFromFile['isMultiHtmlTest'] |
| 901 && subtestNames.length > 0) { | 903 && subtestNames.length > 0) { |
| 902 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; | 904 fullHtmlPath = '${fullHtmlPath}#${subtestNames[subtestIndex]}'; |
| 903 } | 905 } |
| 904 if (TestUtils.usesWebDriver(runtime)) { | 906 if (TestUtils.usesWebDriver(runtime)) { |
| 905 args = [ | 907 args = [ |
| 906 dartDir.append('tools/testing/run_selenium.py').toNativePath(), | 908 dartDir.append('tools/testing/run_selenium.py').toNativePath(), |
| 907 '--browser=$runtime', | 909 '--browser=$runtime', |
| 908 '--timeout=${configuration["timeout"] - 2}', | 910 '--timeout=${configuration["timeout"] - 2}', |
| 909 '--out="$fullHtmlPath"']; | 911 '--out="$fullHtmlPath"']; |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1681 * $pass tests are expected to pass | 1683 * $pass tests are expected to pass |
| 1682 * $failOk tests are expected to fail that we won't fix | 1684 * $failOk tests are expected to fail that we won't fix |
| 1683 * $fail tests are expected to fail that we should fix | 1685 * $fail tests are expected to fail that we should fix |
| 1684 * $crash tests are expected to crash that we should fix | 1686 * $crash tests are expected to crash that we should fix |
| 1685 * $timeout tests are allowed to timeout | 1687 * $timeout tests are allowed to timeout |
| 1686 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1688 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1687 """; | 1689 """; |
| 1688 print(report); | 1690 print(report); |
| 1689 } | 1691 } |
| 1690 } | 1692 } |
| OLD | NEW |