| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 Function doDone; | 106 Function doDone; |
| 107 ReceivePort receiveTestName; | 107 ReceivePort receiveTestName; |
| 108 TestExpectations testExpectations; | 108 TestExpectations testExpectations; |
| 109 | 109 |
| 110 CCTestSuite(Map this.configuration, | 110 CCTestSuite(Map this.configuration, |
| 111 String this.suiteName, | 111 String this.suiteName, |
| 112 String runnerName, | 112 String runnerName, |
| 113 List<String> this.statusFilePaths, | 113 List<String> this.statusFilePaths, |
| 114 [this.testPrefix = '']) | 114 [this.testPrefix = '']) |
| 115 : dartDir = TestUtils.dartDir() { | 115 : dartDir = TestUtils.dartDir() { |
| 116 runnerPath = TestUtils.buildDir(configuration) + '/' + runnerName; | 116 runnerPath = '${TestUtils.buildDir(configuration)}/$runnerName'; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void testNameHandler(String testName, ignore) { | 119 void testNameHandler(String testName, ignore) { |
| 120 if (testName == "") { | 120 if (testName == "") { |
| 121 receiveTestName.close(); | 121 receiveTestName.close(); |
| 122 doDone(true); | 122 doDone(true); |
| 123 } else { | 123 } else { |
| 124 // Only run the tests that match the pattern. Use the name | 124 // Only run the tests that match the pattern. Use the name |
| 125 // "suiteName/testName" for cc tests. | 125 // "suiteName/testName" for cc tests. |
| 126 RegExp pattern = configuration['selectors'][suiteName]; | 126 RegExp pattern = configuration['selectors'][suiteName]; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // See if there's a 'src' directory inside the 'tests' one. | 360 // See if there's a 'src' directory inside the 'tests' one. |
| 361 int testsStart = filename.lastIndexOf('tests/'); | 361 int testsStart = filename.lastIndexOf('tests/'); |
| 362 int start = filename.lastIndexOf('src/'); | 362 int start = filename.lastIndexOf('src/'); |
| 363 if (start > testsStart) { | 363 if (start > testsStart) { |
| 364 // TODO(sigmund): delete this branch once all tests stop using the src/ | 364 // TODO(sigmund): delete this branch once all tests stop using the src/ |
| 365 // directory | 365 // directory |
| 366 testName = filename.substring(start + 4, filename.length - 5); | 366 testName = filename.substring(start + 4, filename.length - 5); |
| 367 } else if (optionsFromFile['isMultitest']) { | 367 } else if (optionsFromFile['isMultitest']) { |
| 368 start = filename.lastIndexOf('/'); | 368 start = filename.lastIndexOf('/'); |
| 369 int middle = filename.lastIndexOf('_'); | 369 int middle = filename.lastIndexOf('_'); |
| 370 testName = filename.substring(start + 1, middle) + '/' + | 370 var multitestBase = filename.substring(start + 1, middle); |
| 371 filename.substring(middle + 1, filename.length - 5); | 371 var multitestKey = filename.substring(middle + 1, filename.length - 5); |
| 372 testName = '$multitestBase/$multitestKey'; |
| 372 } else { | 373 } else { |
| 373 // This branch is hit in two cases: standard test suites created with | 374 // This branch is hit in two cases: standard test suites created with |
| 374 // forDirectory and dartc code compilation tests. | 375 // forDirectory and dartc code compilation tests. |
| 375 | 376 |
| 376 // Dartc compilation tests are pretty broken compared to the | 377 // Dartc compilation tests are pretty broken compared to the |
| 377 // rest. They use the .dart suffix in the status files. They | 378 // rest. They use the .dart suffix in the status files. They |
| 378 // find tests in weird ways (testing that they contain "#"). | 379 // find tests in weird ways (testing that they contain "#"). |
| 379 // They need to be redone. | 380 // They need to be redone. |
| 380 // TODO(1058): This does not work on Windows. | 381 // TODO(1058): This does not work on Windows. |
| 381 start = filename.indexOf(directoryPath); | 382 start = filename.indexOf(directoryPath); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 isNegative, | 449 isNegative, |
| 449 info)); | 450 info)); |
| 450 } | 451 } |
| 451 } | 452 } |
| 452 | 453 |
| 453 List<Command> makeCommands(TestInformation info, var args) { | 454 List<Command> makeCommands(TestInformation info, var args) { |
| 454 if (configuration['compiler'] == 'dart2js') { | 455 if (configuration['compiler'] == 'dart2js') { |
| 455 args = new List.from(args); | 456 args = new List.from(args); |
| 456 String testPath = | 457 String testPath = |
| 457 new File(info.filename).fullPathSync().replaceAll('\\', '/'); | 458 new File(info.filename).fullPathSync().replaceAll('\\', '/'); |
| 458 Directory tempDir = createOutputDirectory(testPath, ''); | 459 String tempDir = createOutputDirectory(testPath, ''); |
| 459 args.add('--out=${tempDir.path}/out.js'); | 460 args.add('--out=$tempDir/out.js'); |
| 460 List<Command> commands = <Command>[new Command(shellPath(), args)]; | 461 List<Command> commands = <Command>[new Command(shellPath(), args)]; |
| 461 if (configuration['runtime'] == 'd8') { | 462 if (configuration['runtime'] == 'd8') { |
| 462 var d8 = TestUtils.d8FileName(configuration); | 463 var d8 = TestUtils.d8FileName(configuration); |
| 463 commands.add(new Command(d8, ['${tempDir.path}/out.js'])); | 464 commands.add(new Command(d8, ['$tempDir/out.js'])); |
| 464 } | 465 } |
| 465 return commands; | 466 return commands; |
| 466 } else { | 467 } else { |
| 467 return <Command>[new Command(shellPath(), args)]; | 468 return <Command>[new Command(shellPath(), args)]; |
| 468 } | 469 } |
| 469 } | 470 } |
| 470 | 471 |
| 471 Function makeTestCaseCreator(Map optionsFromFile) { | 472 Function makeTestCaseCreator(Map optionsFromFile) { |
| 472 return (String filename, | 473 return (String filename, |
| 473 bool isNegative, | 474 bool isNegative, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 */ | 525 */ |
| 525 void enqueueBrowserTest(TestInformation info, | 526 void enqueueBrowserTest(TestInformation info, |
| 526 String testName, | 527 String testName, |
| 527 Set<String> expectations) { | 528 Set<String> expectations) { |
| 528 Map optionsFromFile = info.optionsFromFile; | 529 Map optionsFromFile = info.optionsFromFile; |
| 529 String filename = info.filename; | 530 String filename = info.filename; |
| 530 if (optionsFromFile['isMultitest']) return; | 531 if (optionsFromFile['isMultitest']) return; |
| 531 bool isWebTest = optionsFromFile['containsDomImport']; | 532 bool isWebTest = optionsFromFile['containsDomImport']; |
| 532 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; | 533 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; |
| 533 if (!isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { | 534 if (!isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { |
| 534 print('Warning for $filename: Browser tests require #library ' + | 535 print('Warning for $filename: Browser tests require #library ' |
| 535 'in any file that uses #import, #source, or #resource'); | 536 'in any file that uses #import, #source, or #resource'); |
| 536 } | 537 } |
| 537 | 538 |
| 538 final String compiler = configuration['compiler']; | 539 final String compiler = configuration['compiler']; |
| 539 final String runtime = configuration['runtime']; | 540 final String runtime = configuration['runtime']; |
| 540 final String testPath = | 541 final String testPath = |
| 541 new File(filename).fullPathSync().replaceAll('\\', '/'); | 542 new File(filename).fullPathSync().replaceAll('\\', '/'); |
| 542 | 543 |
| 543 for (var vmOptions in getVmOptions(optionsFromFile)) { | 544 for (var vmOptions in getVmOptions(optionsFromFile)) { |
| 544 // Create a unique temporary directory for each set of vmOptions. | 545 // Create a unique temporary directory for each set of vmOptions. |
| 545 // TODO(dart:429): Replace separate replaceAlls with a RegExp when | 546 // TODO(dart:429): Replace separate replaceAlls with a RegExp when |
| 546 // replaceAll(RegExp, String) is implemented. | 547 // replaceAll(RegExp, String) is implemented. |
| 547 String optionsName = ''; | 548 String optionsName = ''; |
| 548 if (getVmOptions(optionsFromFile).length > 1) { | 549 if (getVmOptions(optionsFromFile).length > 1) { |
| 549 optionsName = Strings.join(vmOptions, '-').replaceAll('-','') | 550 optionsName = Strings.join(vmOptions, '-').replaceAll('-','') |
| 550 .replaceAll('=','') | 551 .replaceAll('=','') |
| 551 .replaceAll('/',''); | 552 .replaceAll('/',''); |
| 552 } | 553 } |
| 553 Directory tempDir = createOutputDirectory(testPath, optionsName); | 554 final String tempDir = createOutputDirectory(testPath, optionsName); |
| 554 | 555 |
| 555 String dartWrapperFilename = '${tempDir.path}/test.dart'; | 556 String dartWrapperFilename = '$tempDir/test.dart'; |
| 556 String compiledDartWrapperFilename = '${tempDir.path}/test.js'; | 557 String compiledDartWrapperFilename = '$tempDir/test.js'; |
| 557 | 558 |
| 558 String htmlPath = '${tempDir.path}/test.html'; | 559 String htmlPath = '$tempDir/test.html'; |
| 559 if (!isWebTest) { | 560 if (!isWebTest) { |
| 560 // test.dart will import the dart test directly, if it is a library, | 561 // test.dart will import the dart test directly, if it is a library, |
| 561 // or indirectly through test_as_library.dart, if it is not. | 562 // or indirectly through test_as_library.dart, if it is not. |
| 562 String dartLibraryFilename; | 563 String dartLibraryFilename; |
| 563 if (isLibraryDefinition) { | 564 if (isLibraryDefinition) { |
| 564 dartLibraryFilename = testPath; | 565 dartLibraryFilename = testPath; |
| 565 } else { | 566 } else { |
| 566 dartLibraryFilename = 'test_as_library.dart'; | 567 dartLibraryFilename = 'test_as_library.dart'; |
| 567 File file = new File('${tempDir.path}/$dartLibraryFilename'); | 568 File file = new File('$tempDir/$dartLibraryFilename'); |
| 568 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); | 569 RandomAccessFile dartLibrary = file.openSync(FileMode.WRITE); |
| 569 dartLibrary.writeStringSync(WrapDartTestInLibrary(testPath)); | 570 dartLibrary.writeStringSync(WrapDartTestInLibrary(testPath)); |
| 570 dartLibrary.closeSync(); | 571 dartLibrary.closeSync(); |
| 571 } | 572 } |
| 572 | 573 |
| 573 File file = new File(dartWrapperFilename); | 574 File file = new File(dartWrapperFilename); |
| 574 RandomAccessFile dartWrapper = file.openSync(FileMode.WRITE); | 575 RandomAccessFile dartWrapper = file.openSync(FileMode.WRITE); |
| 575 dartWrapper.writeStringSync( | 576 dartWrapper.writeStringSync( |
| 576 DartTestWrapper(dartDir, dartLibraryFilename)); | 577 DartTestWrapper(dartDir, dartLibraryFilename)); |
| 577 dartWrapper.closeSync(); | 578 dartWrapper.closeSync(); |
| 578 } else { | 579 } else { |
| 579 dartWrapperFilename = testPath; | 580 dartWrapperFilename = testPath; |
| 580 // TODO(whesse): Once test.py is retired, adjust the relative path in | 581 // TODO(whesse): Once test.py is retired, adjust the relative path in |
| 581 // the client/samples/dartcombat test to its css file, remove the | 582 // the client/samples/dartcombat test to its css file, remove the |
| 582 // "../../" from this path, and move this out of the isWebTest guard. | 583 // "../../" from this path, and move this out of the isWebTest guard. |
| 583 // Also remove getHtmlName, and just use test.html. | 584 // Also remove getHtmlName, and just use test.html. |
| 584 // TODO(efortuna): this shortening of htmlFilename is a band-aid until | 585 // TODO(efortuna): this shortening of htmlFilename is a band-aid until |
| 585 // the above TODO gets fixed. Windows cannot have paths that are longer | 586 // the above TODO gets fixed. Windows cannot have paths that are longer |
| 586 // than 260 characters, and without this hack, we were running past the | 587 // than 260 characters, and without this hack, we were running past the |
| 587 // the limit. | 588 // the limit. |
| 588 String htmlFilename = getHtmlName(filename); | 589 String htmlFilename = getHtmlName(filename); |
| 589 while ('${tempDir.path}/../$htmlFilename'.length >= 260) { | 590 while ('$tempDir/../$htmlFilename'.length >= 260) { |
| 590 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); | 591 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); |
| 591 } | 592 } |
| 592 htmlPath = '${tempDir.path}/../$htmlFilename'; | 593 htmlPath = '$tempDir/../$htmlFilename'; |
| 593 } | 594 } |
| 594 final String scriptPath = (compiler == 'none') ? | 595 final String scriptPath = (compiler == 'none') ? |
| 595 dartWrapperFilename : compiledDartWrapperFilename; | 596 dartWrapperFilename : compiledDartWrapperFilename; |
| 596 // Create the HTML file for the test. | 597 // Create the HTML file for the test. |
| 597 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); | 598 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); |
| 598 String filePrefix = ''; | 599 String filePrefix = ''; |
| 599 if (Platform.operatingSystem == 'windows') { | 600 if (Platform.operatingSystem == 'windows') { |
| 600 // Firefox on Windows does not like absolute file path names that start | 601 // Firefox on Windows does not like absolute file path names that start |
| 601 // with 'C:' adding 'file:///' solves the problem. | 602 // with 'C:' adding 'file:///' solves the problem. |
| 602 filePrefix = 'file:///'; | 603 filePrefix = 'file:///'; |
| 603 } | 604 } |
| 604 htmlTest.writeStringSync(GetHtmlContents( | 605 htmlTest.writeStringSync(GetHtmlContents( |
| 605 filename, | 606 filename, |
| 606 '$filePrefix$dartDir/lib/unittest/test_controller.js', | 607 '$filePrefix$dartDir/lib/unittest/test_controller.js', |
| 607 scriptType, | 608 scriptType, |
| 608 filePrefix + scriptPath)); | 609 '$filePrefix$scriptPath')); |
| 609 htmlTest.closeSync(); | 610 htmlTest.closeSync(); |
| 610 | 611 |
| 611 // Construct the command(s) that compile all the inputs needed by the | 612 // Construct the command(s) that compile all the inputs needed by the |
| 612 // browser test. For running Dart in DRT, this will be noop commands. | 613 // browser test. For running Dart in DRT, this will be noop commands. |
| 613 List<Command> commands = []; | 614 List<Command> commands = []; |
| 614 if (compiler != 'none') { | 615 if (compiler != 'none') { |
| 615 commands.add(_compileCommand( | 616 commands.add(_compileCommand( |
| 616 dartWrapperFilename, compiledDartWrapperFilename, | 617 dartWrapperFilename, compiledDartWrapperFilename, |
| 617 compiler, tempDir.path, vmOptions)); | 618 compiler, tempDir, vmOptions)); |
| 618 | 619 |
| 619 // some tests require compiling multiple input scripts. | 620 // some tests require compiling multiple input scripts. |
| 620 List<String> otherScripts = optionsFromFile['otherScripts']; | 621 List<String> otherScripts = optionsFromFile['otherScripts']; |
| 621 for (String name in otherScripts) { | 622 for (String name in otherScripts) { |
| 622 int end = filename.lastIndexOf('/'); | 623 int end = filename.lastIndexOf('/'); |
| 623 if (end == -1) { | 624 if (end == -1) { |
| 624 print('Warning: error processing "OtherScripts" of $filename.'); | 625 print('Warning: error processing "OtherScripts" of $filename.'); |
| 625 print('Skipping test ($testName).'); | 626 print('Skipping test ($testName).'); |
| 626 return; | 627 return; |
| 627 } | 628 } |
| 628 String dir = filename.substring(0, end); | 629 String dir = filename.substring(0, end); |
| 629 end = name.lastIndexOf('.dart'); | 630 end = name.lastIndexOf('.dart'); |
| 630 if (end == -1) { | 631 if (end == -1) { |
| 631 print('Warning: error processing "OtherScripts" in $filename.'); | 632 print('Warning: error processing "OtherScripts" in $filename.'); |
| 632 print('Skipping test ($testName).'); | 633 print('Skipping test ($testName).'); |
| 633 return; | 634 return; |
| 634 } | 635 } |
| 635 String compiledName = '${name.substring(0, end)}.js'; | 636 String compiledName = '${name.substring(0, end)}.js'; |
| 636 commands.add(_compileCommand( | 637 commands.add(_compileCommand( |
| 637 '$dir/$name', '${tempDir.path}/$compiledName', | 638 '$dir/$name', '$tempDir/$compiledName', |
| 638 compiler, tempDir.path, vmOptions)); | 639 compiler, tempDir, vmOptions)); |
| 639 } | 640 } |
| 640 } | 641 } |
| 641 | 642 |
| 642 // Construct the command that executes the browser test | 643 // Construct the command that executes the browser test |
| 643 List<String> args; | 644 List<String> args; |
| 644 if (runtime == 'ie' || runtime == 'ff' || runtime == 'chrome' || | 645 if (runtime == 'ie' || runtime == 'ff' || runtime == 'chrome' || |
| 645 runtime == 'safari' || runtime == 'opera' || runtime == 'dartium') { | 646 runtime == 'safari' || runtime == 'opera' || runtime == 'dartium') { |
| 646 args = ['$dartDir/tools/testing/run_selenium.py', | 647 args = ['$dartDir/tools/testing/run_selenium.py', |
| 647 '--browser=$runtime', | 648 '--browser=$runtime', |
| 648 '--timeout=${configuration["timeout"] - 2}', | 649 '--timeout=${configuration["timeout"] - 2}', |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 * an HTML page, with a testing framework based on scripting and DOM events. | 716 * an HTML page, with a testing framework based on scripting and DOM events. |
| 716 * These scripts and pages are written to a generated_test directory | 717 * These scripts and pages are written to a generated_test directory |
| 717 * inside the build directory of the checkout. | 718 * inside the build directory of the checkout. |
| 718 * | 719 * |
| 719 * Those tests which are already HTML web applications (web tests), with | 720 * Those tests which are already HTML web applications (web tests), with |
| 720 * resources including CSS files and HTML files, need to be compiled into | 721 * resources including CSS files and HTML files, need to be compiled into |
| 721 * a work directory where the relative URLS to the resources work. | 722 * a work directory where the relative URLS to the resources work. |
| 722 * We use a subdirectory of the build directory that is the same number | 723 * We use a subdirectory of the build directory that is the same number |
| 723 * of levels down in the checkout as the original path of the web test. | 724 * of levels down in the checkout as the original path of the web test. |
| 724 */ | 725 */ |
| 725 Directory createOutputDirectory(String testPath, String optionsName) { | 726 String createOutputDirectory(String testPath, String optionsName) { |
| 726 String testUniqueName = | 727 String testUniqueName = |
| 727 testPath.substring(dartDir.length + 1, testPath.length - 5); | 728 testPath.substring(dartDir.length + 1, testPath.length - 5); |
| 728 testUniqueName = testUniqueName.replaceAll('/', '_'); | 729 testUniqueName = testUniqueName.replaceAll('/', '_'); |
| 729 if (!optionsName.isEmpty()) { | 730 if (!optionsName.isEmpty()) { |
| 730 testUniqueName += '-$optionsName'; | 731 testUniqueName = '$testUniqueName-$optionsName'; |
| 731 } | 732 } |
| 732 | 733 |
| 733 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName', | 734 // Create '[build dir]/generated_tests/$compiler-$runtime/$testUniqueName', |
| 734 // including any intermediate directories that don't exist. | 735 // including any intermediate directories that don't exist. |
| 735 var generatedTestPath = ['generated_tests', | 736 var generatedTestPath = Strings.join( |
| 736 configuration['compiler'] + '-' + | 737 [TestUtils.buildDir(configuration), |
| 737 configuration['runtime'], | 738 'generated_tests', |
| 738 testUniqueName]; | 739 "${configuration['compiler']}-${configuration['runtime']}", |
| 740 testUniqueName], '/'); |
| 739 | 741 |
| 740 String tempDirPath = TestUtils.buildDir(configuration); | 742 TestUtils.mkdirRecursive('.', generatedTestPath); |
| 741 Directory tempDir = new Directory(tempDirPath); | 743 return new File(generatedTestPath).fullPathSync().replaceAll('\\', '/'); |
| 742 if (!tempDir.existsSync()) { | |
| 743 // TODO(whesse): Replace this with mkdirRecursive. | |
| 744 // Dartium tests can be run with no build step, with no output directory. | |
| 745 // This special case builds the build directory that should be there. | |
| 746 var buildPath = tempDirPath.split('/'); | |
| 747 tempDirPath = buildPath[0]; | |
| 748 if (tempDirPath == '') { | |
| 749 throw new Exception( | |
| 750 'Non-relative path to build directory in test_suite.dart'); | |
| 751 } | |
| 752 if (buildPath.length > 1) { | |
| 753 buildPath.removeRange(0, 1); | |
| 754 if (buildPath.last() == '') buildPath.removeLast(); | |
| 755 buildPath.addAll(generatedTestPath); | |
| 756 generatedTestPath = buildPath; | |
| 757 } | |
| 758 tempDir = new Directory(tempDirPath); | |
| 759 if (!tempDir.existsSync()) { | |
| 760 tempDir.createSync(); | |
| 761 } | |
| 762 } | |
| 763 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); | |
| 764 return TestUtils.mkdirRecursive(tempDirPath, | |
| 765 Strings.join(generatedTestPath, '/')); | |
| 766 } | 744 } |
| 767 | 745 |
| 768 String get scriptType() { | 746 String get scriptType() { |
| 769 switch (configuration['compiler']) { | 747 switch (configuration['compiler']) { |
| 770 case 'none': | 748 case 'none': |
| 771 return 'application/dart'; | 749 return 'application/dart'; |
| 772 case 'frog': | 750 case 'frog': |
| 773 case 'dart2js': | 751 case 'dart2js': |
| 774 case 'dartc': | 752 case 'dartc': |
| 775 return 'text/javascript'; | 753 return 'text/javascript'; |
| 776 default: | 754 default: |
| 777 Expect.fail('Non-web runtime, so no scriptType for: ' + | 755 Expect.fail('Non-web runtime, so no scriptType for: ' |
| 778 '${configuration["compiler"]}'); | 756 '${configuration["compiler"]}'); |
| 779 return null; | 757 return null; |
| 780 } | 758 } |
| 781 } | 759 } |
| 782 | 760 |
| 783 bool get hasRuntime() { | 761 bool get hasRuntime() { |
| 784 switch(configuration['runtime']) { | 762 switch(configuration['runtime']) { |
| 785 case null: | 763 case null: |
| 786 Expect.fail("configuration['runtime'] is not set"); | 764 Expect.fail("configuration['runtime'] is not set"); |
| 787 case 'none': | 765 case 'none': |
| 788 return false; | 766 return false; |
| 789 default: | 767 default: |
| 790 return true; | 768 return true; |
| 791 } | 769 } |
| 792 } | 770 } |
| 793 | 771 |
| 794 String getHtmlName(String filename) { | 772 String getHtmlName(String filename) { |
| 795 return filename.replaceAll('/', '_').replaceAll(':', '_') | 773 var cleanFilename = filename.replaceAll('/', '_') |
| 796 .replaceAll('\\', '_') + configuration['compiler'] + '-' + | 774 .replaceAll(':', '_') |
| 797 configuration['runtime'] + '.html'; | 775 .replaceAll('\\', '_'); |
| 776 |
| 777 return "$cleanFilename" |
| 778 "${configuration['compiler']}-${configuration['runtime']}.html"; |
| 798 } | 779 } |
| 799 | 780 |
| 800 String get dumpRenderTreeFilename() { | 781 String get dumpRenderTreeFilename() { |
| 801 if (configuration['drt'] != '') { | 782 if (configuration['drt'] != '') { |
| 802 return configuration['drt']; | 783 return configuration['drt']; |
| 803 } | 784 } |
| 804 if (Platform.operatingSystem == 'macos') { | 785 if (Platform.operatingSystem == 'macos') { |
| 805 return '$dartDir/client/tests/drt/DumpRenderTree.app/Contents/' | 786 return '$dartDir/client/tests/drt/DumpRenderTree.app/Contents/' |
| 806 'MacOS/DumpRenderTree'; | 787 'MacOS/DumpRenderTree'; |
| 807 } | 788 } |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 testClasses.add(testClass); | 1097 testClasses.add(testClass); |
| 1117 } | 1098 } |
| 1118 } | 1099 } |
| 1119 | 1100 |
| 1120 void createTest(successIgnored) { | 1101 void createTest(successIgnored) { |
| 1121 var sdkDir = "$buildDir/dart-sdk".trim(); | 1102 var sdkDir = "$buildDir/dart-sdk".trim(); |
| 1122 List<String> args = <String>[ | 1103 List<String> args = <String>[ |
| 1123 '-ea', | 1104 '-ea', |
| 1124 '-classpath', classPath, | 1105 '-classpath', classPath, |
| 1125 '-Dcom.google.dart.sdk=$sdkDir', | 1106 '-Dcom.google.dart.sdk=$sdkDir', |
| 1126 '-Dcom.google.dart.corelib.SharedTests.test_py=' + | 1107 '-Dcom.google.dart.corelib.SharedTests.test_py=$dartDir/tools/test.py', |
| 1127 dartDir + '/tools/test.py', | |
| 1128 'org.junit.runner.JUnitCore']; | 1108 'org.junit.runner.JUnitCore']; |
| 1129 args.addAll(testClasses); | 1109 args.addAll(testClasses); |
| 1130 | 1110 |
| 1131 // Lengthen the timeout for JUnit tests. It is normal for them | 1111 // Lengthen the timeout for JUnit tests. It is normal for them |
| 1132 // to run for a few minutes. | 1112 // to run for a few minutes. |
| 1133 Map updatedConfiguration = new Map(); | 1113 Map updatedConfiguration = new Map(); |
| 1134 configuration.forEach((key, value) { | 1114 configuration.forEach((key, value) { |
| 1135 updatedConfiguration[key] = value; | 1115 updatedConfiguration[key] = value; |
| 1136 }); | 1116 }); |
| 1137 updatedConfiguration['timeout'] *= 2; | 1117 updatedConfiguration['timeout'] *= 2; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 var system = configuration['system']; | 1268 var system = configuration['system']; |
| 1289 if (system == 'linux') { | 1269 if (system == 'linux') { |
| 1290 result = 'out/'; | 1270 result = 'out/'; |
| 1291 } else if (system == 'macos') { | 1271 } else if (system == 'macos') { |
| 1292 result = 'xcodebuild/'; | 1272 result = 'xcodebuild/'; |
| 1293 } | 1273 } |
| 1294 return result; | 1274 return result; |
| 1295 } | 1275 } |
| 1296 | 1276 |
| 1297 static String buildDir(Map configuration) { | 1277 static String buildDir(Map configuration) { |
| 1298 var result = outputDir(configuration); | 1278 String debugMode = |
| 1299 result += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; | 1279 (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; |
| 1300 result += configuration['arch']; | 1280 return "${outputDir(configuration)}$debugMode${configuration['arch']}"; |
| 1301 return result; | 1281 } |
| 1302 } | |
| 1303 | 1282 |
| 1304 static String dartDir() { | 1283 static String dartDir() { |
| 1305 String scriptPath = new Options().script.replaceAll('\\', '/'); | 1284 String scriptPath = new Options().script.replaceAll('\\', '/'); |
| 1306 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); | 1285 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); |
| 1307 return new File('$toolsDir/..').fullPathSync().replaceAll('\\', '/'); | 1286 return new File('$toolsDir/..').fullPathSync().replaceAll('\\', '/'); |
| 1308 } | 1287 } |
| 1309 | 1288 |
| 1310 static List<String> standardOptions(Map configuration) { | 1289 static List<String> standardOptions(Map configuration) { |
| 1311 List args = ["--ignore-unrecognized-flags"]; | 1290 List args = ["--ignore-unrecognized-flags"]; |
| 1312 if (configuration["checked"]) { | 1291 if (configuration["checked"]) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 * $noCrash tests are expected to be flaky but not crash | 1359 * $noCrash tests are expected to be flaky but not crash |
| 1381 * $pass tests are expected to pass | 1360 * $pass tests are expected to pass |
| 1382 * $failOk tests are expected to fail that we won't fix | 1361 * $failOk tests are expected to fail that we won't fix |
| 1383 * $fail tests are expected to fail that we should fix | 1362 * $fail tests are expected to fail that we should fix |
| 1384 * $crash tests are expected to crash that we should fix | 1363 * $crash tests are expected to crash that we should fix |
| 1385 * $timeout tests are allowed to timeout | 1364 * $timeout tests are allowed to timeout |
| 1386 """; | 1365 """; |
| 1387 print(report); | 1366 print(report); |
| 1388 } | 1367 } |
| 1389 } | 1368 } |
| OLD | NEW |