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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 void enqueueStandardTest(List<Command> baseCommands, | 1011 void enqueueStandardTest(List<Command> baseCommands, |
1012 TestInformation info, | 1012 TestInformation info, |
1013 String testName, | 1013 String testName, |
1014 Set<Expectation> expectations) { | 1014 Set<Expectation> expectations) { |
1015 var commonArguments = commonArgumentsFromFile(info.filePath, | 1015 var commonArguments = commonArgumentsFromFile(info.filePath, |
1016 info.optionsFromFile); | 1016 info.optionsFromFile); |
1017 | 1017 |
1018 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); | 1018 List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); |
1019 assert(!vmOptionsList.isEmpty); | 1019 assert(!vmOptionsList.isEmpty); |
1020 | 1020 |
1021 for (var vmOptions in vmOptionsList) { | 1021 for (var vmOptionsVarient = 0; |
| 1022 vmOptionsVarient < vmOptionsList.length; |
| 1023 vmOptionsVarient++) { |
| 1024 var vmOptions = vmOptionsList[vmOptionsVarient]; |
1022 var allVmOptions = vmOptions; | 1025 var allVmOptions = vmOptions; |
1023 if (!extraVmOptions.isEmpty) { | 1026 if (!extraVmOptions.isEmpty) { |
1024 allVmOptions = new List.from(vmOptions)..addAll(extraVmOptions); | 1027 allVmOptions = new List.from(vmOptions)..addAll(extraVmOptions); |
1025 } | 1028 } |
1026 | 1029 |
1027 var commands = []..addAll(baseCommands); | 1030 var commands = []..addAll(baseCommands); |
1028 commands.addAll(makeCommands(info, allVmOptions, commonArguments)); | 1031 commands.addAll(makeCommands(info, vmOptionsVarient, |
| 1032 allVmOptions, commonArguments)); |
1029 enqueueNewTestCase( | 1033 enqueueNewTestCase( |
1030 new TestCase('$suiteName/$testName', | 1034 new TestCase('$suiteName/$testName', |
1031 commands, | 1035 commands, |
1032 configuration, | 1036 configuration, |
1033 expectations, | 1037 expectations, |
1034 isNegative: isNegative(info), | 1038 isNegative: isNegative(info), |
1035 info: info)); | 1039 info: info)); |
1036 } | 1040 } |
1037 } | 1041 } |
1038 | 1042 |
1039 bool expectCompileError(TestInformation info) { | 1043 bool expectCompileError(TestInformation info) { |
1040 return info.hasCompileError || | 1044 return info.hasCompileError || |
1041 (configuration['checked'] && info.hasCompileErrorIfChecked); | 1045 (configuration['checked'] && info.hasCompileErrorIfChecked); |
1042 } | 1046 } |
1043 | 1047 |
1044 bool isNegative(TestInformation info) { | 1048 bool isNegative(TestInformation info) { |
1045 bool negative = expectCompileError(info) || | 1049 bool negative = expectCompileError(info) || |
1046 (configuration['checked'] && info.isNegativeIfChecked); | 1050 (configuration['checked'] && info.isNegativeIfChecked); |
1047 if (info.hasRuntimeError && hasRuntime) { | 1051 if (info.hasRuntimeError && hasRuntime) { |
1048 negative = true; | 1052 negative = true; |
1049 } | 1053 } |
1050 return negative; | 1054 return negative; |
1051 } | 1055 } |
1052 | 1056 |
1053 List<Command> makeCommands(TestInformation info, var vmOptions, var args) { | 1057 List<Command> makeCommands(TestInformation info, |
| 1058 int vmOptionsVarient, |
| 1059 var vmOptions, |
| 1060 var args) { |
1054 List<Command> commands = <Command>[]; | 1061 List<Command> commands = <Command>[]; |
1055 CompilerConfiguration compilerConfiguration = | 1062 CompilerConfiguration compilerConfiguration = |
1056 new CompilerConfiguration(configuration); | 1063 new CompilerConfiguration(configuration); |
1057 List<String> sharedOptions = info.optionsFromFile['sharedOptions']; | 1064 List<String> sharedOptions = info.optionsFromFile['sharedOptions']; |
1058 | 1065 |
1059 List<String> compileTimeArguments = <String>[]; | 1066 List<String> compileTimeArguments = <String>[]; |
1060 String tempDir; | 1067 String tempDir; |
1061 if (compilerConfiguration.hasCompiler) { | 1068 if (compilerConfiguration.hasCompiler) { |
1062 compileTimeArguments = | 1069 compileTimeArguments = |
1063 compilerConfiguration.computeCompilerArguments(vmOptions, | 1070 compilerConfiguration.computeCompilerArguments(vmOptions, |
1064 sharedOptions, | 1071 sharedOptions, |
1065 args); | 1072 args); |
1066 // Avoid doing this for analyzer. | 1073 // Avoid doing this for analyzer. |
1067 tempDir = createCompilationOutputDirectory(info.filePath); | 1074 var path = info.filePath; |
| 1075 if (vmOptionsVarient != 0) { |
| 1076 // Ensure a unique directory for each test case. |
| 1077 path = path.join(new Path(vmOptionsVarient.toString())); |
| 1078 } |
| 1079 tempDir = createCompilationOutputDirectory(path); |
1068 } | 1080 } |
1069 | 1081 |
1070 CommandArtifact compilationArtifact = | 1082 CommandArtifact compilationArtifact = |
1071 compilerConfiguration.computeCompilationArtifact( | 1083 compilerConfiguration.computeCompilationArtifact( |
1072 buildDir, | 1084 buildDir, |
1073 tempDir, | 1085 tempDir, |
1074 CommandBuilder.instance, | 1086 CommandBuilder.instance, |
1075 compileTimeArguments, | 1087 compileTimeArguments, |
1076 environmentOverrides); | 1088 environmentOverrides); |
1077 commands.addAll(compilationArtifact.commands); | 1089 commands.addAll(compilationArtifact.commands); |
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 for (var key in PATH_REPLACEMENTS.keys) { | 2511 for (var key in PATH_REPLACEMENTS.keys) { |
2500 if (path.startsWith(key)) { | 2512 if (path.startsWith(key)) { |
2501 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2513 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
2502 break; | 2514 break; |
2503 } | 2515 } |
2504 } | 2516 } |
2505 } | 2517 } |
2506 return path; | 2518 return path; |
2507 } | 2519 } |
2508 } | 2520 } |
OLD | NEW |