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

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

Issue 9466008: Use the component information when the test is being scheduled instead of when it's being created. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 months 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
OLDNEW
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 } 171 }
172 172
173 173
174 class TestInformation { 174 class TestInformation {
175 String filename; 175 String filename;
176 Map optionsFromFile; 176 Map optionsFromFile;
177 bool isNegative; 177 bool isNegative;
178 bool isNegativeIfChecked; 178 bool isNegativeIfChecked;
179 bool hasFatalTypeErrors; 179 bool hasFatalTypeErrors;
180 bool hasRuntimeErrors;
180 181
181 TestInformation(this.filename, this.optionsFromFile, this.isNegative, 182 TestInformation(this.filename, this.optionsFromFile, this.isNegative,
182 this.isNegativeIfChecked, this.hasFatalTypeErrors); 183 this.isNegativeIfChecked, this.hasFatalTypeErrors,
184 this.hasRuntimeErrors);
183 } 185 }
184 186
185 187
186 /** 188 /**
187 * A standard [TestSuite] implementation that searches for tests in a 189 * A standard [TestSuite] implementation that searches for tests in a
188 * directory, and creates [TestCase]s that compile and/or run them. 190 * directory, and creates [TestCase]s that compile and/or run them.
189 */ 191 */
190 class StandardTestSuite implements TestSuite { 192 class StandardTestSuite implements TestSuite {
191 Map configuration; 193 Map configuration;
192 String suiteName; 194 String suiteName;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 329
328 switch (configuration['component']) { 330 switch (configuration['component']) {
329 case 'dartium': 331 case 'dartium':
330 case 'chromium': 332 case 'chromium':
331 case 'frogium': 333 case 'frogium':
332 case 'webdriver': 334 case 'webdriver':
333 enqueueBrowserTest(filename, testName, optionsFromFile, 335 enqueueBrowserTest(filename, testName, optionsFromFile,
334 expectations, isNegative); 336 expectations, isNegative);
335 break; 337 break;
336 default: 338 default:
337 // Only dartc supports fatal type errors. Enable fatal type 339 isNegative = isNegative ||
338 // errors with a flag and treat tests that have fatal type 340 (configuration['checked'] && info.isNegativeIfChecked);
339 // errors as negative. 341 bool enableFatalTypeErrors = false;
340 var enableFatalTypeErrors = 342
341 (info.hasFatalTypeErrors && configuration['component'] == 'dartc'); 343 if (configuration['component'] == 'dartc') {
344 // Only dartc supports fatal type errors. Enable fatal type
345 // errors with a flag and treat tests that have fatal type
346 // errors as negative.
347 // Also, tests that have runtime errors are not negative
348 // tests for dartc because dartc does not execute the test.
349 if (info.hasFatalTypeErrors) {
350 enableFatalTypeErrors = true;
351 isNegative = true;
352 } else if (info.hasRuntimeErrors) {
353 isNegative = false;
354 }
355 }
356
342 var argumentLists = argumentListsFromFile(filename, 357 var argumentLists = argumentListsFromFile(filename,
343 optionsFromFile, 358 optionsFromFile,
344 enableFatalTypeErrors); 359 enableFatalTypeErrors);
345 isNegative = isNegative ||
346 (configuration['checked'] && info.isNegativeIfChecked) ||
347 enableFatalTypeErrors;
348 360
349 for (var args in argumentLists) { 361 for (var args in argumentLists) {
350 doTest(new TestCase('$suiteName/$testName', 362 doTest(new TestCase('$suiteName/$testName',
351 shellPath(), 363 shellPath(),
352 args, 364 args,
353 configuration, 365 configuration,
354 completeHandler, 366 completeHandler,
355 expectations, 367 expectations,
356 isNegative)); 368 isNegative));
357 } 369 }
358 } 370 }
359 } 371 }
360 372
361 Function makeTestCaseCreator(Map optionsFromFile) { 373 Function makeTestCaseCreator(Map optionsFromFile) {
362 return (String filename, 374 return (String filename,
363 bool isNegative, 375 bool isNegative,
364 [bool isNegativeIfChecked = false, 376 [bool isNegativeIfChecked = false,
365 bool hasFatalTypeErrors = false]) { 377 bool hasFatalTypeErrors = false,
378 bool hasRuntimeErrors = false]) {
366 // Cache the test information for each test case. 379 // Cache the test information for each test case.
367 var info = new TestInformation(filename, 380 var info = new TestInformation(filename,
368 optionsFromFile, 381 optionsFromFile,
369 isNegative, 382 isNegative,
370 isNegativeIfChecked, 383 isNegativeIfChecked,
371 hasFatalTypeErrors); 384 hasFatalTypeErrors,
385 hasRuntimeErrors);
372 cachedTests.add(info); 386 cachedTests.add(info);
373 enqueueTestCaseFromTestInformation(info); 387 enqueueTestCaseFromTestInformation(info);
374 }; 388 };
375 } 389 }
376 390
377 void processFile(String filename) { 391 void processFile(String filename) {
378 if (!isTestFile(filename)) return; 392 if (!isTestFile(filename)) return;
379 393
380 // Only run the tests that match the pattern. 394 // Only run the tests that match the pattern.
381 RegExp pattern = configuration['selectors'][suiteName]; 395 RegExp pattern = configuration['selectors'][suiteName];
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 * $noCrash tests are expected to be flaky but not crash 1140 * $noCrash tests are expected to be flaky but not crash
1127 * $pass tests are expected to pass 1141 * $pass tests are expected to pass
1128 * $failOk tests are expected to fail that we won't fix 1142 * $failOk tests are expected to fail that we won't fix
1129 * $fail tests are expected to fail that we should fix 1143 * $fail tests are expected to fail that we should fix
1130 * $crash tests are expected to crash that we should fix 1144 * $crash tests are expected to crash that we should fix
1131 * $timeout tests are allowed to timeout 1145 * $timeout tests are allowed to timeout
1132 """; 1146 """;
1133 print(report); 1147 print(report);
1134 } 1148 }
1135 } 1149 }
OLDNEW
« tools/testing/dart/multitest.dart ('K') | « tools/testing/dart/multitest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698