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

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

Issue 15963011: Use run_vm_tests.host to list VM tests if possible (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
« no previous file with comments | « tools/test.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) 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 /** 297 /**
298 * A specialized [TestSuite] that runs tests written in C to unit test 298 * A specialized [TestSuite] that runs tests written in C to unit test
299 * the Dart virtual machine and its API. 299 * the Dart virtual machine and its API.
300 * 300 *
301 * The tests are compiled into a monolithic executable by the build step. 301 * The tests are compiled into a monolithic executable by the build step.
302 * The executable lists its tests when run with the --list command line flag. 302 * The executable lists its tests when run with the --list command line flag.
303 * Individual tests are run by specifying them on the command line. 303 * Individual tests are run by specifying them on the command line.
304 */ 304 */
305 class CCTestSuite extends TestSuite { 305 class CCTestSuite extends TestSuite {
306 final String testPrefix; 306 final String testPrefix;
307 String runnerPath; 307 String targetRunnerPath;
308 String hostRunnerPath;
308 final String dartDir; 309 final String dartDir;
309 List<String> statusFilePaths; 310 List<String> statusFilePaths;
310 TestCaseEvent doTest; 311 TestCaseEvent doTest;
311 VoidFunction doDone; 312 VoidFunction doDone;
312 ReceivePort receiveTestName; 313 ReceivePort receiveTestName;
313 TestExpectations testExpectations; 314 TestExpectations testExpectations;
314 315
315 CCTestSuite(Map configuration, 316 CCTestSuite(Map configuration,
316 String suiteName, 317 String suiteName,
317 String runnerName, 318 String runnerName,
318 List<String> this.statusFilePaths, 319 List<String> this.statusFilePaths,
319 {this.testPrefix: ''}) 320 {this.testPrefix: ''})
320 : super(configuration, suiteName), 321 : super(configuration, suiteName),
321 dartDir = TestUtils.dartDir().toNativePath() { 322 dartDir = TestUtils.dartDir().toNativePath() {
322 runnerPath = '$buildDir/$runnerName'; 323 // For running the tests we use the given '$runnerName' binary
324 targetRunnerPath = '$buildDir/$runnerName';
325
326 // For listing the tests we use the '$runnerName.host' binary if it exists
327 // and use '$runnerName' if it doesn't.
328 var binarySuffix = Platform.operatingSystem == 'windows' ? '.exe' : '';
329 var hostBinary = '$targetRunnerPath.host$binarySuffix';
330 if (new File(hostBinary).existsSync()) {
331 hostRunnerPath = hostBinary;
332 } else {
333 hostRunnerPath = targetRunnerPath;
334 }
323 } 335 }
324 336
325 void testNameHandler(String testName, ignore) { 337 void testNameHandler(String testName, ignore) {
326 if (testName == "") { 338 if (testName == "") {
327 receiveTestName.close(); 339 receiveTestName.close();
328 340
329 if (doDone != null) doDone(); 341 if (doDone != null) doDone();
330 } else { 342 } else {
331 // Only run the tests that match the pattern. Use the name 343 // Only run the tests that match the pattern. Use the name
332 // "suiteName/testName" for cc tests. 344 // "suiteName/testName" for cc tests.
333 RegExp pattern = configuration['selectors'][suiteName]; 345 RegExp pattern = configuration['selectors'][suiteName];
334 String constructedName = '$suiteName/$testPrefix$testName'; 346 String constructedName = '$suiteName/$testPrefix$testName';
335 if (!pattern.hasMatch(constructedName)) return; 347 if (!pattern.hasMatch(constructedName)) return;
336 348
337 var expectations = testExpectations.expectations( 349 var expectations = testExpectations.expectations(
338 '$testPrefix$testName'); 350 '$testPrefix$testName');
339 351
340 if (configuration["report"]) { 352 if (configuration["report"]) {
341 SummaryReport.add(expectations); 353 SummaryReport.add(expectations);
342 } 354 }
343 355
344 if (expectations.contains(SKIP)) return; 356 if (expectations.contains(SKIP)) return;
345 357
346 var args = TestUtils.standardOptions(configuration); 358 var args = TestUtils.standardOptions(configuration);
347 args.add(testName); 359 args.add(testName);
348 360
349 doTest(new TestCase(constructedName, 361 doTest(new TestCase(constructedName,
350 [new Command(runnerPath, args)], 362 [new Command(targetRunnerPath, args)],
351 configuration, 363 configuration,
352 completeHandler, 364 completeHandler,
353 expectations)); 365 expectations));
354 } 366 }
355 } 367 }
356 368
357 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { 369 void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) {
358 doTest = onTest; 370 doTest = onTest;
359 doDone = onDone; 371 doDone = onDone;
360 372
361 var filesRead = 0; 373 var filesRead = 0;
362 void statusFileRead() { 374 void statusFileRead() {
363 filesRead++; 375 filesRead++;
364 if (filesRead == statusFilePaths.length) { 376 if (filesRead == statusFilePaths.length) {
365 receiveTestName = new ReceivePort(); 377 receiveTestName = new ReceivePort();
366 var port = spawnFunction(ccTestLister); 378 var port = spawnFunction(ccTestLister);
367 port.send(runnerPath, receiveTestName.toSendPort()); 379 port.send(hostRunnerPath, receiveTestName.toSendPort());
368 receiveTestName.receive(testNameHandler); 380 receiveTestName.receive(testNameHandler);
369 } 381 }
370 } 382 }
371 383
372 testExpectations = new TestExpectations(); 384 testExpectations = new TestExpectations();
373 for (var statusFilePath in statusFilePaths) { 385 for (var statusFilePath in statusFilePaths) {
374 ReadTestExpectationsInto(testExpectations, 386 ReadTestExpectationsInto(testExpectations,
375 '$dartDir/$statusFilePath', 387 '$dartDir/$statusFilePath',
376 configuration, 388 configuration,
377 statusFileRead); 389 statusFileRead);
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 * $pass tests are expected to pass 1942 * $pass tests are expected to pass
1931 * $failOk tests are expected to fail that we won't fix 1943 * $failOk tests are expected to fail that we won't fix
1932 * $fail tests are expected to fail that we should fix 1944 * $fail tests are expected to fail that we should fix
1933 * $crash tests are expected to crash that we should fix 1945 * $crash tests are expected to crash that we should fix
1934 * $timeout tests are allowed to timeout 1946 * $timeout tests are allowed to timeout
1935 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1947 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1936 """; 1948 """;
1937 print(report); 1949 print(report);
1938 } 1950 }
1939 } 1951 }
OLDNEW
« no previous file with comments | « tools/test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698