[cfe] Skip VM for weak mode tests
This disables the running of the .dill for weak mode, in preparation
for the VM ending support for --no-sound-null-safety.
The environment keys are also refactored to be defined in one location.
Change-Id: Ia08177f074673c410c8d92a4832047849f008b4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358160
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/test/fasta/expression_suite.dart b/pkg/front_end/test/fasta/expression_suite.dart
index 8bc064d..32d4d1a 100644
--- a/pkg/front_end/test/fasta/expression_suite.dart
+++ b/pkg/front_end/test/fasta/expression_suite.dart
@@ -53,7 +53,7 @@
import '../testing_utils.dart' show checkEnvironment;
import '../utils/kernel_chain.dart' show runDiff, openWrite;
import 'suite_utils.dart';
-import 'testing/suite.dart';
+import 'testing/environment_keys.dart';
class Context extends ChainContext {
final CompilerContext compilerContext;
@@ -655,8 +655,8 @@
Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
const Set<String> knownEnvironmentKeys = {
- UPDATE_EXPECTATIONS,
- "fuzz",
+ EnvironmentKeys.updateExpectations,
+ EnvironmentKeys.fuzz,
};
checkEnvironment(environment, knownEnvironmentKeys);
@@ -715,9 +715,10 @@
final ProcessedOptions optionsNoNNBD =
new ProcessedOptions(options: optionBuilderNoNNBD, inputs: [entryPoint]);
- final bool updateExpectations = environment[UPDATE_EXPECTATIONS] == "true";
+ final bool updateExpectations =
+ environment[EnvironmentKeys.updateExpectations] == "true";
- final bool fuzz = environment["fuzz"] == "true";
+ final bool fuzz = environment[EnvironmentKeys.fuzz] == "true";
final CompilerContext compilerContext = new CompilerContext(options);
final CompilerContext compilerContextNoNNBD =
diff --git a/pkg/front_end/test/fasta/modular_suite.dart b/pkg/front_end/test/fasta/modular_suite.dart
index d01fce2..f1cbc4d 100644
--- a/pkg/front_end/test/fasta/modular_suite.dart
+++ b/pkg/front_end/test/fasta/modular_suite.dart
@@ -5,11 +5,12 @@
library fasta.test.modular_suite;
import 'suite_utils.dart' show internalMain;
+import 'testing/environment_keys.dart';
import 'testing/suite.dart';
Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
- environment[COMPILATION_MODE] = CompileMode.modular.name;
+ environment[EnvironmentKeys.compilationMode] = CompileMode.modular.name;
return FastaContext.create(suite, environment);
}
diff --git a/pkg/front_end/test/fasta/strong_suite.dart b/pkg/front_end/test/fasta/strong_suite.dart
index 382b718..f5605ed 100644
--- a/pkg/front_end/test/fasta/strong_suite.dart
+++ b/pkg/front_end/test/fasta/strong_suite.dart
@@ -5,13 +5,14 @@
library fasta.test.strong_suite;
import 'suite_utils.dart' show internalMain;
+import 'testing/environment_keys.dart';
import 'testing/suite.dart';
Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
- environment[COMPILATION_MODE] = CompileMode.full.name;
- environment['soundNullSafety'] = "true";
- environment["semiFuzz"] ??= "true";
+ environment[EnvironmentKeys.compilationMode] = CompileMode.full.name;
+ environment[EnvironmentKeys.soundNullSafety] = "true";
+ environment[EnvironmentKeys.semiFuzz] ??= "true";
return FastaContext.create(suite, environment);
}
diff --git a/pkg/front_end/test/fasta/testing/environment_keys.dart b/pkg/front_end/test/fasta/testing/environment_keys.dart
new file mode 100644
index 0000000..ec4ff45
--- /dev/null
+++ b/pkg/front_end/test/fasta/testing/environment_keys.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class EnvironmentKeys {
+ static const String addDebugBreaks = "addDebugBreaks";
+ static const String annotateLines = "annotateLines";
+ static const String compilationMode = " compilation mode ";
+ static const String fuzz = "fuzz";
+ static const String ignoreExpectations = "ignoreExpectations";
+ static const String platformBinaries = "platformBinaries";
+ static const String semiFuzz = "semiFuzz";
+ static const String skipTests = "skipTests";
+ static const String skipVm = "skipVm";
+ static const String soundNullSafety = "soundNullSafety";
+ static const String trace = "trace";
+ static const String updateComments = "updateComments";
+ static const String updateExpectations = "updateExpectations";
+ static const String verify = "verify";
+}
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index c76c1f8..caab5b1d 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -136,16 +136,12 @@
WriteDill;
import '../../utils/validating_instrumentation.dart'
show ValidatingInstrumentation;
+import 'environment_keys.dart';
import 'folder_options.dart';
import 'test_options.dart';
export 'package:testing/testing.dart' show Chain, runMe;
-const String COMPILATION_MODE = " compilation mode ";
-
-const String UPDATE_EXPECTATIONS = "updateExpectations";
-const String UPDATE_COMMENTS = "updateComments";
-
const String EXPECTATIONS = '''
[
{
@@ -231,7 +227,8 @@
final bool updateExpectations;
@override
- String get updateExpectationsOption => '${UPDATE_EXPECTATIONS}=true';
+ String get updateExpectationsOption =>
+ '${EnvironmentKeys.updateExpectations}=true';
@override
bool get canBeFixWithUpdateExpectations => true;
@@ -461,17 +458,15 @@
static Future<FastaContext> create(
Chain suite, Map<String, String> environment) {
const Set<String> knownEnvironmentKeys = {
- "enableExtensionMethods",
- "enableNonNullable",
- "soundNullSafety",
- "ignoreExpectations",
- UPDATE_EXPECTATIONS,
- UPDATE_COMMENTS,
- "skipVm",
- "semiFuzz",
- "verify",
- "platformBinaries",
- COMPILATION_MODE,
+ EnvironmentKeys.soundNullSafety,
+ EnvironmentKeys.ignoreExpectations,
+ EnvironmentKeys.updateExpectations,
+ EnvironmentKeys.updateComments,
+ EnvironmentKeys.skipVm,
+ EnvironmentKeys.semiFuzz,
+ EnvironmentKeys.verify,
+ EnvironmentKeys.platformBinaries,
+ EnvironmentKeys.compilationMode,
};
checkEnvironment(environment, knownEnvironmentKeys);
@@ -481,14 +476,17 @@
Map<ExperimentalFlag, bool> experimentalFlags =
SuiteFolderOptions.computeForcedExperimentalFlags(environment);
- bool soundNullSafety = environment["soundNullSafety"] == "true";
- bool ignoreExpectations = environment["ignoreExpectations"] == "true";
- bool updateExpectations = environment[UPDATE_EXPECTATIONS] == "true";
- bool updateComments = environment[UPDATE_COMMENTS] == "true";
- bool skipVm = environment["skipVm"] == "true";
- bool semiFuzz = environment["semiFuzz"] == "true";
- bool verify = environment["verify"] != "false";
- String? platformBinaries = environment["platformBinaries"];
+ bool soundNullSafety =
+ environment[EnvironmentKeys.soundNullSafety] == "true";
+ bool ignoreExpectations =
+ environment[EnvironmentKeys.ignoreExpectations] == "true";
+ bool updateExpectations =
+ environment[EnvironmentKeys.updateExpectations] == "true";
+ bool updateComments = environment[EnvironmentKeys.updateComments] == "true";
+ bool skipVm = environment[EnvironmentKeys.skipVm] == "true";
+ bool semiFuzz = environment[EnvironmentKeys.semiFuzz] == "true";
+ bool verify = environment[EnvironmentKeys.verify] != "false";
+ String? platformBinaries = environment[EnvironmentKeys.platformBinaries];
if (platformBinaries != null && !platformBinaries.endsWith('/')) {
platformBinaries = '$platformBinaries/';
}
@@ -504,7 +502,7 @@
updateComments,
skipVm,
semiFuzz,
- compileModeFromName(environment[COMPILATION_MODE]),
+ compileModeFromName(environment[EnvironmentKeys.compilationMode]),
verify,
soundNullSafety));
}
@@ -2114,7 +2112,7 @@
compilationSetup, sourceTarget),
context.expectationSet["InstrumentationMismatch"],
instrumentation.problemsAsString,
- autoFixCommand: '${UPDATE_COMMENTS}=true',
+ autoFixCommand: '${EnvironmentKeys.updateComments}=true',
canBeFixWithUpdateExpectations: true);
}
}
diff --git a/pkg/front_end/test/fasta/textual_outline_suite.dart b/pkg/front_end/test/fasta/textual_outline_suite.dart
index 298c9ed..4bc6da1 100644
--- a/pkg/front_end/test/fasta/textual_outline_suite.dart
+++ b/pkg/front_end/test/fasta/textual_outline_suite.dart
@@ -24,8 +24,8 @@
import '../utils/kernel_chain.dart' show MatchContext;
import 'suite_utils.dart';
+import 'testing/environment_keys.dart';
import 'testing/folder_options.dart';
-import 'testing/suite.dart' show UPDATE_EXPECTATIONS;
const int minSupportedMajorVersion = 2;
const int minSupportedMinorVersion = 12;
@@ -71,14 +71,16 @@
final bool updateExpectations;
@override
- String get updateExpectationsOption => '${UPDATE_EXPECTATIONS}=true';
+ String get updateExpectationsOption =>
+ '${EnvironmentKeys.updateExpectations}=true';
@override
bool get canBeFixWithUpdateExpectations => true;
Context(Uri baseUri, Map<String, String> environment)
: suiteFolderOptions = new SuiteFolderOptions(baseUri),
- updateExpectations = environment[UPDATE_EXPECTATIONS] == "true",
+ updateExpectations =
+ environment[EnvironmentKeys.updateExpectations] == "true",
forcedExperimentalFlags =
SuiteFolderOptions.computeForcedExperimentalFlags(environment);
diff --git a/pkg/front_end/test/fasta/weak_suite.dart b/pkg/front_end/test/fasta/weak_suite.dart
index 9630a0c..171095f 100644
--- a/pkg/front_end/test/fasta/weak_suite.dart
+++ b/pkg/front_end/test/fasta/weak_suite.dart
@@ -5,12 +5,14 @@
library fasta.test.weak_suite;
import 'suite_utils.dart' show internalMain;
+import 'testing/environment_keys.dart';
import 'testing/suite.dart';
Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
- environment[COMPILATION_MODE] = CompileMode.full.name;
- environment["semiFuzz"] ??= "true";
+ environment[EnvironmentKeys.compilationMode] = CompileMode.full.name;
+ environment[EnvironmentKeys.semiFuzz] ??= "true";
+ environment[EnvironmentKeys.skipVm] ??= "true";
return FastaContext.create(suite, environment);
}
diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart
index d207742..41e6474 100644
--- a/pkg/front_end/test/incremental_suite.dart
+++ b/pkg/front_end/test/incremental_suite.dart
@@ -69,7 +69,7 @@
import 'binary_md_dill_reader.dart' show DillComparer;
import 'fasta/suite_utils.dart';
-import 'fasta/testing/suite.dart';
+import 'fasta/testing/environment_keys.dart';
import "incremental_utils.dart" as util;
import 'test_utils.dart';
import 'testing_utils.dart' show checkEnvironment;
@@ -475,19 +475,20 @@
Future<Context> createContext(Chain suite, Map<String, String> environment) {
const Set<String> knownEnvironmentKeys = {
- UPDATE_EXPECTATIONS,
- "addDebugBreaks",
- "skipTests",
+ EnvironmentKeys.updateExpectations,
+ EnvironmentKeys.addDebugBreaks,
+ EnvironmentKeys.skipTests,
};
checkEnvironment(environment, knownEnvironmentKeys);
// Disable colors to ensure that expectation files are the same across
// platforms and independent of stdin/stderr.
colors.enableColors = false;
- Set<String> skipTests = environment["skipTests"]?.split(",").toSet() ?? {};
+ Set<String> skipTests =
+ environment[EnvironmentKeys.skipTests]?.split(",").toSet() ?? {};
return new Future.value(new Context(
- environment[UPDATE_EXPECTATIONS] == "true",
- environment["addDebugBreaks"] == "true",
+ environment[EnvironmentKeys.updateExpectations] == "true",
+ environment[EnvironmentKeys.addDebugBreaks] == "true",
skipTests,
));
}
diff --git a/pkg/front_end/test/outline_extractor_suite.dart b/pkg/front_end/test/outline_extractor_suite.dart
index e301e7b..ff75a28 100644
--- a/pkg/front_end/test/outline_extractor_suite.dart
+++ b/pkg/front_end/test/outline_extractor_suite.dart
@@ -16,7 +16,7 @@
show Chain, ChainContext, ExpectationSet, Result, Step, TestDescription;
import 'fasta/suite_utils.dart';
-import 'fasta/testing/suite.dart' show UPDATE_EXPECTATIONS;
+import 'fasta/testing/environment_keys.dart';
import 'incremental_suite.dart' as helper;
import 'testing_utils.dart' show checkEnvironment;
import 'utils/kernel_chain.dart' show MatchContext;
@@ -42,11 +42,12 @@
Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
const Set<String> knownEnvironmentKeys = {
- UPDATE_EXPECTATIONS,
+ EnvironmentKeys.updateExpectations,
};
checkEnvironment(environment, knownEnvironmentKeys);
- bool updateExpectations = environment[UPDATE_EXPECTATIONS] == "true";
+ bool updateExpectations =
+ environment[EnvironmentKeys.updateExpectations] == "true";
return new Context(suite.name, updateExpectations);
}
@@ -56,7 +57,8 @@
final bool updateExpectations;
@override
- String get updateExpectationsOption => '${UPDATE_EXPECTATIONS}=true';
+ String get updateExpectationsOption =>
+ '${EnvironmentKeys.updateExpectations}=true';
@override
bool get canBeFixWithUpdateExpectations => true;
diff --git a/pkg/front_end/test/parser_suite.dart b/pkg/front_end/test/parser_suite.dart
index 51aaf9d..052bf20b 100644
--- a/pkg/front_end/test/parser_suite.dart
+++ b/pkg/front_end/test/parser_suite.dart
@@ -31,7 +31,7 @@
show Chain, ChainContext, ExpectationSet, Result, Step, TestDescription;
import 'fasta/suite_utils.dart';
-import 'fasta/testing/suite.dart' show UPDATE_EXPECTATIONS;
+import 'fasta/testing/environment_keys.dart';
import 'parser_test_listener.dart' show ParserTestListener;
import 'parser_test_parser.dart' show TestParser;
import 'testing_utils.dart' show checkEnvironment;
@@ -58,15 +58,16 @@
Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
const Set<String> knownEnvironmentKeys = {
- UPDATE_EXPECTATIONS,
- "trace",
- "annotateLines"
+ EnvironmentKeys.updateExpectations,
+ EnvironmentKeys.trace,
+ EnvironmentKeys.annotateLines,
};
checkEnvironment(environment, knownEnvironmentKeys);
- bool updateExpectations = environment[UPDATE_EXPECTATIONS] == "true";
- bool trace = environment["trace"] == "true";
- bool annotateLines = environment["annotateLines"] == "true";
+ bool updateExpectations =
+ environment[EnvironmentKeys.updateExpectations] == "true";
+ bool trace = environment[EnvironmentKeys.trace] == "true";
+ bool annotateLines = environment[EnvironmentKeys.annotateLines] == "true";
return new Context(suite.name, updateExpectations, trace, annotateLines);
}
@@ -102,7 +103,8 @@
final bool updateExpectations;
@override
- String get updateExpectationsOption => '${UPDATE_EXPECTATIONS}=true';
+ String get updateExpectationsOption =>
+ '${EnvironmentKeys.updateExpectations}=true';
@override
bool get canBeFixWithUpdateExpectations => true;