Chromium Code Reviews| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 dartWrapperFilename = testPath; | 478 dartWrapperFilename = testPath; |
| 479 // TODO(whesse): Once test.py is retired, adjust the relative path in | 479 // TODO(whesse): Once test.py is retired, adjust the relative path in |
| 480 // the client/samples/dartcombat test to its css file, remove the | 480 // the client/samples/dartcombat test to its css file, remove the |
| 481 // "../../" from this path, and move this out of the isWebTest guard. | 481 // "../../" from this path, and move this out of the isWebTest guard. |
| 482 // Also remove getHtmlName, and just use test.html. | 482 // Also remove getHtmlName, and just use test.html. |
| 483 // TODO(efortuna): this shortening of htmlFilename is a band-aid until | 483 // TODO(efortuna): this shortening of htmlFilename is a band-aid until |
| 484 // the above TODO gets fixed. Windows cannot have paths that are longer | 484 // the above TODO gets fixed. Windows cannot have paths that are longer |
| 485 // than 260 characters, and without this hack, we were running past the | 485 // than 260 characters, and without this hack, we were running past the |
| 486 // the limit. | 486 // the limit. |
| 487 String htmlFilename = getHtmlName(filename); | 487 String htmlFilename = getHtmlName(filename); |
| 488 while ('${tempDir.path}/../../$htmlFilename'.length >= 260) { | 488 while ('${tempDir.path}/../$htmlFilename'.length >= 260) { |
| 489 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); | 489 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); |
| 490 } | 490 } |
| 491 htmlPath = '${tempDir.path}/../../$htmlFilename'; | 491 htmlPath = '${tempDir.path}/../$htmlFilename'; |
| 492 } | 492 } |
| 493 final String scriptPath = (component == 'dartium') ? | 493 final String scriptPath = (component == 'dartium') ? |
| 494 dartWrapperFilename : compiledDartWrapperFilename; | 494 dartWrapperFilename : compiledDartWrapperFilename; |
| 495 // Create the HTML file for the test. | 495 // Create the HTML file for the test. |
| 496 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); | 496 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); |
| 497 String filePrefix = ''; | 497 String filePrefix = ''; |
| 498 if (new Platform().operatingSystem() == 'windows') { | 498 if (new Platform().operatingSystem() == 'windows') { |
| 499 // Firefox on Windows does not like absolute file path names that start | 499 // Firefox on Windows does not like absolute file path names that start |
| 500 // with 'C:' adding 'file:///' solves the problem. | 500 // with 'C:' adding 'file:///' solves the problem. |
| 501 filePrefix = 'file:///'; | 501 filePrefix = 'file:///'; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 doTest(testCase); | 570 doTest(testCase); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 /** Helper to create a compilation command for a single input file. */ | 574 /** Helper to create a compilation command for a single input file. */ |
| 575 Command _compileCommand(String inputFile, String outputFile, | 575 Command _compileCommand(String inputFile, String outputFile, |
| 576 String component, String dir, var vmOptions) { | 576 String component, String dir, var vmOptions) { |
| 577 String executable = TestUtils.compilerPath(configuration); | 577 String executable = TestUtils.compilerPath(configuration); |
| 578 List<String> args = TestUtils.standardOptions(configuration); | 578 List<String> args = TestUtils.standardOptions(configuration); |
| 579 switch (component) { | 579 switch (component) { |
| 580 // TODO(zundel): Remove chromium now that dartc doesn't generate code? | |
| 580 case 'chromium': | 581 case 'chromium': |
| 581 args.addAll(['--work', dir]); | 582 args.addAll(['--work', dir]); |
| 582 args.addAll(vmOptions); | 583 args.addAll(vmOptions); |
| 583 args.add('--ignore-unrecognized-flags'); | 584 args.add('--ignore-unrecognized-flags'); |
| 584 // TODO(zundel): remove assumption of generated code from dartc | |
| 585 args.add('--out'); | |
| 586 args.add(outputFile); | |
| 587 args.add(inputFile); | 585 args.add(inputFile); |
| 588 // TODO(whesse): Add --fatal-type-errors if needed. | 586 // TODO(whesse): Add --fatal-type-errors if needed. |
| 589 break; | 587 break; |
| 590 case 'frogium': | 588 case 'frogium': |
| 591 case 'legium': | 589 case 'legium': |
| 592 case 'webdriver': | 590 case 'webdriver': |
| 593 String libdir = configuration['froglib']; | 591 String libdir = configuration['froglib']; |
| 594 if (libdir == '') { | 592 if (libdir == '') { |
| 595 libdir = '$dartDir/frog/lib'; | 593 libdir = '$dartDir/frog/lib'; |
| 596 } | 594 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 * of levels down in the checkout as the original path of the web test. | 628 * of levels down in the checkout as the original path of the web test. |
| 631 */ | 629 */ |
| 632 Directory createOutputDirectory(String testPath, String optionsName) { | 630 Directory createOutputDirectory(String testPath, String optionsName) { |
| 633 String testUniqueName = | 631 String testUniqueName = |
| 634 testPath.substring(dartDir.length + 1, testPath.length - 5); | 632 testPath.substring(dartDir.length + 1, testPath.length - 5); |
| 635 testUniqueName = testUniqueName.replaceAll('/', '_'); | 633 testUniqueName = testUniqueName.replaceAll('/', '_'); |
| 636 testUniqueName += '-$optionsName'; | 634 testUniqueName += '-$optionsName'; |
| 637 | 635 |
| 638 // Create '[build dir]/generated_tests/$component/$testUniqueName', | 636 // Create '[build dir]/generated_tests/$component/$testUniqueName', |
| 639 // including any intermediate directories that don't exist. | 637 // including any intermediate directories that don't exist. |
| 640 String debugMode = | 638 var generatedTestPath = ['generated_tests', |
| 641 (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; | |
| 642 var generatedTestPath = [debugMode + configuration["arch"], | |
| 643 'generated_tests', | |
| 644 configuration['component'], | 639 configuration['component'], |
| 645 testUniqueName]; | 640 testUniqueName]; |
| 646 | 641 |
| 647 String tempDirPath = TestUtils.buildDir(configuration); | 642 String tempDirPath = TestUtils.buildDir(configuration); |
| 648 if (requiresCleanTemporaryDirectory) { | 643 if (requiresCleanTemporaryDirectory) { |
| 649 tempDirPath = globalTemporaryDirectory(); | 644 tempDirPath = globalTemporaryDirectory(); |
| 645 String debugMode = | |
| 646 (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; | |
| 647 debugMode + configuration["arch"]; | |
|
Bill Hesse
2012/03/05 16:58:00
I think you mean debugMode += configuration["arch"
| |
| 648 generatedTestPath.insertRange(0, 1, debugMode); | |
| 649 print("generatedTestPath is: ${generatedTestPath}"); | |
| 650 | |
| 650 } | 651 } |
| 651 Directory tempDir = new Directory(tempDirPath); | 652 Directory tempDir = new Directory(tempDirPath); |
| 652 if (!tempDir.existsSync()) { | 653 if (!tempDir.existsSync()) { |
| 653 // Dartium tests can be run with no build step, with no output directory. | 654 // Dartium tests can be run with no build step, with no output directory. |
| 654 // This special case builds the build directory that should be there. | 655 // This special case builds the build directory that should be there. |
| 655 var buildPath = tempDirPath.split('/'); | 656 var buildPath = tempDirPath.split('/'); |
| 656 tempDirPath = buildPath[0]; | 657 tempDirPath = buildPath[0]; |
| 657 if (tempDirPath == '') { | 658 if (tempDirPath == '') { |
| 658 throw new Exception( | 659 throw new Exception( |
| 659 'Non-relative path to build directory in test_suite.dart'); | 660 'Non-relative path to build directory in test_suite.dart'); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1218 * $noCrash tests are expected to be flaky but not crash | 1219 * $noCrash tests are expected to be flaky but not crash |
| 1219 * $pass tests are expected to pass | 1220 * $pass tests are expected to pass |
| 1220 * $failOk tests are expected to fail that we won't fix | 1221 * $failOk tests are expected to fail that we won't fix |
| 1221 * $fail tests are expected to fail that we should fix | 1222 * $fail tests are expected to fail that we should fix |
| 1222 * $crash tests are expected to crash that we should fix | 1223 * $crash tests are expected to crash that we should fix |
| 1223 * $timeout tests are allowed to timeout | 1224 * $timeout tests are allowed to timeout |
| 1224 """; | 1225 """; |
| 1225 print(report); | 1226 print(report); |
| 1226 } | 1227 } |
| 1227 } | 1228 } |
| OLD | NEW |