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

Unified Diff: tools/testing/dart/test_runner.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 | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index bc6be6491449219ff5f13c0576efd72a2ab3e535..d836242fcb99901dc861b274cceef8498e3f1861 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -139,7 +139,7 @@ class ProcessCommand extends Command {
(io.Platform.operatingSystem == 'windows')
? env.write('set $key=${escapeCommandLineArgument(value)} & ')
: env.write('$key=${escapeCommandLineArgument(value)} '));
- var command = ([executable]..addAll(arguments))
+ var command = ([executable]..addAll(batchArguments)..addAll(arguments))
.map(escapeCommandLineArgument)
.join(' ');
if (workingDirectory != null) {
@@ -149,6 +149,11 @@ class ProcessCommand extends Command {
}
Future<bool> get outputIsUpToDate => new Future.value(false);
+
+ /// Arguments that are passed to the process when starting batch mode.
+ ///
+ /// In non-batch mode, they should be passed before [arguments].
+ List<String> get batchArguments => const [];
}
class CompilationCommand extends ProcessCommand {
@@ -362,6 +367,35 @@ class VmCommand extends ProcessCommand {
: super._("vm", executable, arguments, environmentOverrides);
}
+class VmBatchCommand extends ProcessCommand implements VmCommand {
+ final String dartFile;
+ final bool checked;
+
+ VmBatchCommand._(String executable, String dartFile, List<String> arguments,
+ Map<String, String> environmentOverrides, {this.checked: true})
+ : this.dartFile = dartFile,
+ super._('vm-batch', executable, arguments, environmentOverrides);
+
+ @override
+ List<String> get batchArguments => checked
+ ? ['--checked', dartFile]
+ : [dartFile];
+
+ @override
+ bool _equal(VmBatchCommand other) {
+ return super._equal(other) &&
+ dartFile == other.dartFile &&
+ checked == other.checked;
+ }
+
+ @override
+ void _buildHashCode(HashCodeBuilder builder) {
+ super._buildHashCode(builder);
+ builder.addJson(dartFile);
+ builder.addJson(checked);
+ }
+}
+
class AdbPrecompilationCommand extends Command {
final String precompiledRunnerFilename;
final String processTestFilename;
@@ -701,6 +735,15 @@ class CommandBuilder {
return _getUniqueCommand(command);
}
+ VmBatchCommand getVmBatchCommand(String executable, String tester,
+ List<String> arguments, Map<String, String> environmentOverrides,
+ {bool checked: true}) {
+ var command =
+ new VmBatchCommand._(executable, tester, arguments, environmentOverrides,
+ checked: checked);
+ return _getUniqueCommand(command);
+ }
+
AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner,
String processTest,
String testDirectory,
@@ -848,7 +891,7 @@ class TestCase extends UniqueObject {
bool get expectCompileError => _expectations & EXPECT_COMPILE_ERROR != 0;
bool get unexpectedOutput {
- var outcome = lastCommandOutput.result(this);
+ var outcome = this.result;
return !expectedOutcomes.any((expectation) {
return outcome.canBeOutcomeOf(expectation);
});
@@ -2181,7 +2224,7 @@ class BatchRunnerProcess {
_startProcess(callback) {
assert(_command is ProcessCommand);
var executable = _command.executable;
- var arguments = ['--batch'];
+ var arguments = []..addAll(_command.batchArguments)..add('--batch');
var environment = new Map.from(io.Platform.environment);
if (_processEnvironmentOverrides != null) {
for (var key in _processEnvironmentOverrides.keys) {
@@ -2642,6 +2685,10 @@ class CommandExecutorImpl implements CommandExecutor {
adbDevicePool.releaseDevice(device);
});
});
+ } else if (command is VmBatchCommand) {
+ var name = command.displayName;
+ return _getBatchRunner(command.displayName + command.dartFile)
+ .runCommand(name, command, timeout, command.arguments);
} else {
return new RunningProcess(command, timeout).run();
}
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698