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

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

Issue 141713002: Outline of how to factor out compiler and runtime specifics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Martin's comments Created 6 years, 11 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 | « no previous file | dart/tools/testing/dart/runtime_configuration.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/testing/dart/compiler_configuration.dart
diff --git a/dart/tools/testing/dart/compiler_configuration.dart b/dart/tools/testing/dart/compiler_configuration.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a7e6a9fa6987982ea54b6156d70e2453b844caca
--- /dev/null
+++ b/dart/tools/testing/dart/compiler_configuration.dart
@@ -0,0 +1,81 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library compiler_configuration;
+
+abstract class CompilerConfiguration {
+ // TODO(ahe): Remove this constructor and move the switch to
+ // test_options.dart. We probably want to store an instance of
+ // [CompilerConfiguration] in [configuration] there.
+ factory CompilerConfiguration(Map configuration) {
+ String compiler = configuration['compiler'];
+ switch (compiler) {
+ case 'dartanalyzer':
+ case 'dart2analyzer':
+ return new AnalyzerCompilerConfiguration();
+ case 'dart2js':
+ return new Dart2jsCompilerConfiguration();
+ case 'dart2dart':
+ return new Dart2dartCompilerConfiguration();
+ case 'none':
+ return new NoneCompilerConfiguration();
+ default:
+ throw "Unknown compiler '$compiler'";
+ }
+ }
+
+ CompilerConfiguration._subclass();
+
+ /// Return a multiplier used to give tests longer time to run.
+ int computeTimeoutMultiplier({
+ bool isDebug: false,
+ bool isChecked: false,
+ bool isHostChecked: false}) {
+ return 1;
+ }
+}
+
+/// The "none" compiler.
+class NoneCompilerConfiguration extends CompilerConfiguration {
+ NoneCompilerConfiguration()
+ : super._subclass();
+}
+
+/// Common configuration for dart2js-based tools, such as, dart2js and
+/// dart2dart.
+class Dart2xCompilerConfiguration extends CompilerConfiguration {
+ Dart2xCompilerConfiguration()
+ : super._subclass();
+}
+
+/// Configuration for dart2js compiler.
+class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
+ int computeTimeoutMultiplier({
+ bool isDebug: false,
+ bool isChecked: false,
+ bool isHostChecked: false}) {
+ int multiplier = 1;
+ if (isDebug) multiplier *= 4;
+ if (isChecked) multiplier *= 2;
+ if (isHostChecked) multiplier *= 16;
+ return multiplier;
+ }
+}
+
+/// Configuration for dart2dart compiler.
+class Dart2dartCompilerConfiguration extends Dart2xCompilerConfiguration {
+}
+
+/// Common configuration for analyzer-based tools, such as, dartanalyzer.
+class AnalyzerCompilerConfiguration extends CompilerConfiguration {
+ AnalyzerCompilerConfiguration()
+ : super._subclass();
+
+ int computeTimeoutMultiplier({
+ bool isDebug: false,
+ bool isChecked: false,
+ bool isHostChecked: false}) {
+ return 4;
+ }
+}
« no previous file with comments | « no previous file | dart/tools/testing/dart/runtime_configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698