Chromium Code Reviews| Index: dart/tools/testing/dart/test_suite.dart |
| diff --git a/dart/tools/testing/dart/test_suite.dart b/dart/tools/testing/dart/test_suite.dart |
| index 0c646ad0e213d8df50de07153d37abcbdaa6fbc5..e710812f772b3b75b8c66f2e52f187e71785049f 100644 |
| --- a/dart/tools/testing/dart/test_suite.dart |
| +++ b/dart/tools/testing/dart/test_suite.dart |
| @@ -105,11 +105,7 @@ abstract class TestSuite { |
| /** |
| * The output directory for this suite's configuration. |
| */ |
| - String get buildDir { |
| - var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; |
| - var arch = configuration['arch'].toUpperCase(); |
| - return "${TestUtils.outputDir(configuration)}$mode$arch"; |
| - } |
| + String get buildDir => TestUtils.buildDir(configuration); |
| /** |
| * The path to the compiler for this suite's configuration. Returns `null` if |
| @@ -933,7 +929,8 @@ class StandardTestSuite extends TestSuite { |
| ]; |
| if (runtime == 'drt' && |
| (compiler == 'none' || compiler == 'dart2dart')) { |
| - var dartFlags = ['--ignore-unrecognized-flags']; |
| + // TODO(ahe): DO NOT SUBMIT, DumpRenderTree hangs on package: imports. |
|
ahe
2012/11/16 07:29:09
I have since learned that I should use an environm
|
| + var dartFlags = ['--ignore-unrecognized-flags', '--package-root=$buildDir/packages/']; |
| if (configuration["checked"]) { |
| dartFlags.add('--enable_asserts'); |
| dartFlags.add("--enable_type_checks"); |
| @@ -1096,6 +1093,18 @@ class StandardTestSuite extends TestSuite { |
| List<String> commonArgumentsFromFile(Path filePath, Map optionsFromFile) { |
| List args = TestUtils.standardOptions(configuration); |
| + |
| + String packageRoot = optionsFromFile['packageRoot']; |
| + if (packageRoot == null) { |
| + packageRoot = "$buildDir/packages/"; |
| + } else if (packageRoot == "none") { |
| + // Do not pass --packageRoot option. |
| + packageRoot = null; |
| + } |
| + if (packageRoot != null) { |
| + args.add("--package-root=$packageRoot"); |
| + } |
| + |
| args.addAll(additionalOptions(filePath)); |
| if (configuration['compiler'] == 'dartc') { |
| args.add('--error_format'); |
| @@ -1183,6 +1192,7 @@ class StandardTestSuite extends TestSuite { |
| RegExp testOptionsRegExp = const RegExp(r"// VMOptions=(.*)"); |
| RegExp dartOptionsRegExp = const RegExp(r"// DartOptions=(.*)"); |
| RegExp otherScriptsRegExp = const RegExp(r"// OtherScripts=(.*)"); |
| + RegExp packageRootRegExp = const RegExp(r"// PackageRoot=(.*)"); |
| RegExp multiTestRegExp = const RegExp(r"/// [0-9][0-9]:(.*)"); |
| RegExp multiHtmlTestRegExp = |
| const RegExp(r"useHtmlIndividualConfiguration()"); |
| @@ -1217,6 +1227,7 @@ class StandardTestSuite extends TestSuite { |
| // Find the options in the file. |
| List<List> result = new List<List>(); |
| List<String> dartOptions; |
| + String packageRoot; |
| bool hasCompileError = contents.contains("@compile-error"); |
| bool hasRuntimeError = contents.contains("@runtime-error"); |
| bool isStaticClean = false; |
| @@ -1236,6 +1247,15 @@ class StandardTestSuite extends TestSuite { |
| dartOptions = match[1].split(' ').filter((e) => e != ''); |
| } |
| + matches = packageRootRegExp.allMatches(contents); |
| + for (var match in matches) { |
| + if (packageRoot != null) { |
| + throw new Exception( |
| + 'More than one "// PackageRoot=" line in test $filePath'); |
| + } |
| + packageRoot = match[1]; |
| + } |
| + |
| matches = staticCleanRegExp.allMatches(contents); |
| for (var match in matches) { |
| if (isStaticClean) { |
| @@ -1284,6 +1304,7 @@ class StandardTestSuite extends TestSuite { |
| return { "vmOptions": result, |
| "dartOptions": dartOptions, |
| + "packageRoot": packageRoot, |
| "hasCompileError": hasCompileError, |
| "hasRuntimeError": hasRuntimeError, |
| "isStaticClean" : isStaticClean, |
| @@ -1578,6 +1599,11 @@ class TestUtils { |
| static bool isJsCommandLineRuntime(String runtime) => |
| const ['d8', 'jsshell'].contains(runtime); |
| + static String buildDir(Map configuration) { |
| + var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; |
| + var arch = configuration['arch'].toUpperCase(); |
| + return "${TestUtils.outputDir(configuration)}$mode$arch"; |
| + } |
| } |
| class SummaryReport { |