mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:33:28 +00:00
Add support for running simdbc64 in batch mode
This makes isolate tests fail, since we no longer run from "source" (or rather use the kernel-isolate to to "source -> dill" for us). The special vm/cc suite will continue to be run via the kerne-isolate, so we have the coverage for these (which probably include reload tests). Issue https://github.com/dart-lang/sdk/issues/31585 Change-Id: I51bd2f9345d650b4ff2a98aa1c8365c765e0d013 Reviewed-on: https://dart-review.googlesource.com/28722 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
parent
0cad7e3168
commit
a11d7a1643
|
@ -35,7 +35,7 @@ ${_argParser.usage}
|
|||
''';
|
||||
|
||||
const int _badUsageExitCode = 1;
|
||||
const int _compileTimeErrorExitCode = 250;
|
||||
const int _compileTimeErrorExitCode = 254;
|
||||
|
||||
const _severityCaptions = const <Severity, String>{
|
||||
Severity.error: 'Error: ',
|
||||
|
|
|
@ -876,11 +876,35 @@ class VMKernelCompilationCommandOutput extends CompilationCommandOutput {
|
|||
}
|
||||
|
||||
Expectation result(TestCase testCase) {
|
||||
Expectation result = super.result(testCase);
|
||||
if (result.canBeOutcomeOf(Expectation.crash)) {
|
||||
// Handle crashes and timeouts first.
|
||||
if (hasCrashed) return Expectation.dartkCrash;
|
||||
if (hasTimedOut) return Expectation.timeout;
|
||||
if (hasNonUtf8) return Expectation.nonUtf8Error;
|
||||
|
||||
// If the frontend had an uncaught exception, then we'll consider this a
|
||||
// crash.
|
||||
if (exitCode == VMCommandOutput._uncaughtExceptionExitCode) {
|
||||
return Expectation.dartkCrash;
|
||||
}
|
||||
return result;
|
||||
|
||||
// Multitests are handled specially.
|
||||
if (testCase.expectCompileError) {
|
||||
if (exitCode == VMCommandOutput._compileErrorExitCode) {
|
||||
return Expectation.pass;
|
||||
}
|
||||
return Expectation.missingCompileTimeError;
|
||||
}
|
||||
|
||||
// The actual outcome depends on the exitCode.
|
||||
var outcome = Expectation.pass;
|
||||
if (exitCode == VMCommandOutput._compileErrorExitCode) {
|
||||
outcome = Expectation.compileTimeError;
|
||||
} else if (exitCode != 0) {
|
||||
// This is a general fail, in case we get an unknown nonzero exitcode.
|
||||
outcome = Expectation.fail;
|
||||
}
|
||||
|
||||
return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative);
|
||||
}
|
||||
|
||||
/// If the compiler was able to produce a Kernel IR file we want to run the
|
||||
|
|
|
@ -67,6 +67,9 @@ abstract class CompilerConfiguration {
|
|||
return new PrecompilerCompilerConfiguration(configuration);
|
||||
|
||||
case Compiler.dartk:
|
||||
if (configuration.architecture == Architecture.simdbc64) {
|
||||
return new VMKernelCompilerConfiguration(configuration);
|
||||
}
|
||||
return new NoneCompilerConfiguration(configuration, useDfe: true);
|
||||
|
||||
case Compiler.dartkp:
|
||||
|
@ -132,6 +135,8 @@ abstract class CompilerConfiguration {
|
|||
|
||||
/// The "none" compiler.
|
||||
class NoneCompilerConfiguration extends CompilerConfiguration {
|
||||
// This boolean is used by the [VMTestSuite] for running cc tests via
|
||||
// run_vm_tests.
|
||||
final bool useDfe;
|
||||
|
||||
NoneCompilerConfiguration(Configuration configuration, {this.useDfe: false})
|
||||
|
@ -186,6 +191,56 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
class VMKernelCompilerConfiguration extends CompilerConfiguration
|
||||
with VMKernelCompilerMixin {
|
||||
VMKernelCompilerConfiguration(Configuration configuration)
|
||||
: super._subclass(configuration);
|
||||
|
||||
// This boolean is used by the [VMTestSuite] for running cc tests via
|
||||
// run_vm_tests. We enable it here, so the cc tests continue to use the
|
||||
// kernel-isolate. All the remaining tests will use a separate compilation
|
||||
// command (which this class represents).
|
||||
bool get useDfe => true;
|
||||
|
||||
bool get _isAot => false;
|
||||
|
||||
CommandArtifact computeCompilationArtifact(String tempDir,
|
||||
List<String> arguments, Map<String, String> environmentOverrides) {
|
||||
final commands = <Command>[
|
||||
computeCompileToKernelCommand(tempDir, arguments, environmentOverrides),
|
||||
];
|
||||
return new CommandArtifact(
|
||||
commands, tempKernelFile(tempDir), 'application/kernel-ir');
|
||||
}
|
||||
|
||||
List<String> computeRuntimeArguments(
|
||||
RuntimeConfiguration runtimeConfiguration,
|
||||
TestInformation info,
|
||||
List<String> vmOptions,
|
||||
List<String> sharedOptions,
|
||||
List<String> originalArguments,
|
||||
CommandArtifact artifact) {
|
||||
var args = <String>[];
|
||||
if (_isStrong) {
|
||||
args.add('--strong');
|
||||
}
|
||||
if (_isChecked) {
|
||||
args.add('--enable_asserts');
|
||||
args.add('--enable_type_checks');
|
||||
}
|
||||
if (_configuration.hotReload) {
|
||||
args.add('--hot-reload-test-mode');
|
||||
} else if (_configuration.hotReloadRollback) {
|
||||
args.add('--hot-reload-rollback-test-mode');
|
||||
}
|
||||
|
||||
return args
|
||||
..addAll(vmOptions)
|
||||
..addAll(sharedOptions)
|
||||
..addAll(_replaceDartFiles(originalArguments, artifact.filename));
|
||||
}
|
||||
}
|
||||
|
||||
typedef List<String> CompilerArgumentsFunction(
|
||||
List<String> globalArguments, String previousCompilerOutput);
|
||||
|
||||
|
@ -548,13 +603,18 @@ class DevKernelCompilerConfiguration extends CompilerConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
class PrecompilerCompilerConfiguration extends CompilerConfiguration {
|
||||
class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
||||
with VMKernelCompilerMixin {
|
||||
// This boolean is used by the [VMTestSuite] for running cc tests via
|
||||
// run_vm_tests.
|
||||
final bool useDfe;
|
||||
|
||||
bool get _isAndroid => _configuration.system == System.android;
|
||||
bool get _isArm => _configuration.architecture == Architecture.arm;
|
||||
bool get _isArm64 => _configuration.architecture == Architecture.arm64;
|
||||
|
||||
bool get _isAot => true;
|
||||
|
||||
PrecompilerCompilerConfiguration(Configuration configuration,
|
||||
{this.useDfe: false})
|
||||
: super._subclass(configuration);
|
||||
|
@ -598,35 +658,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
|
|||
commands, '$tempDir', 'application/dart-precompiled');
|
||||
}
|
||||
|
||||
String tempKernelFile(String tempDir) => '$tempDir/out.dill';
|
||||
|
||||
Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
|
||||
Map<String, String> environmentOverrides) {
|
||||
final genKernel =
|
||||
Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
|
||||
|
||||
final kernelBinariesFolder = _useSdk
|
||||
? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
|
||||
: '${_configuration.buildDirectory}';
|
||||
|
||||
final vmPlatform = _isStrong
|
||||
? '$kernelBinariesFolder/vm_platform_strong.dill'
|
||||
: '$kernelBinariesFolder/vm_platform.dill';
|
||||
|
||||
final dillFile = tempKernelFile(tempDir);
|
||||
final args = [
|
||||
'--aot',
|
||||
_isStrong ? '--strong-mode' : '--no-strong-mode',
|
||||
'--platform=$vmPlatform',
|
||||
'-o',
|
||||
dillFile,
|
||||
];
|
||||
args.add(arguments.where((name) => name.endsWith('.dart')).single);
|
||||
|
||||
return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(),
|
||||
genKernel, args, environmentOverrides);
|
||||
}
|
||||
|
||||
/// Creates a command to clean up large temporary kernel files.
|
||||
///
|
||||
/// Warning: this command removes temporary file and violates tracking of
|
||||
|
@ -879,12 +910,10 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
|
|||
args.add('--enable_asserts');
|
||||
args.add('--enable_type_checks');
|
||||
}
|
||||
args..addAll(vmOptions)..addAll(sharedOptions)..addAll(originalArguments);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (args[i].endsWith(".dart")) {
|
||||
args[i] = artifact.filename;
|
||||
}
|
||||
}
|
||||
args
|
||||
..addAll(vmOptions)
|
||||
..addAll(sharedOptions)
|
||||
..addAll(_replaceDartFiles(originalArguments, artifact.filename));
|
||||
return args;
|
||||
}
|
||||
}
|
||||
|
@ -968,3 +997,42 @@ class SpecParserCompilerConfiguration extends CompilerConfiguration {
|
|||
return <String>[];
|
||||
}
|
||||
}
|
||||
|
||||
abstract class VMKernelCompilerMixin {
|
||||
Configuration get _configuration;
|
||||
bool get _useSdk;
|
||||
bool get _isStrong;
|
||||
bool get _isAot;
|
||||
|
||||
List<Uri> bootstrapDependencies();
|
||||
|
||||
String tempKernelFile(String tempDir) => '$tempDir/out.dill';
|
||||
|
||||
Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
|
||||
Map<String, String> environmentOverrides) {
|
||||
final genKernel =
|
||||
Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
|
||||
|
||||
final kernelBinariesFolder = _useSdk
|
||||
? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
|
||||
: '${_configuration.buildDirectory}';
|
||||
|
||||
final vmPlatform = _isStrong
|
||||
? '$kernelBinariesFolder/vm_platform_strong.dill'
|
||||
: '$kernelBinariesFolder/vm_platform.dill';
|
||||
|
||||
final dillFile = tempKernelFile(tempDir);
|
||||
|
||||
final args = [
|
||||
_isAot ? '--aot' : '--no-aot',
|
||||
_isStrong ? '--strong-mode' : '--no-strong-mode',
|
||||
'--platform=$vmPlatform',
|
||||
'-o',
|
||||
dillFile,
|
||||
];
|
||||
args.add(arguments.where((name) => name.endsWith('.dart')).single);
|
||||
|
||||
return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(),
|
||||
genKernel, args, environmentOverrides);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,7 +225,8 @@ class StandaloneDartRuntimeConfiguration extends DartVmRuntimeConfiguration {
|
|||
String type = artifact.mimeType;
|
||||
if (script != null &&
|
||||
type != 'application/dart' &&
|
||||
type != 'application/dart-snapshot') {
|
||||
type != 'application/dart-snapshot' &&
|
||||
type != 'application/kernel-ir') {
|
||||
throw "Dart VM cannot run files of type '$type'.";
|
||||
}
|
||||
String executable = suite.dartVmBinaryFileName;
|
||||
|
|
Loading…
Reference in a new issue