Skip to content

Commit a11d7a1

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
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 #31585 Change-Id: I51bd2f9345d650b4ff2a98aa1c8365c765e0d013 Reviewed-on: https://dart-review.googlesource.com/28722 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
1 parent 0cad7e3 commit a11d7a1

File tree

4 files changed

+134
-41
lines changed

4 files changed

+134
-41
lines changed

pkg/vm/bin/gen_kernel.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ${_argParser.usage}
3535
''';
3636

3737
const int _badUsageExitCode = 1;
38-
const int _compileTimeErrorExitCode = 250;
38+
const int _compileTimeErrorExitCode = 254;
3939

4040
const _severityCaptions = const <Severity, String>{
4141
Severity.error: 'Error: ',

tools/testing/dart/command_output.dart

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -876,11 +876,35 @@ class VMKernelCompilationCommandOutput extends CompilationCommandOutput {
876876
}
877877

878878
Expectation result(TestCase testCase) {
879-
Expectation result = super.result(testCase);
880-
if (result.canBeOutcomeOf(Expectation.crash)) {
879+
// Handle crashes and timeouts first.
880+
if (hasCrashed) return Expectation.dartkCrash;
881+
if (hasTimedOut) return Expectation.timeout;
882+
if (hasNonUtf8) return Expectation.nonUtf8Error;
883+
884+
// If the frontend had an uncaught exception, then we'll consider this a
885+
// crash.
886+
if (exitCode == VMCommandOutput._uncaughtExceptionExitCode) {
881887
return Expectation.dartkCrash;
882888
}
883-
return result;
889+
890+
// Multitests are handled specially.
891+
if (testCase.expectCompileError) {
892+
if (exitCode == VMCommandOutput._compileErrorExitCode) {
893+
return Expectation.pass;
894+
}
895+
return Expectation.missingCompileTimeError;
896+
}
897+
898+
// The actual outcome depends on the exitCode.
899+
var outcome = Expectation.pass;
900+
if (exitCode == VMCommandOutput._compileErrorExitCode) {
901+
outcome = Expectation.compileTimeError;
902+
} else if (exitCode != 0) {
903+
// This is a general fail, in case we get an unknown nonzero exitcode.
904+
outcome = Expectation.fail;
905+
}
906+
907+
return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative);
884908
}
885909

886910
/// If the compiler was able to produce a Kernel IR file we want to run the

tools/testing/dart/compiler_configuration.dart

Lines changed: 104 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ abstract class CompilerConfiguration {
6767
return new PrecompilerCompilerConfiguration(configuration);
6868

6969
case Compiler.dartk:
70+
if (configuration.architecture == Architecture.simdbc64) {
71+
return new VMKernelCompilerConfiguration(configuration);
72+
}
7073
return new NoneCompilerConfiguration(configuration, useDfe: true);
7174

7275
case Compiler.dartkp:
@@ -132,6 +135,8 @@ abstract class CompilerConfiguration {
132135

133136
/// The "none" compiler.
134137
class NoneCompilerConfiguration extends CompilerConfiguration {
138+
// This boolean is used by the [VMTestSuite] for running cc tests via
139+
// run_vm_tests.
135140
final bool useDfe;
136141

137142
NoneCompilerConfiguration(Configuration configuration, {this.useDfe: false})
@@ -186,6 +191,56 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
186191
}
187192
}
188193

194+
class VMKernelCompilerConfiguration extends CompilerConfiguration
195+
with VMKernelCompilerMixin {
196+
VMKernelCompilerConfiguration(Configuration configuration)
197+
: super._subclass(configuration);
198+
199+
// This boolean is used by the [VMTestSuite] for running cc tests via
200+
// run_vm_tests. We enable it here, so the cc tests continue to use the
201+
// kernel-isolate. All the remaining tests will use a separate compilation
202+
// command (which this class represents).
203+
bool get useDfe => true;
204+
205+
bool get _isAot => false;
206+
207+
CommandArtifact computeCompilationArtifact(String tempDir,
208+
List<String> arguments, Map<String, String> environmentOverrides) {
209+
final commands = <Command>[
210+
computeCompileToKernelCommand(tempDir, arguments, environmentOverrides),
211+
];
212+
return new CommandArtifact(
213+
commands, tempKernelFile(tempDir), 'application/kernel-ir');
214+
}
215+
216+
List<String> computeRuntimeArguments(
217+
RuntimeConfiguration runtimeConfiguration,
218+
TestInformation info,
219+
List<String> vmOptions,
220+
List<String> sharedOptions,
221+
List<String> originalArguments,
222+
CommandArtifact artifact) {
223+
var args = <String>[];
224+
if (_isStrong) {
225+
args.add('--strong');
226+
}
227+
if (_isChecked) {
228+
args.add('--enable_asserts');
229+
args.add('--enable_type_checks');
230+
}
231+
if (_configuration.hotReload) {
232+
args.add('--hot-reload-test-mode');
233+
} else if (_configuration.hotReloadRollback) {
234+
args.add('--hot-reload-rollback-test-mode');
235+
}
236+
237+
return args
238+
..addAll(vmOptions)
239+
..addAll(sharedOptions)
240+
..addAll(_replaceDartFiles(originalArguments, artifact.filename));
241+
}
242+
}
243+
189244
typedef List<String> CompilerArgumentsFunction(
190245
List<String> globalArguments, String previousCompilerOutput);
191246

@@ -548,13 +603,18 @@ class DevKernelCompilerConfiguration extends CompilerConfiguration {
548603
}
549604
}
550605

551-
class PrecompilerCompilerConfiguration extends CompilerConfiguration {
606+
class PrecompilerCompilerConfiguration extends CompilerConfiguration
607+
with VMKernelCompilerMixin {
608+
// This boolean is used by the [VMTestSuite] for running cc tests via
609+
// run_vm_tests.
552610
final bool useDfe;
553611

554612
bool get _isAndroid => _configuration.system == System.android;
555613
bool get _isArm => _configuration.architecture == Architecture.arm;
556614
bool get _isArm64 => _configuration.architecture == Architecture.arm64;
557615

616+
bool get _isAot => true;
617+
558618
PrecompilerCompilerConfiguration(Configuration configuration,
559619
{this.useDfe: false})
560620
: super._subclass(configuration);
@@ -598,35 +658,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration {
598658
commands, '$tempDir', 'application/dart-precompiled');
599659
}
600660

601-
String tempKernelFile(String tempDir) => '$tempDir/out.dill';
602-
603-
Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
604-
Map<String, String> environmentOverrides) {
605-
final genKernel =
606-
Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
607-
608-
final kernelBinariesFolder = _useSdk
609-
? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
610-
: '${_configuration.buildDirectory}';
611-
612-
final vmPlatform = _isStrong
613-
? '$kernelBinariesFolder/vm_platform_strong.dill'
614-
: '$kernelBinariesFolder/vm_platform.dill';
615-
616-
final dillFile = tempKernelFile(tempDir);
617-
final args = [
618-
'--aot',
619-
_isStrong ? '--strong-mode' : '--no-strong-mode',
620-
'--platform=$vmPlatform',
621-
'-o',
622-
dillFile,
623-
];
624-
args.add(arguments.where((name) => name.endsWith('.dart')).single);
625-
626-
return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(),
627-
genKernel, args, environmentOverrides);
628-
}
629-
630661
/// Creates a command to clean up large temporary kernel files.
631662
///
632663
/// Warning: this command removes temporary file and violates tracking of
@@ -879,12 +910,10 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
879910
args.add('--enable_asserts');
880911
args.add('--enable_type_checks');
881912
}
882-
args..addAll(vmOptions)..addAll(sharedOptions)..addAll(originalArguments);
883-
for (var i = 0; i < args.length; i++) {
884-
if (args[i].endsWith(".dart")) {
885-
args[i] = artifact.filename;
886-
}
887-
}
913+
args
914+
..addAll(vmOptions)
915+
..addAll(sharedOptions)
916+
..addAll(_replaceDartFiles(originalArguments, artifact.filename));
888917
return args;
889918
}
890919
}
@@ -968,3 +997,42 @@ class SpecParserCompilerConfiguration extends CompilerConfiguration {
968997
return <String>[];
969998
}
970999
}
1000+
1001+
abstract class VMKernelCompilerMixin {
1002+
Configuration get _configuration;
1003+
bool get _useSdk;
1004+
bool get _isStrong;
1005+
bool get _isAot;
1006+
1007+
List<Uri> bootstrapDependencies();
1008+
1009+
String tempKernelFile(String tempDir) => '$tempDir/out.dill';
1010+
1011+
Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
1012+
Map<String, String> environmentOverrides) {
1013+
final genKernel =
1014+
Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
1015+
1016+
final kernelBinariesFolder = _useSdk
1017+
? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
1018+
: '${_configuration.buildDirectory}';
1019+
1020+
final vmPlatform = _isStrong
1021+
? '$kernelBinariesFolder/vm_platform_strong.dill'
1022+
: '$kernelBinariesFolder/vm_platform.dill';
1023+
1024+
final dillFile = tempKernelFile(tempDir);
1025+
1026+
final args = [
1027+
_isAot ? '--aot' : '--no-aot',
1028+
_isStrong ? '--strong-mode' : '--no-strong-mode',
1029+
'--platform=$vmPlatform',
1030+
'-o',
1031+
dillFile,
1032+
];
1033+
args.add(arguments.where((name) => name.endsWith('.dart')).single);
1034+
1035+
return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(),
1036+
genKernel, args, environmentOverrides);
1037+
}
1038+
}

tools/testing/dart/runtime_configuration.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ class StandaloneDartRuntimeConfiguration extends DartVmRuntimeConfiguration {
225225
String type = artifact.mimeType;
226226
if (script != null &&
227227
type != 'application/dart' &&
228-
type != 'application/dart-snapshot') {
228+
type != 'application/dart-snapshot' &&
229+
type != 'application/kernel-ir') {
229230
throw "Dart VM cannot run files of type '$type'.";
230231
}
231232
String executable = suite.dartVmBinaryFileName;

0 commit comments

Comments
 (0)