| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 buildPath.removeRange(0, 1); | 664 buildPath.removeRange(0, 1); |
| 665 if (buildPath.last() == '') buildPath.removeLast(); | 665 if (buildPath.last() == '') buildPath.removeLast(); |
| 666 buildPath.addAll(generatedTestPath); | 666 buildPath.addAll(generatedTestPath); |
| 667 generatedTestPath = buildPath; | 667 generatedTestPath = buildPath; |
| 668 tempDir = new Directory(tempDirPath); | 668 tempDir = new Directory(tempDirPath); |
| 669 if (!tempDir.existsSync()) { | 669 if (!tempDir.existsSync()) { |
| 670 tempDir.createSync(); | 670 tempDir.createSync(); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); | 673 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); |
| 674 | 674 return TestUtils.mkdirRecursive(tempDirPath, |
| 675 for (String subdirectory in generatedTestPath) { | 675 Strings.join(generatedTestPath, '/')); |
| 676 tempDirPath = '$tempDirPath/$subdirectory'; | |
| 677 tempDir = new Directory(tempDirPath); | |
| 678 if (!tempDir.existsSync()) { | |
| 679 tempDir.createSync(); | |
| 680 } | |
| 681 } | |
| 682 return tempDir; | |
| 683 } | 676 } |
| 684 | 677 |
| 685 String get scriptType() { | 678 String get scriptType() { |
| 686 switch (configuration['component']) { | 679 switch (configuration['component']) { |
| 687 case 'dartium': | 680 case 'dartium': |
| 688 return 'application/dart'; | 681 return 'application/dart'; |
| 689 case 'chromium': | 682 case 'chromium': |
| 690 case 'frogium': | 683 case 'frogium': |
| 691 case 'legium': | 684 case 'legium': |
| 692 case 'webdriver': | 685 case 'webdriver': |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar', | 1009 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar', |
| 1017 '$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar', | 1010 '$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar', |
| 1018 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar', | 1011 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar', |
| 1019 '$dartDir/third_party/junit/v4_8_2/junit.jar'], | 1012 '$dartDir/third_party/junit/v4_8_2/junit.jar'], |
| 1020 ':'); // Path separator. | 1013 ':'); // Path separator. |
| 1021 } | 1014 } |
| 1022 } | 1015 } |
| 1023 | 1016 |
| 1024 | 1017 |
| 1025 class TestUtils { | 1018 class TestUtils { |
| 1019 |
| 1020 /** |
| 1021 * Creates a directory using a [relativePath] to an existing |
| 1022 * [base] directory if that [relativePath] does not already exist. |
| 1023 */ |
| 1024 static Directory mkdirRecursive(String base, String relativePath) { |
| 1025 Directory baseDir = new Directory(base); |
| 1026 Expect.isTrue(baseDir.existsSync(), |
| 1027 "Expected ${base} to already exist"); |
| 1028 var tempDir = new Directory(base); |
| 1029 for (String dir in relativePath.split('/')) { |
| 1030 base = "$base/$dir"; |
| 1031 tempDir = new Directory(base); |
| 1032 if (!tempDir.existsSync()) { |
| 1033 tempDir.createSync(); |
| 1034 } |
| 1035 Expect.isTrue(tempDir.existsSync(), "Failed to create ${tempDir.path}"); |
| 1036 } |
| 1037 return tempDir; |
| 1038 } |
| 1039 |
| 1040 /** |
| 1041 * Copy a [source] file to a new place. |
| 1042 * Assumes that the directory for [dest] already exists. |
| 1043 */ |
| 1044 static void copyFile(File source, File dest) { |
| 1045 List contents = source.readAsBytesSync(); |
| 1046 RandomAccessFile handle = dest.openSync(FileMode.WRITE); |
| 1047 handle.writeListSync(contents, 0, contents.length); |
| 1048 handle.closeSync(); |
| 1049 } |
| 1050 |
| 1026 static String executableSuffix(String component) { | 1051 static String executableSuffix(String component) { |
| 1027 if (new Platform().operatingSystem() == 'windows') { | 1052 if (new Platform().operatingSystem() == 'windows') { |
| 1028 if (component != 'frogium' | 1053 if (component != 'frogium' |
| 1029 && component != 'legium' | 1054 && component != 'legium' |
| 1030 && component != 'webdriver') { | 1055 && component != 'webdriver') { |
| 1031 return '.exe'; | 1056 return '.exe'; |
| 1032 } else { | 1057 } else { |
| 1033 return '.bat'; | 1058 return '.bat'; |
| 1034 } | 1059 } |
| 1035 } | 1060 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 * $noCrash tests are expected to be flaky but not crash | 1198 * $noCrash tests are expected to be flaky but not crash |
| 1174 * $pass tests are expected to pass | 1199 * $pass tests are expected to pass |
| 1175 * $failOk tests are expected to fail that we won't fix | 1200 * $failOk tests are expected to fail that we won't fix |
| 1176 * $fail tests are expected to fail that we should fix | 1201 * $fail tests are expected to fail that we should fix |
| 1177 * $crash tests are expected to crash that we should fix | 1202 * $crash tests are expected to crash that we should fix |
| 1178 * $timeout tests are allowed to timeout | 1203 * $timeout tests are allowed to timeout |
| 1179 """; | 1204 """; |
| 1180 print(report); | 1205 print(report); |
| 1181 } | 1206 } |
| 1182 } | 1207 } |
| OLD | NEW |