Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: tools/testing/dart/test_suite.dart

Issue 10809069: dart2dart compiler support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | utils/tests/pub/pub.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b82812c98d5a2f37ba1af86a88f76e2c9b4626d6 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -51,6 +51,10 @@ interface TestSuite {
}
+// TODO(1030): remove once in the corelib.
+bool Contains(element, collection) => collection.indexOf(element) >= 0;
+
+
class CCTestListerIsolate extends Isolate {
CCTestListerIsolate() : super.heavy();
@@ -433,7 +437,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 +448,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 +661,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');
@@ -681,6 +704,8 @@ class StandardTestSuite implements TestSuite {
args.add(inputFile);
break;
case 'dart2js':
+ case 'dart2dart':
+ if (compiler == 'dart2dart') args.add('--out=$outputFile');
args.add('--out=$outputFile');
args.add(inputFile);
break;
@@ -731,6 +756,7 @@ class StandardTestSuite implements TestSuite {
String get scriptType() {
switch (configuration['compiler']) {
case 'none':
+ case 'dart2dart':
return 'application/dart';
case 'frog':
case 'dart2js':
@@ -1233,6 +1259,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 +1282,7 @@ class TestUtils {
switch (configuration['compiler']) {
case 'dartc':
case 'dart2js':
+ case 'dart2dart':
return executableName(configuration);
case 'frog':
return 'frog/bin/frog$suffix';
@@ -1279,6 +1307,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,12 +1363,13 @@ 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');
}
- args.add("--verbose");
+ // args.add("--verbose");
if (!isBrowserRuntime(configuration['runtime'])) {
args.add("--allow-mock-compilation");
}
@@ -1341,14 +1377,15 @@ class TestUtils {
return args;
}
- static bool isBrowserRuntime(String runtime) =>
+ static bool isBrowserRuntime(String runtime) => Contains(
+ runtime,
const <String>['drt',
'dartium',
'ie',
'safari',
'opera',
'chrome',
- 'ff'].indexOf(runtime) != -1;
+ 'ff']);
}
class SummaryReport {
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | utils/tests/pub/pub.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698