[test_runner] Use package:args

* Use lowercase-with-hyphens for option names
* Add backwards compatible aliases_with_underscores.
* Deny list `reset-browser-configuration`.
* Add more tests.

Bug: b/232495224
Change-Id: Ife56c48450b5e15577c4aec859355e80c2f57bdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245366
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This commit is contained in:
Alexander Thomas 2022-05-24 10:51:51 +00:00 committed by Commit Bot
parent a6fcb56901
commit ddad653842
8 changed files with 550 additions and 641 deletions

View file

@ -46,7 +46,7 @@ if [[ $logfile == '' ]]; then
# delete=1
python3 tools/test.py -m release --checked --use-sdk \
--vm-options="-DuseFastaParser=true" \
--print_passing_stdout \
--print-passing-stdout \
pkg/analy > $logfile
fi

View file

@ -450,7 +450,7 @@ class TestConfiguration {
/// We allow our code to have been cross compiled, i.e., that there is an X
/// in front of the arch. We don't allow both a cross compiled and a normal
/// version to be present (except if you specifically pass in the
/// build_directory).
/// build-directory).
String _calculateDirectory() {
// Capitalize the mode name.
var result =

File diff suppressed because it is too large Load diff

View file

@ -105,7 +105,7 @@ abstract class RuntimeConfiguration {
}
String get dartPrecompiledBinaryFileName {
// Controlled by user with the option "--dart_precompiled".
// Controlled by user with the option "--dart-precompiled".
var dartExecutable = _configuration.dartPrecompiledPath;
if (dartExecutable == null || dartExecutable == '') {

View file

@ -6,7 +6,7 @@ name: test_runner
# This package is not intended for consumption on pub.dev. DO NOT publish.
publish_to: none
environment:
sdk: "^2.3.0"
sdk: "^2.9.0"
dependencies:
args: any
dart2js_tools: any

View file

@ -32,6 +32,41 @@ void testOptions() {
// Filter invalid configurations when not passing a named configuration.
configurations = parseConfigurations(['--arch=simarm', '--system=android']);
Expect.isEmpty(configurations);
// Special handling for *-options.
configuration = parseConfiguration([
'--dart2js-options=a b c',
'--vm-options=d e f',
'--shared-options=g h i'
]);
Expect.listEquals(configuration.dart2jsOptions, ['a', 'b', 'c']);
Expect.listEquals(configuration.vmOptions, ['d', 'e', 'f']);
Expect.listEquals(configuration.sharedOptions,
['g', 'h', 'i', '-Dtest_runner.configuration=custom-configuration-1']);
// Reproduction arguments.
configurations = parseConfigurations([
'--progress=status',
'--report',
'--time',
'--silent-failures',
'--write-results',
'--write-logs',
'--clean-exit',
'-nvalid-dart2js-chrome,valid-dart2js-safari',
'--reset-browser-configuration',
'--no-batch',
'web',
'--copy-coredumps',
'--chrome=third_party/browsers/chrome/chrome/google-chrome',
'--output-directory=/path/to/dir',
]);
Expect.equals(2, configurations.length);
for (var configuration in configurations) {
Expect.listEquals(
['-n', 'valid-dart2js-chrome,valid-dart2js-safari', '--no-batch'],
configuration.reproducingArguments);
}
}
void testValidation() {
@ -42,16 +77,16 @@ void testValidation() {
['--timeout=1,2'], 'Integer value expected for option "--timeout".');
expectValidationError(['--progress=unknown'],
'Unknown value "unknown" for option "--progress".');
'"unknown" is not an allowed value for option "progress".');
// Don't allow multiple.
expectValidationError(['--progress=compact,silent'],
'Only a single value is allowed for option "--progress".');
'"compact,silent" is not an allowed value for option "progress".');
expectValidationError(
['--nnbd=unknown'], 'Unknown value "unknown" for option "--nnbd".');
expectValidationError(['--nnbd=unknown'],
'"unknown" is not an allowed value for option "nnbd".');
// Don't allow multiple.
expectValidationError(['--nnbd=weak,strong'],
'Only a single value is allowed for option "--nnbd".');
'"weak,strong" is not an allowed value for option "nnbd".');
// Don't allow invalid named configurations.
expectValidationError(['-ninvalid-vm-android-simarm'],

View file

@ -1,5 +1,7 @@
{
"configurations": {
"invalid-vm-android-simarm": {}
"invalid-vm-android-simarm": {},
"valid-dart2js-chrome": {},
"valid-dart2js-safari": {}
}
}

View file

@ -2661,7 +2661,7 @@
"name": "dart2js tests",
"arguments": [
"-ndart2js-hostasserts-linux-ia32-d8",
"--exclude_suite=observatory_ui"
"--exclude-suite=observatory_ui"
],
"shards": 6,
"fileset": "web_platform_hostasserts"
@ -2725,7 +2725,7 @@
"arguments": [
"-ndart2js-${system}-${runtime}",
"--reset-browser-configuration",
"--exclude_suite=observatory_ui"
"--exclude-suite=observatory_ui"
],
"shards": 6,
"fileset": "web_platform"
@ -2785,7 +2785,7 @@
"name": "dart2js tests",
"arguments": [
"-ndart2js-minified-linux-d8",
"--exclude_suite=observatory_ui"
"--exclude-suite=observatory_ui"
],
"shards": 6,
"fileset": "web_platform"
@ -2815,7 +2815,7 @@
"name": "dart2js production tests",
"arguments": [
"-ndart2js-production-linux-d8",
"--exclude_suite=observatory_ui"
"--exclude-suite=observatory_ui"
],
"shards": 6,
"fileset": "web_platform"
@ -2865,7 +2865,7 @@
"arguments": [
"-ndart2js-minified-csp-linux-chrome",
"--reset-browser-configuration",
"--exclude_suite=observatory_ui"
"--exclude-suite=observatory_ui"
],
"shards": 4,
"fileset": "web_platform"