[stable][testing] Use migrated suites by default on non-legacy configurations
Make test.py pick migrated suites by default when the `NnbdMode` is not `NnbdMode.legacy`.
* Remove non-existing benchmark_smoke suite.
* Remove broken analyzer_library suite from default suites.
* Deprecated observatory_ui is not added to the default migrated suites.
* Remove remaining references to samples-dev.
* Remove unnecessary suite specifications from the test_matrix.json.
* Remove broken references to observatory_ui from the test_matrix.json.
* Remove defunct observatory_ui hack from test.py.
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/281701
Change-Id: Ic362e308d147b5f4f46a53adff1163ebe0b605a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289461
Reviewed-by: William Hesse <whesse@google.com>
diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart
index 0f1b736..20551f0 100644
--- a/pkg/test_runner/lib/src/options.dart
+++ b/pkg/test_runner/lib/src/options.dart
@@ -15,20 +15,30 @@
import 'test_configurations.dart';
import 'utils.dart';
-const _defaultTestSelectors = [
- 'samples',
- 'standalone_2',
+const _legacyTestSelectors = [
'corelib_2',
+ 'ffi_2',
'language_2',
- 'vm',
- 'benchmark_smoke',
- 'utils',
'lib_2',
- 'analyze_library',
- 'service_2',
'kernel',
'observatory_ui_2',
- 'ffi_2'
+ 'service_2',
+ 'standalone_2',
+ 'utils',
+ 'vm',
+];
+
+const _defaultTestSelectors = [
+ 'corelib',
+ 'ffi',
+ 'kernel',
+ 'language',
+ 'lib',
+ 'samples',
+ 'service',
+ 'standalone',
+ 'utils',
+ 'vm',
];
extension _IntOption on ArgParser {
@@ -534,7 +544,7 @@
options['test-list-contents'] = LineSplitter.split(tests).toList();
}
- return _createConfigurations(options);
+ return _expandConfigurations(options);
}
/// Given a set of parsed option values, returns the list of command line
@@ -577,48 +587,9 @@
return arguments;
}
- List<TestConfiguration> _createConfigurations(
- Map<String, dynamic> configuration) {
- var selectors = _expandSelectors(configuration);
-
- // Put observatory_ui in a configuration with its own packages override.
- // Only one value in the configuration map is mutable:
- if (selectors.containsKey('observatory_ui')) {
- if (selectors.length == 1) {
- configuration['packages'] = Repository.uri
- .resolve('.dart_tool/package_config.json')
- .toFilePath();
- } else {
- // Make a new configuration whose selectors map only contains
- // observatory_ui, and remove observatory_ui from the original
- // selectors. The only mutable value in the map is the selectors, so a
- // shallow copy is safe.
- var observatoryConfiguration = Map<String, dynamic>.from(configuration);
- var observatorySelectors = {
- 'observatory_ui': selectors['observatory_ui']
- };
- selectors.remove('observatory_ui');
-
- // Set the packages flag.
- observatoryConfiguration['packages'] = Repository.uri
- .resolve('.dart_tool/package_config.json')
- .toFilePath();
-
- return [
- ..._expandConfigurations(configuration, selectors),
- ..._expandConfigurations(
- observatoryConfiguration, observatorySelectors)
- ];
- }
- }
-
- return _expandConfigurations(configuration, selectors);
- }
-
/// Recursively expands a configuration with multiple values per key into a
/// list of configurations with exactly one value per key.
- List<TestConfiguration> _expandConfigurations(
- Map<String, dynamic> data, Map<String, RegExp?> selectors) {
+ List<TestConfiguration> _expandConfigurations(Map<String, dynamic> data) {
var result = <TestConfiguration>[];
// Handles a string option containing a space-separated list of words.
@@ -681,7 +652,7 @@
var configuration = TestConfiguration(
configuration: innerConfiguration,
progress: progress,
- selectors: selectors,
+ selectors: _expandSelectors(data, innerConfiguration.nnbdMode),
build: data["build"] as bool,
testList: data["test-list-contents"] as List<String>?,
repeat: int.parse(data["repeat"] as String),
@@ -843,7 +814,8 @@
/// expression to be used on the full path of a test file in that test suite.
///
/// If no selectors are explicitly given, uses the default suite patterns.
- Map<String, RegExp> _expandSelectors(Map<String, dynamic> configuration) {
+ Map<String, RegExp> _expandSelectors(
+ Map<String, dynamic> configuration, NnbdMode nnbdMode) {
var selectors = configuration['selectors'] as List<String>?;
if (selectors == null || selectors.isEmpty) {
@@ -856,7 +828,11 @@
.toSet()
.toList();
} else {
- selectors = _defaultTestSelectors.toList();
+ if (nnbdMode == NnbdMode.legacy) {
+ selectors = _legacyTestSelectors.toList();
+ } else {
+ selectors = _defaultTestSelectors.toList();
+ }
}
var excludeSuites = configuration['exclude-suite'] != null
diff --git a/pkg/test_runner/lib/src/test_configurations.dart b/pkg/test_runner/lib/src/test_configurations.dart
index 5de2eb9..002549f 100644
--- a/pkg/test_runner/lib/src/test_configurations.dart
+++ b/pkg/test_runner/lib/src/test_configurations.dart
@@ -35,7 +35,6 @@
Path('runtime/observatory_2/tests/service_2'),
Path('runtime/tests/vm'),
Path('samples'),
- Path('samples-dev'),
Path('tests/corelib'),
Path('tests/corelib_2'),
Path('tests/dartdevc'),
diff --git a/pkg/test_runner/test/options_test.dart b/pkg/test_runner/test/options_test.dart
index 9f5a401..1566ada 100644
--- a/pkg/test_runner/test/options_test.dart
+++ b/pkg/test_runner/test/options_test.dart
@@ -10,6 +10,7 @@
testDefaults();
testOptions();
testValidation();
+ testSelectors();
}
void testDefaults() {
@@ -93,6 +94,48 @@
'The named configuration "invalid-vm-android-simarm" is invalid.');
}
+void testSelectors() {
+ // Legacy suites.
+ for (var arguments in [
+ <String>[],
+ ['-nvm-legacy']
+ ]) {
+ var configuration = parseConfiguration(arguments);
+ Expect.setEquals({
+ 'standalone_2',
+ 'corelib_2',
+ 'language_2',
+ 'vm',
+ 'utils',
+ 'lib_2',
+ 'service_2',
+ 'kernel',
+ 'observatory_ui_2',
+ 'ffi_2',
+ }, configuration.selectors.keys, "suites for $arguments");
+ }
+
+ // Default null safe suites.
+ for (var arguments in [
+ ['--nnbd=strong'],
+ ['-nvm-strong']
+ ]) {
+ var configuration = parseConfiguration(arguments);
+ Expect.setEquals({
+ 'samples',
+ 'standalone',
+ 'corelib',
+ 'language',
+ 'vm',
+ 'utils',
+ 'lib',
+ 'service',
+ 'kernel',
+ 'ffi',
+ }, configuration.selectors.keys, "suites for $arguments");
+ }
+}
+
TestConfiguration parseConfiguration(List<String> arguments) {
var configurations = parseConfigurations(arguments);
Expect.equals(1, configurations.length);
diff --git a/pkg/test_runner/test/test_matrix.json b/pkg/test_runner/test/test_matrix.json
index 35fb980..86ee96c 100644
--- a/pkg/test_runner/test/test_matrix.json
+++ b/pkg/test_runner/test/test_matrix.json
@@ -2,6 +2,13 @@
"configurations": {
"invalid-vm-android-simarm": {},
"valid-dart2js-chrome": {},
- "valid-dart2js-safari": {}
+ "valid-dart2js-safari": {},
+ "vm-aot": {
+ "options": {
+ "compiler": "dartkp"
+ }
+ },
+ "vm-legacy": {},
+ "vm-strong": {}
}
}
\ No newline at end of file