Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 8773036: Make multi tests work with DartC. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #library("test_suite"); 5 #library("test_suite");
6 6
7 #import("status_file_parser.dart"); 7 #import("status_file_parser.dart");
8 #import("test_runner.dart"); 8 #import("test_runner.dart");
9 #import("multitest.dart"); 9 #import("multitest.dart");
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 // Only run the tests that match the pattern. 181 // Only run the tests that match the pattern.
182 RegExp pattern = configuration['selectors'][suiteName]; 182 RegExp pattern = configuration['selectors'][suiteName];
183 if (!pattern.hasMatch(filename)) return; 183 if (!pattern.hasMatch(filename)) return;
184 184
185 var timeout = configuration['timeout']; 185 var timeout = configuration['timeout'];
186 var optionsFromFile = optionsFromFile(filename); 186 var optionsFromFile = optionsFromFile(filename);
187 187
188 Function createTestCase(String filename, 188 Function createTestCase(String filename,
189 bool isNegative, 189 bool isNegative,
190 [bool isNegativeIfChecked = false]) { 190 [bool isNegativeIfChecked = false,
191 bool enableFatalTypeErrors = false]) {
191 // Look up expectations in status files using a modified file path. 192 // Look up expectations in status files using a modified file path.
192 String pathSeparator = new Platform().pathSeparator(); 193 String pathSeparator = new Platform().pathSeparator();
193 String testName; 194 String testName;
194 int start = filename.lastIndexOf('src' + pathSeparator); 195 int start = filename.lastIndexOf('src' + pathSeparator);
195 if (start != -1) { 196 if (start != -1) {
196 testName = filename.substring(start + 4, filename.length - 5); 197 testName = filename.substring(start + 4, filename.length - 5);
197 } else { 198 } else {
198 // Only multitests in a temporary directory should reach here. 199 // Only multitests in a temporary directory should reach here.
199 start = filename.lastIndexOf(pathSeparator); 200 start = filename.lastIndexOf(pathSeparator);
200 int middle = filename.lastIndexOf('_'); 201 int middle = filename.lastIndexOf('_');
201 testName = filename.substring(start + 1, middle) + pathSeparator + 202 testName = filename.substring(start + 1, middle) + pathSeparator +
202 filename.substring(middle + 1, filename.length - 5); 203 filename.substring(middle + 1, filename.length - 5);
203 } 204 }
204 Set<String> expectations = testExpectations.expectations(testName); 205 Set<String> expectations = testExpectations.expectations(testName);
205 206
206 if (expectations.contains(SKIP)) return; 207 if (expectations.contains(SKIP)) return;
207 208
208 isNegative = isNegative || 209 isNegative = isNegative ||
209 (configuration['checked'] && isNegativeIfChecked); 210 (configuration['checked'] && isNegativeIfChecked);
210 var argumentLists = argumentListsFromFile(filename, optionsFromFile); 211 var argumentLists = argumentListsFromFile(filename,
212 optionsFromFile,
213 enableFatalTypeErrors);
211 for (var args in argumentLists) { 214 for (var args in argumentLists) {
212 doTest(new TestCase(testName, 215 doTest(new TestCase(testName,
213 shellPath, 216 shellPath,
214 args, 217 args,
215 timeout, 218 timeout,
216 completeHandler, 219 completeHandler,
217 expectations, 220 expectations,
218 isNegative)); 221 isNegative));
219 } 222 }
220 } 223 }
221 224
222
223 if (optionsFromFile['isMultitest']) { 225 if (optionsFromFile['isMultitest']) {
226 bool supportsFatalTypeErrors = (configuration['component'] == 'dartc');
224 ++activeMultitests; 227 ++activeMultitests;
225 DoMultitest(filename, 228 DoMultitest(filename,
226 TestUtils.buildDir(configuration), 229 TestUtils.buildDir(configuration),
227 directoryPath, 230 directoryPath,
231 supportsFatalTypeErrors,
228 createTestCase, 232 createTestCase,
229 multitestDone); 233 multitestDone);
230 } else { 234 } else {
231 createTestCase(filename, optionsFromFile['isNegative']); 235 createTestCase(filename, optionsFromFile['isNegative']);
232 } 236 }
233 } 237 }
234 238
235 void multitestDone() { 239 void multitestDone() {
236 --activeMultitests; 240 --activeMultitests;
237 if (activeMultitests == 0 && listingDone) { 241 if (activeMultitests == 0 && listingDone) {
238 doDone(); 242 doDone();
239 } 243 }
240 } 244 }
241 245
242 void directoryListingDone(ignore) { 246 void directoryListingDone(ignore) {
243 listingDone = true; 247 listingDone = true;
244 if (activeMultitests == 0) { 248 if (activeMultitests == 0) {
245 doDone(); 249 doDone();
246 } 250 }
247 } 251 }
248 252
249 void completeHandler(TestCase testCase) { 253 void completeHandler(TestCase testCase) {
250 } 254 }
251 255
252 List<List<String>> argumentListsFromFile(String filename, 256 List<List<String>> argumentListsFromFile(String filename,
253 Map optionsFromFile) { 257 Map optionsFromFile,
258 bool enableFatalTypeErrors) {
254 List args = TestUtils.standardOptions(configuration); 259 List args = TestUtils.standardOptions(configuration);
255 args.addAll(additionalOptions()); 260 args.addAll(additionalOptions());
261 if (enableFatalTypeErrors) args.add('--fatal-type-errors');
256 262
257 bool isMultitest = optionsFromFile["isMultitest"]; 263 bool isMultitest = optionsFromFile["isMultitest"];
258 List<String> dartOptions = optionsFromFile["dartOptions"]; 264 List<String> dartOptions = optionsFromFile["dartOptions"];
259 List<List<String>> vmOptionsList = optionsFromFile["vmOptions"]; 265 List<List<String>> vmOptionsList = optionsFromFile["vmOptions"];
260 Expect.isTrue(!isMultitest || dartOptions == null); 266 Expect.isTrue(!isMultitest || dartOptions == null);
261 if (dartOptions == null) { 267 if (dartOptions == null) {
262 args.add(filename); 268 args.add(filename);
263 } else { 269 } else {
264 var filename = dartOptions[0]; 270 var filename = dartOptions[0];
265 // TODO(ager): Get rid of this hack when the runtime checkout goes away. 271 // TODO(ager): Get rid of this hack when the runtime checkout goes away.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 args.add("--enable_leg"); 399 args.add("--enable_leg");
394 } 400 }
395 if (configuration["component"] == "dartc") { 401 if (configuration["component"] == "dartc") {
396 if (configuration["mode"] == "release") { 402 if (configuration["mode"] == "release") {
397 args.add("--optimize"); 403 args.add("--optimize");
398 } 404 }
399 } 405 }
400 return args; 406 return args;
401 } 407 }
402 } 408 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698