mirror of
https://github.com/dart-lang/sdk
synced 2024-09-30 04:48:37 +00:00
[test] isVmAotConfiguration
in custom configurations take 2
https://dart-review.googlesource.com/c/sdk/+/372260 fixed `dartkp` invocations, but did not fix `dartk` due to conflicts with the `dart2analyzer` compiler. (Patchset 3 of that CL.) Try to land the same heuristic but guarded on if `compiler` is null. Closes: https://github.com/dart-lang/sdk/issues/56041 Change-Id: Ieba182d74cb0d1d846a3073f1a02ee9f958ef36d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372360 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
parent
00eac588c2
commit
7958fe1a15
|
@ -245,17 +245,17 @@ class Configuration {
|
|||
nnbdMode ??= NnbdMode.strong;
|
||||
sanitizer ??= Sanitizer.none;
|
||||
|
||||
// Infer runtime from executable.
|
||||
if (runtime == null) {
|
||||
// Infer runtime from executable if we don't know runtime and compiler.
|
||||
if (runtime == null && compiler == null && words.contains("custom")) {
|
||||
final executableName = Uri.file(Platform.executable)
|
||||
.pathSegments
|
||||
.lastWhere((e) => e.isNotEmpty);
|
||||
final executableNoExtension = executableName.split('.').first;
|
||||
if (executableNoExtension == 'dart_precompiled_runtime') {
|
||||
runtime = Runtime.dartPrecompiled;
|
||||
} else if (executableNoExtension == 'dart') {
|
||||
runtime = Runtime.vm;
|
||||
}
|
||||
// Don't infer anything from the `dart` executable. As multiple runtimes
|
||||
// use that as executable.
|
||||
}
|
||||
|
||||
// Infer from compiler from runtime or vice versa.
|
||||
|
|
|
@ -238,6 +238,13 @@ void main() {
|
|||
'configuration name.');
|
||||
});
|
||||
|
||||
test("custom configuration", () {
|
||||
final result = Configuration.parse("custom-configuration-1", {});
|
||||
// Succeeds. Since this test runs in JIT mode, should be dartk and vm.
|
||||
expect(result.compiler, Compiler.dartk);
|
||||
expect(result.runtime, Runtime.vm);
|
||||
});
|
||||
|
||||
test("empty string", () {
|
||||
expectParseError("", {}, 'Name must not be empty.');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue