| OLD | NEW |
| 1 // Copyright (c) 2011, 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 #library("test_suite"); | 5 #library("test_suite"); |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("status_file_parser.dart"); | 8 #import("status_file_parser.dart"); |
| 9 #import("test_runner.dart"); | 9 #import("test_runner.dart"); |
| 10 #import("multitest.dart"); | 10 #import("multitest.dart"); |
| 11 | 11 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 new Timer(enqueueCachedTests, 0); | 205 new Timer(enqueueCachedTests, 0); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 // Read test expectations from status files. | 210 // Read test expectations from status files. |
| 211 testExpectations = | 211 testExpectations = |
| 212 new TestExpectations(complexMatching: complexStatusMatching()); | 212 new TestExpectations(complexMatching: complexStatusMatching()); |
| 213 for (var statusFilePath in statusFilePaths) { | 213 for (var statusFilePath in statusFilePaths) { |
| 214 ReadTestExpectationsInto(testExpectations, | 214 ReadTestExpectationsInto(testExpectations, |
| 215 statusFilePath, | 215 '$dartDir/$statusFilePath', |
| 216 configuration, | 216 configuration, |
| 217 statusFileRead); | 217 statusFileRead); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 void processDirectory() { | 221 void processDirectory() { |
| 222 directoryPath = getDirname(directoryPath); | 222 directoryPath = '$dartDir/$directoryPath'; |
| 223 Directory dir = new Directory(directoryPath); | 223 Directory dir = new Directory(directoryPath); |
| 224 dir.errorHandler = (s) { | 224 dir.errorHandler = (s) { |
| 225 throw s; | 225 throw s; |
| 226 }; | 226 }; |
| 227 dir.fileHandler = processFile; | 227 dir.fileHandler = processFile; |
| 228 dir.doneHandler = directoryListingDone; | 228 dir.doneHandler = directoryListingDone; |
| 229 dir.list(recursive: listRecursively()); | 229 dir.list(recursive: listRecursively()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void enqueueTestCaseFromTestInformation(TestInformation info) { | 232 void enqueueTestCaseFromTestInformation(TestInformation info) { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 break; | 460 break; |
| 461 case 'dartium': | 461 case 'dartium': |
| 462 // No compilation phase. | 462 // No compilation phase. |
| 463 compilerExecutable = null; | 463 compilerExecutable = null; |
| 464 compilerArgs = null; | 464 compilerArgs = null; |
| 465 break; | 465 break; |
| 466 default: | 466 default: |
| 467 Expect.fail('unimplemented component $component'); | 467 Expect.fail('unimplemented component $component'); |
| 468 } | 468 } |
| 469 | 469 |
| 470 String executable = getFilename(dumpRenderTreeFilename); | 470 String executable = dumpRenderTreeFilename; |
| 471 List<String> args; | 471 List<String> args; |
| 472 if (component == 'webdriver') { | 472 if (component == 'webdriver') { |
| 473 executable = 'python'; | 473 executable = 'python'; |
| 474 if (new Platform().operatingSystem() == 'windows') { | 474 if (new Platform().operatingSystem() == 'windows') { |
| 475 // For Windows, the first command, must have the Windows | 475 // For Windows, the first command, must have the Windows |
| 476 // slash direction. | 476 // slash direction. |
| 477 // TODO(efortuna): Get rid of this hack when issue 1306 is fixed. | 477 // TODO(efortuna): Get rid of this hack when issue 1306 is fixed. |
| 478 executable = executable.replaceAll('/', '\\'); | 478 executable = executable.replaceAll('/', '\\'); |
| 479 } | 479 } |
| 480 args = ['$dartDir/tools/testing/run_selenium.py', '--out=$htmlPath', | 480 args = ['$dartDir/tools/testing/run_selenium.py', '--out=$htmlPath', |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 String getHtmlName(String filename) { | 583 String getHtmlName(String filename) { |
| 584 return filename.replaceAll('/', '_').replaceAll(':', '_') | 584 return filename.replaceAll('/', '_').replaceAll(':', '_') |
| 585 + configuration['component'] + '.html'; | 585 + configuration['component'] + '.html'; |
| 586 } | 586 } |
| 587 | 587 |
| 588 String get dumpRenderTreeFilename() { | 588 String get dumpRenderTreeFilename() { |
| 589 if (configuration['drt'] != '') { | 589 if (configuration['drt'] != '') { |
| 590 return configuration['drt']; | 590 return configuration['drt']; |
| 591 } | 591 } |
| 592 if (new Platform().operatingSystem() == 'macos') { | 592 if (new Platform().operatingSystem() == 'macos') { |
| 593 return 'client/tests/drt/DumpRenderTree.app/Contents/' + | 593 return '$dartDir/client/tests/drt/DumpRenderTree.app/Contents/' + |
| 594 'MacOS/DumpRenderTree'; | 594 'MacOS/DumpRenderTree'; |
| 595 } | 595 } |
| 596 return 'client/tests/drt/DumpRenderTree'; | 596 return '$dartDir/client/tests/drt/DumpRenderTree'; |
| 597 } | 597 } |
| 598 | 598 |
| 599 void testGeneratorStarted() { | 599 void testGeneratorStarted() { |
| 600 ++activeTestGenerators; | 600 ++activeTestGenerators; |
| 601 } | 601 } |
| 602 | 602 |
| 603 void testGeneratorDone() { | 603 void testGeneratorDone() { |
| 604 --activeTestGenerators; | 604 --activeTestGenerators; |
| 605 if (activeTestGenerators == 0 && listingDone) { | 605 if (activeTestGenerators == 0 && listingDone) { |
| 606 doDone(); | 606 doDone(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 758 |
| 759 List<String> additionalOptions(String filename) { | 759 List<String> additionalOptions(String filename) { |
| 760 filename = new File(filename).fullPathSync().replaceAll('\\', '/'); | 760 filename = new File(filename).fullPathSync().replaceAll('\\', '/'); |
| 761 Directory tempDir = createOutputDirectory(filename, 'dartc-test'); | 761 Directory tempDir = createOutputDirectory(filename, 'dartc-test'); |
| 762 return | 762 return |
| 763 [ '--fatal-warnings', '--fatal-type-errors', | 763 [ '--fatal-warnings', '--fatal-type-errors', |
| 764 '-check-only', '-out', tempDir.path]; | 764 '-check-only', '-out', tempDir.path]; |
| 765 } | 765 } |
| 766 | 766 |
| 767 void processDirectory() { | 767 void processDirectory() { |
| 768 directoryPath = getDirname(directoryPath); | 768 directoryPath = '$dartDir/$directoryPath'; |
| 769 // Enqueueing the directory listers is an activity. | 769 // Enqueueing the directory listers is an activity. |
| 770 activityStarted(); | 770 activityStarted(); |
| 771 for (String testDir in _testDirs) { | 771 for (String testDir in _testDirs) { |
| 772 Directory dir = new Directory("$directoryPath/$testDir"); | 772 Directory dir = new Directory("$directoryPath/$testDir"); |
| 773 if (dir.existsSync()) { | 773 if (dir.existsSync()) { |
| 774 activityStarted(); | 774 activityStarted(); |
| 775 dir.errorHandler = (s) { | 775 dir.errorHandler = (s) { |
| 776 throw s; | 776 throw s; |
| 777 }; | 777 }; |
| 778 dir.fileHandler = processFile; | 778 dir.fileHandler = processFile; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 829 |
| 830 buildDir = TestUtils.buildDir(configuration); | 830 buildDir = TestUtils.buildDir(configuration); |
| 831 computeClassPath(); | 831 computeClassPath(); |
| 832 testClasses = <String>[]; | 832 testClasses = <String>[]; |
| 833 // Do not read the status file. | 833 // Do not read the status file. |
| 834 // All exclusions are hardcoded in this script, as they are in testcfg.py. | 834 // All exclusions are hardcoded in this script, as they are in testcfg.py. |
| 835 processDirectory(); | 835 processDirectory(); |
| 836 } | 836 } |
| 837 | 837 |
| 838 void processDirectory() { | 838 void processDirectory() { |
| 839 directoryPath = getDirname(directoryPath); | 839 directoryPath = '$dartDir/$directoryPath'; |
| 840 Directory dir = new Directory(directoryPath); | 840 Directory dir = new Directory(directoryPath); |
| 841 | 841 |
| 842 dir.errorHandler = (s) { | 842 dir.errorHandler = (s) { |
| 843 throw s; | 843 throw s; |
| 844 }; | 844 }; |
| 845 dir.fileHandler = processFile; | 845 dir.fileHandler = processFile; |
| 846 dir.doneHandler = createTest; | 846 dir.doneHandler = createTest; |
| 847 dir.list(recursive: true); | 847 dir.list(recursive: true); |
| 848 } | 848 } |
| 849 | 849 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 } | 981 } |
| 982 | 982 |
| 983 static String buildDir(Map configuration) { | 983 static String buildDir(Map configuration) { |
| 984 var buildDir = outputDir(configuration); | 984 var buildDir = outputDir(configuration); |
| 985 buildDir += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; | 985 buildDir += (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; |
| 986 buildDir += configuration['arch']; | 986 buildDir += configuration['arch']; |
| 987 return buildDir; | 987 return buildDir; |
| 988 } | 988 } |
| 989 | 989 |
| 990 static String dartDir() { | 990 static String dartDir() { |
| 991 Directory dart; | 991 String scriptPath = new Options().script.replaceAll('\\', '/'); |
| 992 if (new File('tools/testing/dart/test_suite.dart').existsSync()) { | 992 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); |
| 993 return new File('.').fullPathSync().replaceAll('\\', '/'); | 993 return new File('$toolsDir/..').fullPathSync().replaceAll('\\', '/'); |
| 994 } else if (new File('../tools/testing/dart/test_suite.dart').existsSync()) { | |
| 995 return new File('..').fullPathSync().replaceAll('\\', '/'); | |
| 996 } else { | |
| 997 print('Run test.dart from the dart directory or' + | |
| 998 ' an immediate subdirectory only.'); | |
| 999 Expect.fail('Could not find top level dart directory.'); | |
| 1000 } | |
| 1001 } | 994 } |
| 1002 | 995 |
| 1003 static List<String> standardOptions(Map configuration) { | 996 static List<String> standardOptions(Map configuration) { |
| 1004 List args = ["--ignore-unrecognized-flags"]; | 997 List args = ["--ignore-unrecognized-flags"]; |
| 1005 if (configuration["checked"]) { | 998 if (configuration["checked"]) { |
| 1006 args.add('--enable_asserts'); | 999 args.add('--enable_asserts'); |
| 1007 args.add("--enable_type_checks"); | 1000 args.add("--enable_type_checks"); |
| 1008 } | 1001 } |
| 1009 if (configuration["component"] == "leg") { | 1002 if (configuration["component"] == "leg") { |
| 1010 args.add("--enable_leg"); | 1003 args.add("--enable_leg"); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 * $noCrash tests are expected to be flaky but not crash | 1056 * $noCrash tests are expected to be flaky but not crash |
| 1064 * $pass tests are expected to pass | 1057 * $pass tests are expected to pass |
| 1065 * $failOk tests are expected to fail that we won't fix | 1058 * $failOk tests are expected to fail that we won't fix |
| 1066 * $fail tests are expected to fail that we should fix | 1059 * $fail tests are expected to fail that we should fix |
| 1067 * $crash tests are expected to crash that we should fix | 1060 * $crash tests are expected to crash that we should fix |
| 1068 * $timeout tests are allowed to timeout | 1061 * $timeout tests are allowed to timeout |
| 1069 """; | 1062 """; |
| 1070 print(report); | 1063 print(report); |
| 1071 } | 1064 } |
| 1072 } | 1065 } |
| OLD | NEW |