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

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

Issue 10919098: Run dart2js tests unmodified in browser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 3 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 | « dart/tests/compiler/dart2js_native/dart2js_native.status ('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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 Set<String> expectations = testExpectations.expectations(testName); 388 Set<String> expectations = testExpectations.expectations(testName);
389 if (configuration['report']) { 389 if (configuration['report']) {
390 // Tests with multiple VMOptions are counted more than once. 390 // Tests with multiple VMOptions are counted more than once.
391 for (var dummy in getVmOptions(optionsFromFile)) { 391 for (var dummy in getVmOptions(optionsFromFile)) {
392 SummaryReport.add(expectations); 392 SummaryReport.add(expectations);
393 } 393 }
394 } 394 }
395 if (expectations.contains(SKIP)) return; 395 if (expectations.contains(SKIP)) return;
396 396
397 if (TestUtils.isBrowserRuntime(configuration['runtime'])) { 397 if (TestUtils.isBrowserRuntime(configuration['runtime'])) {
398 enqueueBrowserTest(info, testName, expectations); 398 enqueueBrowserTest(info, testName, expectations,
399 configuration['compiler'] != 'dart2js');
399 } else { 400 } else {
400 enqueueStandardTest(info, testName, expectations); 401 enqueueStandardTest(info, testName, expectations);
401 } 402 }
402 } 403 }
403 404
404 void enqueueStandardTest(TestInformation info, 405 void enqueueStandardTest(TestInformation info,
405 String testName, 406 String testName,
406 Set<String> expectations) { 407 Set<String> expectations) {
407 bool isNegative = info.isNegative || 408 bool isNegative = info.isNegative ||
408 (configuration['checked'] && info.isNegativeIfChecked); 409 (configuration['checked'] && info.isNegativeIfChecked);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 suiteDir, 523 suiteDir,
523 createTestCase, 524 createTestCase,
524 testGeneratorDone); 525 testGeneratorDone);
525 } else { 526 } else {
526 createTestCase(filePath, optionsFromFile['isNegative']); 527 createTestCase(filePath, optionsFromFile['isNegative']);
527 } 528 }
528 } 529 }
529 530
530 /** 531 /**
531 * The [StandardTestSuite] has support for tests that 532 * The [StandardTestSuite] has support for tests that
532 * compile a test from Dart to Javascript, and then run the resulting 533 * compile a test from Dart to JavaScript, and then run the resulting
533 * Javascript. This function creates a working directory to hold the 534 * JavaScript. This function creates a working directory to hold the
534 * Javascript version of the test, and copies the appropriate framework 535 * JavaScript version of the test, and copies the appropriate framework
535 * files to that directory. It creates a [BrowserTestCase], which has 536 * files to that directory. It creates a [BrowserTestCase], which has
536 * two sequential steps to be run by the [ProcessQueue when] the test is 537 * two sequential steps to be run by the [ProcessQueue] when the test is
537 * executed: a compilation 538 * executed: a compilation
538 * step and an execution step, both with the appropriate executable and 539 * step and an execution step, both with the appropriate executable and
539 * arguments. 540 * arguments.
540 */ 541 */
541 void enqueueBrowserTest(TestInformation info, 542 void enqueueBrowserTest(TestInformation info,
542 String testName, 543 String testName,
543 Set<String> expectations) { 544 Set<String> expectations,
545 bool isWrappingRequired) {
544 Map optionsFromFile = info.optionsFromFile; 546 Map optionsFromFile = info.optionsFromFile;
545 Path filePath = info.filePath; 547 Path filePath = info.filePath;
546 String filename = filePath.toString(); 548 String filename = filePath.toString();
547 bool isWebTest = optionsFromFile['containsDomImport']; 549 bool isWebTest = optionsFromFile['containsDomImport'];
548 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; 550 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition'];
549 if (!isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { 551 if (isWrappingRequired
552 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) {
550 print('Warning for $filename: Browser tests require #library ' 553 print('Warning for $filename: Browser tests require #library '
551 'in any file that uses #import, #source, or #resource'); 554 'in any file that uses #import, #source, or #resource');
552 } 555 }
553 556
554 final String compiler = configuration['compiler']; 557 final String compiler = configuration['compiler'];
555 final String runtime = configuration['runtime']; 558 final String runtime = configuration['runtime'];
556 559
557 for (var vmOptions in getVmOptions(optionsFromFile)) { 560 for (var vmOptions in getVmOptions(optionsFromFile)) {
558 // Create a unique temporary directory for each set of vmOptions. 561 // Create a unique temporary directory for each set of vmOptions.
559 // TODO(dart:429): Replace separate replaceAlls with a RegExp when 562 // TODO(dart:429): Replace separate replaceAlls with a RegExp when
560 // replaceAll(RegExp, String) is implemented. 563 // replaceAll(RegExp, String) is implemented.
561 String optionsName = ''; 564 String optionsName = '';
562 if (getVmOptions(optionsFromFile).length > 1) { 565 if (getVmOptions(optionsFromFile).length > 1) {
563 optionsName = Strings.join(vmOptions, '-').replaceAll('-','') 566 optionsName = Strings.join(vmOptions, '-').replaceAll('-','')
564 .replaceAll('=','') 567 .replaceAll('=','')
565 .replaceAll('/',''); 568 .replaceAll('/','');
566 } 569 }
567 final String tempDir = createOutputDirectory(info.filePath, optionsName); 570 final String tempDir = createOutputDirectory(info.filePath, optionsName);
568 571
569 String dartWrapperFilename = '$tempDir/test.dart'; 572 String dartWrapperFilename = '$tempDir/test.dart';
570 String compiledDartWrapperFilename = '$tempDir/test.js'; 573 String compiledDartWrapperFilename = '$tempDir/test.js';
571 574
572 String htmlPath = '$tempDir/test.html'; 575 String htmlPath = '$tempDir/test.html';
573 if (!isWebTest) { 576 if (isWrappingRequired && !isWebTest) {
574 // test.dart will import the dart test directly, if it is a library, 577 // test.dart will import the dart test directly, if it is a library,
575 // or indirectly through test_as_library.dart, if it is not. 578 // or indirectly through test_as_library.dart, if it is not.
576 Path dartLibraryFilename = filePath; 579 Path dartLibraryFilename = filePath;
577 if (!isLibraryDefinition) { 580 if (!isLibraryDefinition) {
578 dartLibraryFilename = new Path('test_as_library.dart'); 581 dartLibraryFilename = new Path('test_as_library.dart');
579 File file = new File('$tempDir/$dartLibraryFilename'); 582 File file = new File('$tempDir/$dartLibraryFilename');
580 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); 583 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE);
581 dartLibrary.writeStringSync(wrapDartTestInLibrary(filePath)); 584 dartLibrary.writeStringSync(wrapDartTestInLibrary(filePath));
582 dartLibrary.closeSync(); 585 dartLibrary.closeSync();
583 } 586 }
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 * $noCrash tests are expected to be flaky but not crash 1416 * $noCrash tests are expected to be flaky but not crash
1414 * $pass tests are expected to pass 1417 * $pass tests are expected to pass
1415 * $failOk tests are expected to fail that we won't fix 1418 * $failOk tests are expected to fail that we won't fix
1416 * $fail tests are expected to fail that we should fix 1419 * $fail tests are expected to fail that we should fix
1417 * $crash tests are expected to crash that we should fix 1420 * $crash tests are expected to crash that we should fix
1418 * $timeout tests are allowed to timeout 1421 * $timeout tests are allowed to timeout
1419 """; 1422 """;
1420 print(report); 1423 print(report);
1421 } 1424 }
1422 } 1425 }
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js_native/dart2js_native.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698