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

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

Issue 2549793002: Add 'self_check' runtime for running self-checking unit tests (Closed)
Patch Set: Address comments Created 4 years 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 | « pkg/kernel/test/verify_self_check.dart ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/runtime_configuration.dart
diff --git a/tools/testing/dart/runtime_configuration.dart b/tools/testing/dart/runtime_configuration.dart
index 33b83e982e3369914da23cb4229c133c42975b3c..d3747eac06b1479d34cd6ec5755b591e7f39ecac 100644
--- a/tools/testing/dart/runtime_configuration.dart
+++ b/tools/testing/dart/runtime_configuration.dart
@@ -4,14 +4,22 @@
library runtime_configuration;
+import 'dart:io' show Directory, File;
+
import 'compiler_configuration.dart' show CommandArtifact;
// TODO(ahe): Remove this import, we can precompute all the values required
// from TestSuite once the refactoring is complete.
-import 'test_suite.dart' show TestSuite;
+import 'test_suite.dart' show TestSuite, TestUtils;
import 'test_runner.dart' show Command, CommandBuilder;
+/// Describes the commands to run a given test case or its compiled output.
+///
+/// A single runtime configuration object exists per test suite, and is thus
+/// shared between multiple test cases, it should not be mutated after
+/// construction.
+//
// TODO(ahe): I expect this class will become abstract very soon.
class RuntimeConfiguration {
// TODO(ahe): Remove this constructor and move the switch to
@@ -59,6 +67,9 @@ class RuntimeConfiguration {
case 'drt':
return new DrtRuntimeConfiguration();
+ case 'self_check':
+ return new SelfCheckRuntimeConfiguration();
+
default:
throw "Unknown runtime '$runtime'";
}
@@ -82,6 +93,8 @@ class RuntimeConfiguration {
}
List<String> dart2jsPreambles(Uri preambleDir) => [];
+
+ bool get shouldSkipNegativeTests => false;
}
/// The 'none' runtime configuration.
@@ -287,6 +300,40 @@ class DartPrecompiledAdbRuntimeConfiguration
}
}
+class SelfCheckRuntimeConfiguration extends DartVmRuntimeConfiguration {
+ final List<String> selfCheckers = <String>[];
+
+ SelfCheckRuntimeConfiguration() {
+ searchForSelfCheckers();
+ }
+
+ void searchForSelfCheckers() {
+ Uri pkg = TestUtils.dartDirUri.resolve('pkg');
+ for (var entry in new Directory.fromUri(pkg).listSync(recursive: true)) {
+ if (entry is File && entry.path.endsWith('_self_check.dart')) {
+ selfCheckers.add(entry.path);
+ }
+ }
+ }
+
+ List<Command> computeRuntimeCommands(
+ TestSuite suite,
+ CommandBuilder commandBuilder,
+ CommandArtifact artifact,
+ List<String> arguments,
+ Map<String, String> environmentOverrides) {
+ String executable = suite.dartVmBinaryFileName;
+ return selfCheckers
+ .map((String tester) => commandBuilder.getVmBatchCommand(
+ executable, tester, arguments, environmentOverrides,
+ checked: suite.configuration['checked']))
+ .toList();
+ }
+
+ @override
+ bool get shouldSkipNegativeTests => true;
+}
+
/// Temporary runtime configuration for browser runtimes that haven't been
/// migrated yet.
// TODO(ahe): Remove this class.
« no previous file with comments | « pkg/kernel/test/verify_self_check.dart ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698