Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart |
| index 2b3b1964fc818af18879e5cdbdf57fb1563b55cb..b4007d00ded6b003c0ea62b9cdd515d4fe4e22e8 100644 |
| --- a/tools/testing/dart/test_suite.dart |
| +++ b/tools/testing/dart/test_suite.dart |
| @@ -433,7 +433,8 @@ class StandardTestSuite implements TestSuite { |
| } |
| List<Command> makeCommands(TestInformation info, var args) { |
| - if (configuration['compiler'] == 'dart2js') { |
| + switch (configuration['compiler']) { |
| + case 'dart2js': |
| args = new List.from(args); |
| String tempDir = createOutputDirectory(info.filePath, ''); |
| args.add('--out=$tempDir/out.js'); |
| @@ -443,7 +444,24 @@ class StandardTestSuite implements TestSuite { |
| commands.add(new Command(d8, ['$tempDir/out.js'])); |
| } |
| return commands; |
| - } else { |
| + |
| + case 'dart2dart': |
| + args = new List.from(args); |
| + args.add('--output-type=dart'); |
| + String tempDir = createOutputDirectory(info.filePath, ''); |
| + args.add('--out=$tempDir/out.dart'); |
| + List<Command> commands = <Command>[new Command(shellPath(), args)]; |
| + if (configuration['runtime'] == 'vm') { |
| + // TODO(antonm): support checked. |
| + commands.add(new Command( |
| + TestUtils.vmFileName(configuration), |
| + ['--enable_checked_mode', '$tempDir/out.dart'])); |
| + } else { |
| + throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart'; |
| + } |
| + return commands; |
| + |
| + default: |
| return <Command>[new Command(shellPath(), args)]; |
| } |
| } |
| @@ -639,7 +657,8 @@ class StandardTestSuite implements TestSuite { |
| dumpRenderTreeFilename, |
| '--no-timeout' |
| ]; |
| - if (runtime == 'drt' && compiler == 'none') { |
| + if (runtime == 'drt' && |
| + (compiler == 'none' || compiler == 'dart2dart')) { |
| var dartFlags = ['--ignore-unrecognized-flags']; |
| if (configuration["checked"]) { |
| dartFlags.add('--enable_asserts'); |
| @@ -684,6 +703,10 @@ class StandardTestSuite implements TestSuite { |
| args.add('--out=$outputFile'); |
| args.add(inputFile); |
| break; |
| + case 'dart2dart': |
| + args.add('--output-type=dart --out=$outputFile'); |
|
Bill Hesse
2012/07/24 11:58:59
This should be args.addAll(['--output-type=dart',
Anton Muhin
2012/07/25 11:19:57
Done.
|
| + args.add(inputFile); |
| + break; |
| default: |
| Expect.fail('unimplemented compiler $compiler'); |
| } |
| @@ -731,6 +754,7 @@ class StandardTestSuite implements TestSuite { |
| String get scriptType() { |
| switch (configuration['compiler']) { |
| case 'none': |
| + case 'dart2dart': |
| return 'application/dart'; |
| case 'frog': |
| case 'dart2js': |
| @@ -1233,6 +1257,7 @@ class TestUtils { |
| case 'dartc': |
| return 'analyzer/bin/dart_analyzer$suffix'; |
| case 'dart2js': |
| + case 'dart2dart': |
| var prefix = ''; |
| if (configuration['use_sdk']) { |
| prefix = 'dart-sdk/bin/'; |
| @@ -1255,6 +1280,7 @@ class TestUtils { |
| switch (configuration['compiler']) { |
| case 'dartc': |
| case 'dart2js': |
| + case 'dart2dart': |
| return executableName(configuration); |
| case 'frog': |
| return 'frog/bin/frog$suffix'; |
| @@ -1279,6 +1305,13 @@ class TestUtils { |
| return d8; |
| } |
| + static String vmFileName(Map configuration) { |
| + var suffix = executableSuffix('vm'); |
| + var vm = '${buildDir(configuration)}/dart$suffix'; |
| + ensureExists(vm, configuration); |
| + return vm; |
| + } |
| + |
| static void ensureExists(String filename, Map configuration) { |
| if (!configuration['list'] && !(new File(filename).existsSync())) { |
| throw "Executable '$filename' does not exist"; |
| @@ -1328,7 +1361,8 @@ class TestUtils { |
| args.add('--enable_asserts'); |
| args.add("--enable_type_checks"); |
| } |
| - if (configuration["compiler"] == "dart2js") { |
| + String compiler = configuration["compiler"]; |
| + if (compiler == "dart2js" || compiler == "dart2dart") { |
| args = []; |
| if (configuration["checked"]) { |
| args.add('--enable-checked-mode'); |