From 0dbeb2135e4753c05b0046705cb388045bd5278e Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Thu, 8 Feb 2024 22:01:09 +0000 Subject: [PATCH] [test_runner] Rename host-checked to host-asserts Cleanup this old naming scheme before adding new configs for DDC that run with assertions enabled in the host compiler. Change-Id: Icbdee694fac46b3a1d5bab7ee7411c8e9be8c4a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335385 Reviewed-by: Sigmund Cherem Commit-Queue: Nicholas Shahan Reviewed-by: Bob Nystrom --- pkg/pkg.status | 2 +- pkg/smith/lib/configuration.dart | 23 +++++++++--------- pkg/smith/test/configuration_test.dart | 9 ++++--- pkg/status_file/test/data/co19-dart2js.status | 2 +- .../lib/src/compiler_configuration.dart | 24 +++++++++---------- pkg/test_runner/lib/src/configuration.dart | 2 +- pkg/test_runner/lib/src/environment.dart | 5 +--- pkg/test_runner/lib/src/options.dart | 14 +++++------ tests/co19/co19-dart2js.status | 2 +- tests/web/web.status | 4 ++-- tools/bots/test_matrix.json | 14 +++++------ 11 files changed, 47 insertions(+), 54 deletions(-) diff --git a/pkg/pkg.status b/pkg/pkg.status index 2f5c15b0c1b..f4dc4b392b1 100644 --- a/pkg/pkg.status +++ b/pkg/pkg.status @@ -331,7 +331,7 @@ crypto/test/sha256_test: Slow, Pass [ $compiler == dart2js && $checked ] crypto/test/base64_test: Slow, Pass -[ $compiler == dart2js && $host_checked ] +[ $compiler == dart2js && $host_asserts ] js_ast/test/printer_callback_test: Slow, Pass js_ast/test/string_escape_test: Slow, Pass diff --git a/pkg/smith/lib/configuration.dart b/pkg/smith/lib/configuration.dart index 346539fdc37..14d9b3f903a 100644 --- a/pkg/smith/lib/configuration.dart +++ b/pkg/smith/lib/configuration.dart @@ -281,7 +281,7 @@ class Configuration { enableAsserts: boolOption("enable-asserts"), isChecked: boolOption("checked"), isCsp: boolOption("csp"), - isHostChecked: boolOption("host-checked"), + enableHostAsserts: boolOption("host-asserts"), isMinified: boolOption("minified"), useAnalyzerCfe: boolOption("use-cfe"), useAnalyzerFastaParser: boolOption("analyzer-use-fasta-parser"), @@ -350,8 +350,8 @@ class Configuration { final bool isCsp; - /// Enables asserts in the dart2js compiler. - final bool isHostChecked; + /// Enables asserts in the backend compilers. + final bool enableHostAsserts; final bool isMinified; @@ -384,7 +384,7 @@ class Configuration { bool? enableAsserts, bool? isChecked, bool? isCsp, - bool? isHostChecked, + bool? enableHostAsserts, bool? isMinified, bool? useAnalyzerCfe, bool? useAnalyzerFastaParser, @@ -407,7 +407,7 @@ class Configuration { enableAsserts = enableAsserts ?? false, isChecked = isChecked ?? false, isCsp = isCsp ?? false, - isHostChecked = isHostChecked ?? false, + enableHostAsserts = enableHostAsserts ?? false, isMinified = isMinified ?? false, useAnalyzerCfe = useAnalyzerCfe ?? false, useAnalyzerFastaParser = useAnalyzerFastaParser ?? false, @@ -447,7 +447,7 @@ class Configuration { required this.enableAsserts, required this.isChecked, required this.isCsp, - required this.isHostChecked, + required this.enableHostAsserts, required this.isMinified, required this.useAnalyzerCfe, required this.useAnalyzerFastaParser, @@ -485,7 +485,7 @@ class Configuration { enableAsserts: source.enableAsserts, isChecked: source.isChecked, isCsp: source.isCsp, - isHostChecked: source.isHostChecked, + enableHostAsserts: source.enableHostAsserts, isMinified: source.isMinified, useAnalyzerCfe: source.useAnalyzerCfe, useAnalyzerFastaParser: source.useAnalyzerFastaParser, @@ -522,7 +522,7 @@ class Configuration { enableAsserts == other.enableAsserts && isChecked == other.isChecked && isCsp == other.isCsp && - isHostChecked == other.isHostChecked && + enableHostAsserts == other.enableHostAsserts && isMinified == other.isMinified && useAnalyzerCfe == other.useAnalyzerCfe && useAnalyzerFastaParser == other.useAnalyzerFastaParser && @@ -575,7 +575,7 @@ class Configuration { enableAsserts, isChecked, isCsp, - isHostChecked, + enableHostAsserts, isMinified, useAnalyzerCfe, useAnalyzerFastaParser, @@ -618,7 +618,7 @@ class Configuration { if (enableAsserts) fields.add("enable-asserts"); if (isChecked) fields.add("checked"); if (isCsp) fields.add("csp"); - if (isHostChecked) fields.add("host-checked"); + if (enableHostAsserts) fields.add("host-asserts"); if (isMinified) fields.add("minified"); if (useAnalyzerCfe) fields.add("use-cfe"); if (useAnalyzerFastaParser) fields.add("analyzer-use-fasta-parser"); @@ -677,12 +677,11 @@ class Configuration { boolField("enable-asserts", enableAsserts, other.enableAsserts); boolField("checked", isChecked, other.isChecked); boolField("csp", isCsp, other.isCsp); - boolField("host-checked", isHostChecked, other.isHostChecked); + boolField("host-asserts", enableHostAsserts, other.enableHostAsserts); boolField("minified", isMinified, other.isMinified); boolField("use-cfe", useAnalyzerCfe, other.useAnalyzerCfe); boolField("analyzer-use-fasta-parser", useAnalyzerFastaParser, other.useAnalyzerFastaParser); - boolField("host-checked", isHostChecked, other.isHostChecked); boolField("hot-reload", useHotReload, other.useHotReload); boolField("hot-reload-rollback", useHotReloadRollback, other.useHotReloadRollback); diff --git a/pkg/smith/test/configuration_test.dart b/pkg/smith/test/configuration_test.dart index 4ef4e896c23..520124a505b 100644 --- a/pkg/smith/test/configuration_test.dart +++ b/pkg/smith/test/configuration_test.dart @@ -207,7 +207,7 @@ void main() { "enable-asserts": true, "checked": true, "csp": true, - "host-checked": true, + "host-asserts": true, "minified": true, "hot-reload": true, "hot-reload-rollback": true, @@ -223,7 +223,7 @@ void main() { enableAsserts: true, isChecked: true, isCsp: true, - isHostChecked: true, + enableHostAsserts: true, isMinified: true, useHotReload: true, useHotReloadRollback: true, @@ -379,7 +379,7 @@ void main() { enableAsserts: true, isChecked: true, isCsp: true, - isHostChecked: true, + enableHostAsserts: true, isMinified: true, useAnalyzerCfe: true, useAnalyzerFastaParser: true, @@ -409,11 +409,10 @@ architecture: ia32 x64 enable-asserts: false true checked: false true csp: false true - host-checked: false true + host-asserts: false true minified: false true use-cfe: false true analyzer-use-fasta-parser: false true - host-checked: false true hot-reload: false true hot-reload-rollback: false true use-sdk: false true diff --git a/pkg/status_file/test/data/co19-dart2js.status b/pkg/status_file/test/data/co19-dart2js.status index 8074b97230d..34edafd24b1 100644 --- a/pkg/status_file/test/data/co19-dart2js.status +++ b/pkg/status_file/test/data/co19-dart2js.status @@ -6194,5 +6194,5 @@ LayoutTests/fast/dom/serialize-attribute_t01: RuntimeError # Please triage this [ $compiler == dart2js && $runtime == ie11 && $builder_tag == win7] LayoutTests/fast/files/file-reader-result-twice_t01: Pass, RuntimeError # Issue 31430 -[ $compiler == dart2js && $host_checked ] +[ $compiler == dart2js && $host_asserts ] Language/Types/Function_Types/call_t01: Crash # Issue 28894 diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart index 09fa4573a98..bb881e64ce5 100644 --- a/pkg/test_runner/lib/src/compiler_configuration.dart +++ b/pkg/test_runner/lib/src/compiler_configuration.dart @@ -65,7 +65,7 @@ abstract class CompilerConfiguration { bool get _isDebug => _configuration.mode.isDebug; - bool get _isHostChecked => _configuration.isHostChecked; + bool get _enableHostAsserts => _configuration.enableHostAsserts; bool get _useSdk => _configuration.useSdk; @@ -391,12 +391,12 @@ class Dart2jsCompilerConfiguration extends CompilerConfiguration { @override String computeCompilerPath() { - if (_isHostChecked && _useSdk) { + if (_enableHostAsserts && _useSdk) { // When [_useSdk] is true, dart2js is compiled into a snapshot that was - // built without checked mode. The VM cannot make such snapshot run in - // checked mode later. These two flags could be used together if we also - // build an sdk with checked snapshots. - throw "--host-checked and --use-sdk cannot be used together"; + // built without assertions enabled. The VM cannot make such snapshot run + // with assertions later. These two flags could be used together if we + // also build sdk snapshots with assertions enabled. + throw "--host-asserts and --use-sdk cannot be used together"; } if (_useSdk) { @@ -408,7 +408,7 @@ class Dart2jsCompilerConfiguration extends CompilerConfiguration { // mode or not. return '$dartSdk/bin/dart$executableExtension'; } else { - var scriptName = _isHostChecked ? 'dart2js_developer' : 'dart2js'; + var scriptName = _enableHostAsserts ? 'dart2js_developer' : 'dart2js'; return 'sdk/bin/$scriptName$shellScriptExtension'; } } @@ -527,8 +527,8 @@ class Dart2WasmCompilerConfiguration extends CompilerConfiguration { @override String computeCompilerPath() { if (_useSdk) { - if (_isHostChecked) { - throw "--host-checked and --use-sdk cannot be used together"; + if (_enableHostAsserts) { + throw "--host-asserts and --use-sdk cannot be used together"; } return '${_configuration.buildDirectory}/dart-sdk/bin/dart'; } @@ -543,7 +543,7 @@ class Dart2WasmCompilerConfiguration extends CompilerConfiguration { 'compile', 'wasm', ] else ...[ - if (_isHostChecked) '--compiler-asserts', + if (_enableHostAsserts) '--compiler-asserts', ], ...testFile.sharedOptions, ..._configuration.sharedOptions, @@ -1296,8 +1296,8 @@ class AnalyzerCompilerConfiguration extends CompilerConfiguration { @override String computeCompilerPath() { var prefix = 'sdk/bin'; - if (_isHostChecked) { - throw "--host-checked cannot be used for dartanalyzer"; + if (_enableHostAsserts) { + throw "--host-asserts cannot be used for dartanalyzer"; } if (_useSdk) { prefix = '${_configuration.buildDirectory}/dart-sdk/bin'; diff --git a/pkg/test_runner/lib/src/configuration.dart b/pkg/test_runner/lib/src/configuration.dart index 3112d425167..22eb4783062 100644 --- a/pkg/test_runner/lib/src/configuration.dart +++ b/pkg/test_runner/lib/src/configuration.dart @@ -119,7 +119,7 @@ class TestConfiguration { bool get hotReload => configuration.useHotReload; bool get hotReloadRollback => configuration.useHotReloadRollback; bool get isChecked => configuration.isChecked; - bool get isHostChecked => configuration.isHostChecked; + bool get enableHostAsserts => configuration.enableHostAsserts; bool get isCsp => configuration.isCsp; bool get isMinified => configuration.isMinified; bool get isSimulator => architecture.isSimulator; diff --git a/pkg/test_runner/lib/src/environment.dart b/pkg/test_runner/lib/src/environment.dart index dc170fbe729..dbd3fcd93e3 100644 --- a/pkg/test_runner/lib/src/environment.dart +++ b/pkg/test_runner/lib/src/environment.dart @@ -9,8 +9,6 @@ import 'configuration.dart'; typedef _LookUpFunction = String Function(TestConfiguration configuration); typedef _BoolLookUpFunction = bool Function(TestConfiguration configuration); -// TODO(29756): Instead of synthesized negated variables like "unchecked", -// consider adding support for "!" to status expressions. final _variables = { "analyzer": _Variable.bool((c) => c.compiler == Compiler.dart2analyzer), "analyzer_use_fasta_parser": _Variable.bool((c) => c.useAnalyzerFastaParser), @@ -22,8 +20,7 @@ final _variables = { "csp": _Variable.bool((c) => c.isCsp), "enable_asserts": _Variable.bool((c) => c.enableAsserts), "fasta": _Variable.bool((c) => c.usesFasta), - "host_checked": _Variable.bool((c) => c.isHostChecked), - "host_unchecked": _Variable.bool((c) => !c.isHostChecked), + "host_asserts": _Variable.bool((c) => c.enableHostAsserts), "hot_reload": _Variable.bool((c) => c.hotReload), "hot_reload_rollback": _Variable.bool((c) => c.hotReloadRollback), "ie": _Variable.bool((c) => c.runtime.isIE), diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart index c11820384ad..382281fe3cb 100644 --- a/pkg/test_runner/lib/src/options.dart +++ b/pkg/test_runner/lib/src/options.dart @@ -136,12 +136,10 @@ test options, specifying how tests should be run.''') 'flag with without specifying a named configuration.') ..addFlag('build', help: 'Build the necessary targets to test this configuration') - // TODO(sigmund): rename flag once we migrate all dart2js bots to the test - // matrix. - ..addFlag('host-checked', - aliases: ['host_checked'], + ..addFlag('host-asserts', + aliases: ['host_asserts'], hide: true, - help: 'Run compiler with assertions enabled.') + help: 'Run the compiler with assertions enabled.') ..addFlag('minified', hide: true, help: 'Enable minification in the compiler.') ..addFlag('csp', @@ -153,7 +151,7 @@ test options, specifying how tests should be run.''') help: 'Only run tests that are not marked `Slow` or `Timeout`.') ..addFlag('enable-asserts', aliases: ['enable_asserts'], - help: 'Pass the --enable-asserts flag to dart2js or to the vm.') + help: 'Pass the --enable-asserts flag to the compilers or to the vm.') ..addFlag('use-cfe', aliases: ['use_cfe'], hide: true, @@ -434,7 +432,7 @@ has been specified on the command line.''') 'use-sdk', 'hot-reload', 'hot-reload-rollback', - 'host-checked', + 'host-asserts', 'csp', 'minified', 'vm-options', @@ -811,7 +809,7 @@ has been specified on the command line.''') useSdk: data["use-sdk"] as bool, useHotReload: data["hot-reload"] as bool, useHotReloadRollback: data["hot-reload-rollback"] as bool, - isHostChecked: data["host-checked"] as bool, + enableHostAsserts: data["host-asserts"] as bool, isCsp: data["csp"] as bool, isMinified: data["minified"] as bool, vmOptions: vmOptions, diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status index b7f9bb72216..12c6079bb12 100644 --- a/tests/co19/co19-dart2js.status +++ b/tests/co19/co19-dart2js.status @@ -104,7 +104,7 @@ LibTest/html/Window/animationFrame_A01_t01: SkipByDesign # Issue #53985: request [ $compiler == dart2js && $runtime == d8 ] LibTest/html/*: SkipByDesign # d8 is not a browser -[ $compiler == dart2js && $runtime == d8 && $host_checked ] +[ $compiler == dart2js && $runtime == d8 && $host_asserts ] LibTest/collection/ListBase/ListBase_class_A01_t04: Slow, Pass LibTest/collection/ListBase/ListBase_class_A01_t05: Slow, Pass LibTest/collection/ListBase/ListBase_class_A01_t06: Slow, Pass diff --git a/tests/web/web.status b/tests/web/web.status index 70ddc3ac221..eee708adc17 100644 --- a/tests/web/web.status +++ b/tests/web/web.status @@ -50,7 +50,7 @@ deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loadin internal/object_members_test: SkipByDesign # Uses eval for interop regress/issue/49129_test: SkipByDesign # Uses eval for interop -[ $compiler == dart2js && !$host_checked ] +[ $compiler == dart2js && !$host_asserts ] deferred/many_parts/many_parts_test: Slow, Pass # Large stress test by design dummy_compiler_test: Slow, Pass # Issue 32439. self-hosting doesn't work with CFE yet. @@ -60,7 +60,7 @@ code_motion_exception_test: Skip # Requires unminified operator names. [ $compiler == dart2js && ($runtime == ff || $runtime == jsshell || $runtime == safari) ] code_motion_exception_test: Skip # Required V8 specific format of JavaScript errors. -[ $compiler == dart2js && ($browser || $host_checked) ] +[ $compiler == dart2js && ($browser || $host_asserts) ] dummy_compiler_test: SkipByDesign # Issue 30773. Test should be migrated as a unit test of dart2js, is only intended to test self-hosting. [ $compiler == dartk && $runtime == vm ] diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index bdc3a645ac2..cc0cdbe5798 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -426,20 +426,20 @@ "dart2js-options": [ "--canary" ], - "host-checked": true, + "host-asserts": true, "timeout": 240 } }, "dart2js-hostasserts-linux-d8": { "options": { - "host-checked": true, + "host-asserts": true, "timeout": 240 } }, "dart2js-hostasserts-linux-(d8|chrome)-unsound": { "options": { "builder-tag": "dart2js-weak", - "host-checked": true, + "host-asserts": true, "nnbd": "weak", "timeout": 240 } @@ -450,13 +450,13 @@ "--merge-fragments-threshold=3", "--simple-load-ids" ], - "host-checked": true, + "host-asserts": true, "timeout": 240 } }, "dart2wasm-(linux|mac|win)-(d8|jsshell|jsc|chrome|firefox)": { "options": { - "host-checked": true, + "host-asserts": true, "dart2wasm-options": [ "-O0" ], @@ -468,7 +468,7 @@ "dart2wasm-options": [ "-O1" ], - "host-checked": false, + "host-asserts": false, "timeout": 240 } }, @@ -478,7 +478,7 @@ "-O0", "--js-compatibility" ], - "host-checked": true, + "host-asserts": true, "timeout": 240 } },