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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 if (index != -1) { | 988 if (index != -1) { |
989 String testRelativePath = | 989 String testRelativePath = |
990 filename.substring(index + 'compiler/javatests/'.length, | 990 filename.substring(index + 'compiler/javatests/'.length, |
991 filename.length - '.java'.length); | 991 filename.length - '.java'.length); |
992 String testClass = testRelativePath.replaceAll('/', '.'); | 992 String testClass = testRelativePath.replaceAll('/', '.'); |
993 testClasses.add(testClass); | 993 testClasses.add(testClass); |
994 } | 994 } |
995 } | 995 } |
996 | 996 |
997 void createTest(successIgnored) { | 997 void createTest(successIgnored) { |
998 String d8 = | 998 var sdkDir = "$buildDir/dart-sdk".trim(); |
999 "$buildDir/d8${TestUtils.executableSuffix(configuration['component'])}"; | |
1000 List<String> args = <String>[ | 999 List<String> args = <String>[ |
1001 '-ea', | 1000 '-ea', |
1002 '-classpath', classPath, | 1001 '-classpath', classPath, |
1003 '-Dcom.google.dart.runner.d8=$d8', | 1002 '-Dcom.google.dart.sdk=$sdkDir', |
1004 '-Dcom.google.dart.corelib.SharedTests.test_py=' + | 1003 '-Dcom.google.dart.corelib.SharedTests.test_py=' + |
1005 dartDir + '/tools/test.py', | 1004 dartDir + '/tools/test.py', |
1006 'org.junit.runner.JUnitCore']; | 1005 'org.junit.runner.JUnitCore']; |
1007 args.addAll(testClasses); | 1006 args.addAll(testClasses); |
1008 | 1007 |
1009 doTest(new TestCase(suiteName, | 1008 doTest(new TestCase(suiteName, |
1010 [new Command('java', args)], | 1009 [new Command('java', args)], |
1011 configuration, | 1010 configuration, |
1012 completeHandler, | 1011 completeHandler, |
1013 new Set<String>.from([PASS]))); | 1012 new Set<String>.from([PASS]))); |
1014 doDone(); | 1013 doDone(); |
1015 } | 1014 } |
1016 | 1015 |
1017 void completeHandler(TestCase testCase) { | 1016 void completeHandler(TestCase testCase) { |
1018 } | 1017 } |
1019 | 1018 |
1020 void computeClassPath() { | 1019 void computeClassPath() { |
1021 classPath = Strings.join( | 1020 classPath = Strings.join( |
1022 ['$buildDir/compiler/lib/dartc.jar', | 1021 ['$buildDir/analysis/darta.jar', |
1023 '$buildDir/compiler/lib/corelib.jar', | 1022 '$buildDir/analysis/darta-tests.jar', |
1024 '$buildDir/compiler-tests.jar', | |
1025 '$buildDir/closure_out/compiler.jar', | |
1026 // Third party libraries. | 1023 // Third party libraries. |
1027 '$dartDir/third_party/args4j/2.0.12/args4j-2.0.12.jar', | 1024 '$dartDir/third_party/args4j/2.0.12/args4j-2.0.12.jar', |
1028 '$dartDir/third_party/guava/r09/guava-r09.jar', | 1025 '$dartDir/third_party/guava/r09/guava-r09.jar', |
1029 '$dartDir/third_party/json/r2_20080312/json.jar', | |
1030 '$dartDir/third_party/rhino/1_7R3/js.jar', | |
1031 '$dartDir/third_party/hamcrest/v1_3/hamcrest-core-1.3.0RC2.jar', | 1026 '$dartDir/third_party/hamcrest/v1_3/hamcrest-core-1.3.0RC2.jar', |
1032 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar', | 1027 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar', |
1033 '$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar', | 1028 '$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar' |
1034 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar', | 1029 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar', |
1035 '$dartDir/third_party/junit/v4_8_2/junit.jar'], | 1030 '$dartDir/third_party/junit/v4_8_2/junit.jar'], |
1036 ':'); // Path separator. | 1031 ':'); // Path separator. |
1037 } | 1032 } |
1038 } | 1033 } |
1039 | 1034 |
1040 | 1035 |
1041 class TestUtils { | 1036 class TestUtils { |
1042 /** | 1037 /** |
1043 * Creates a directory using a [relativePath] to an existing | 1038 * Creates a directory using a [relativePath] to an existing |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 } | 1077 } |
1083 return ''; | 1078 return ''; |
1084 } | 1079 } |
1085 | 1080 |
1086 static String executableName(Map configuration) { | 1081 static String executableName(Map configuration) { |
1087 String suffix = executableSuffix(configuration['component']); | 1082 String suffix = executableSuffix(configuration['component']); |
1088 switch (configuration['component']) { | 1083 switch (configuration['component']) { |
1089 case 'vm': | 1084 case 'vm': |
1090 return 'dart$suffix'; | 1085 return 'dart$suffix'; |
1091 case 'dartc': | 1086 case 'dartc': |
1092 return 'compiler/bin/dartc$suffix'; | 1087 return 'analysis/darta$suffix'; |
1093 case 'frog': | 1088 case 'frog': |
1094 case 'dart2js': | 1089 case 'dart2js': |
1095 return 'frog/bin/frog$suffix'; | 1090 return 'frog/bin/frog$suffix'; |
1096 case 'frogsh': | 1091 case 'frogsh': |
1097 return 'frog/bin/frogsh$suffix'; | 1092 return 'frog/bin/frogsh$suffix'; |
1098 default: | 1093 default: |
1099 throw "Unknown executable for: ${configuration['component']}"; | 1094 throw "Unknown executable for: ${configuration['component']}"; |
1100 } | 1095 } |
1101 } | 1096 } |
1102 | 1097 |
1103 static String compilerName(Map configuration) { | 1098 static String compilerName(Map configuration) { |
1104 String suffix = executableSuffix(configuration['component']); | 1099 String suffix = executableSuffix(configuration['component']); |
1105 switch (configuration['component']) { | 1100 switch (configuration['component']) { |
1106 case 'dartc': | 1101 case 'dartc': |
1107 return 'compiler/bin/dartc$suffix'; | 1102 return 'analysis/darta$suffix'; |
1108 case 'frogium': | 1103 case 'frogium': |
1109 case 'legium': | 1104 case 'legium': |
1110 case 'webdriver': | 1105 case 'webdriver': |
1111 return 'frog/bin/frog$suffix'; | 1106 return 'frog/bin/frog$suffix'; |
1112 default: | 1107 default: |
1113 throw "Unknown compiler for: ${configuration['component']}"; | 1108 throw "Unknown compiler for: ${configuration['component']}"; |
1114 } | 1109 } |
1115 } | 1110 } |
1116 | 1111 |
1117 static String dartShellFileName(Map configuration) { | 1112 static String dartShellFileName(Map configuration) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 * $noCrash tests are expected to be flaky but not crash | 1226 * $noCrash tests are expected to be flaky but not crash |
1232 * $pass tests are expected to pass | 1227 * $pass tests are expected to pass |
1233 * $failOk tests are expected to fail that we won't fix | 1228 * $failOk tests are expected to fail that we won't fix |
1234 * $fail tests are expected to fail that we should fix | 1229 * $fail tests are expected to fail that we should fix |
1235 * $crash tests are expected to crash that we should fix | 1230 * $crash tests are expected to crash that we should fix |
1236 * $timeout tests are allowed to timeout | 1231 * $timeout tests are allowed to timeout |
1237 """; | 1232 """; |
1238 print(report); | 1233 print(report); |
1239 } | 1234 } |
1240 } | 1235 } |
OLD | NEW |