mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:00:09 +00:00
[test_runner] Extend rr support to cover dart2js, ddc, dart2wasm and AppJIT compilation.
Allows stress testing the VM with `test.py -c dart2js,ddc,dart2wasm -r none --rr`. Change-Id: I328e6e6757378a6915e6c8b2fa67d99ecfcdb9bf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321742 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
c1256bec01
commit
77903114d5
|
@ -692,7 +692,7 @@ class RRCommand extends Command {
|
|||
late io.Directory savedDir;
|
||||
|
||||
RRCommand(this.originalCommand)
|
||||
: super._("rr", index: originalCommand.index) {
|
||||
: super._(originalCommand.displayName, index: originalCommand.index) {
|
||||
final suffix = "/rr-trace-${originalCommand.hashCode}";
|
||||
recordingDir = io.Directory(io.Directory.systemTemp.path + suffix);
|
||||
savedDir = io.Directory("out$suffix");
|
||||
|
@ -703,10 +703,15 @@ class RRCommand extends Command {
|
|||
"--output-trace-dir=${recordingDir.path}",
|
||||
];
|
||||
arguments.add(originalCommand.executable);
|
||||
arguments.addAll(originalCommand.nonBatchArguments);
|
||||
arguments.addAll(originalCommand.arguments);
|
||||
wrappedCommand = VMCommand(
|
||||
executable, arguments, originalCommand.environmentOverrides,
|
||||
index: originalCommand.index);
|
||||
wrappedCommand = ProcessCommand(
|
||||
originalCommand.displayName,
|
||||
executable,
|
||||
arguments,
|
||||
originalCommand.environmentOverrides,
|
||||
originalCommand.workingDirectory,
|
||||
originalCommand.index);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -732,12 +737,47 @@ class RRCommand extends Command {
|
|||
.writeAsString(wrappedCommand.reproductionCommand);
|
||||
await io.File("${savedDir.path}/stdout.txt").writeAsBytes(output.stdout);
|
||||
await io.File("${savedDir.path}/stderr.txt").writeAsBytes(output.stderr);
|
||||
} else {
|
||||
} else if (await recordingDir.exists()) {
|
||||
await recordingDir.delete(recursive: true);
|
||||
}
|
||||
|
||||
return VMCommandOutput(this, output.exitCode, output.hasTimedOut,
|
||||
output.stdout, output.stderr, output.time, output.pid);
|
||||
final compilationSkipped = false;
|
||||
switch (displayName) {
|
||||
case 'app_jit':
|
||||
case 'precompiler':
|
||||
case 'vm':
|
||||
return VMCommandOutput(this, output.exitCode, output.hasTimedOut,
|
||||
output.stdout, output.stderr, output.time, output.pid);
|
||||
case 'dart2wasm':
|
||||
return Dart2WasmCompilerCommandOutput(
|
||||
this,
|
||||
output.exitCode,
|
||||
output.hasTimedOut,
|
||||
output.stdout,
|
||||
output.stderr,
|
||||
output.time,
|
||||
compilationSkipped);
|
||||
case 'dart2js':
|
||||
return Dart2jsCompilerCommandOutput(
|
||||
this,
|
||||
output.exitCode,
|
||||
output.hasTimedOut,
|
||||
output.stdout,
|
||||
output.stderr,
|
||||
output.time,
|
||||
compilationSkipped);
|
||||
case 'ddc':
|
||||
return DevCompilerCommandOutput(
|
||||
this,
|
||||
output.exitCode,
|
||||
output.hasTimedOut,
|
||||
output.stdout,
|
||||
output.stderr,
|
||||
output.time,
|
||||
compilationSkipped,
|
||||
output.pid);
|
||||
}
|
||||
throw "Don't know how to interpret output for $displayName";
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -422,9 +422,18 @@ class Dart2jsCompilerConfiguration extends CompilerConfiguration {
|
|||
arguments = arguments.toList();
|
||||
arguments.add('--out=$outputFileName');
|
||||
|
||||
return Dart2jsCompilationCommand(outputFileName, bootstrapDependencies(),
|
||||
computeCompilerPath(), arguments, environmentOverrides,
|
||||
useSdk: _useSdk, alwaysCompile: !_useSdk);
|
||||
var command = Dart2jsCompilationCommand(
|
||||
outputFileName,
|
||||
bootstrapDependencies(),
|
||||
computeCompilerPath(),
|
||||
arguments,
|
||||
environmentOverrides,
|
||||
useSdk: _useSdk,
|
||||
alwaysCompile: !_useSdk);
|
||||
if (_configuration.rr) {
|
||||
return RRCommand(command);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -556,7 +565,7 @@ class Dart2WasmCompilerConfiguration extends CompilerConfiguration {
|
|||
arguments = arguments.toList();
|
||||
arguments.add(outputFileName);
|
||||
|
||||
return CompilationCommand(
|
||||
var command = CompilationCommand(
|
||||
'dart2wasm',
|
||||
outputFileName,
|
||||
bootstrapDependencies(),
|
||||
|
@ -564,6 +573,10 @@ class Dart2WasmCompilerConfiguration extends CompilerConfiguration {
|
|||
arguments,
|
||||
environmentOverrides,
|
||||
alwaysCompile: !_useSdk);
|
||||
if (_configuration.rr) {
|
||||
return RRCommand(command);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -714,9 +727,13 @@ class DevCompilerConfiguration extends CompilerConfiguration {
|
|||
var compilerPath = _useSdk
|
||||
? '${_configuration.buildDirectory}/dart-sdk/bin/snapshots/dartdevc.dart.snapshot'
|
||||
: Repository.uri.resolve('pkg/dev_compiler/bin/dartdevc.dart').path;
|
||||
return DevCompilerCompilationCommand(outputFile, bootstrapDependencies(),
|
||||
computeCompilerPath(), args, environment,
|
||||
var command = DevCompilerCompilationCommand(outputFile,
|
||||
bootstrapDependencies(), computeCompilerPath(), args, environment,
|
||||
compilerPath: compilerPath, alwaysCompile: false);
|
||||
if (_configuration.rr) {
|
||||
return RRCommand(command);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1191,6 +1208,7 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
|
|||
var multiplier = 1;
|
||||
if (_isDebug) multiplier *= 2;
|
||||
if (_enableAsserts) multiplier *= 2;
|
||||
if (_configuration.rr) multiplier *= 2;
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
|
@ -1219,9 +1237,13 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
|
|||
arguments.insertAll(0, config.arguments);
|
||||
executable = config.executable;
|
||||
}
|
||||
return CompilationCommand('app_jit', tempDir, bootstrapDependencies(),
|
||||
executable, arguments, environmentOverrides,
|
||||
var command = CompilationCommand('app_jit', tempDir,
|
||||
bootstrapDependencies(), executable, arguments, environmentOverrides,
|
||||
alwaysCompile: !_useSdk);
|
||||
if (_configuration.rr) {
|
||||
return RRCommand(command);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in a new issue