From 720b9986fbd675f778ab115d36ed7e9cf2b978ba Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 17 Jan 2025 01:56:45 +0000 Subject: [PATCH 1/3] Track the OS for browser platforms We currently do not allow making configuration using tools like `OnPlatform` that is specific to an OS and browser combination. So if there is a situation where tests don't work on firefox on windows, but work everywhere else, we cannot express an intent to skip just the failing tests. In a usage like `OnPlatform({'windows && firefox'})` the selector will never be true because `firefox` and `windows` are mutually exclusive. It does allow cases like `'windows || firefox'` which matches windows VM tests and firefox everywhere. Changing this means a change to how existing selectors are evaluated. CI may be impacted if a package is configuring a skip for an OS expecting only the VM tests to be skipped on that OS with the browser tests still running. Use the new capability to skip a test that is failing on windows firefox browser. --- integration_tests/wasm/test/hello_world_test.dart | 2 ++ pkgs/test_api/lib/src/backend/suite_platform.dart | 3 --- pkgs/test_core/lib/src/util/io.dart | 10 ++++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/integration_tests/wasm/test/hello_world_test.dart b/integration_tests/wasm/test/hello_world_test.dart index 9ddd5116b..a4fab2d3e 100644 --- a/integration_tests/wasm/test/hello_world_test.dart +++ b/integration_tests/wasm/test/hello_world_test.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. @TestOn('wasm') +// TODO: https://github.com/dart-lang/test/issues/2288 +@OnPlatform({'windows && firefox': Skip()}) // This retry is a regression test for https://github.com/dart-lang/test/issues/2006 @Retry(2) library; diff --git a/pkgs/test_api/lib/src/backend/suite_platform.dart b/pkgs/test_api/lib/src/backend/suite_platform.dart index baab6cee1..bdc30892e 100644 --- a/pkgs/test_api/lib/src/backend/suite_platform.dart +++ b/pkgs/test_api/lib/src/backend/suite_platform.dart @@ -38,9 +38,6 @@ final class SuitePlatform { this.os = OperatingSystem.none, this.inGoogle = false}) : compiler = compiler ?? runtime.defaultCompiler { - if (runtime.isBrowser && os != OperatingSystem.none) { - throw ArgumentError('No OS should be passed for runtime "$runtime".'); - } if (!runtime.supportedCompilers.contains(this.compiler)) { throw ArgumentError( 'The platform $runtime does not support the compiler ${this.compiler}'); diff --git a/pkgs/test_core/lib/src/util/io.dart b/pkgs/test_core/lib/src/util/io.dart index a082dd310..fa0cd2994 100644 --- a/pkgs/test_core/lib/src/util/io.dart +++ b/pkgs/test_core/lib/src/util/io.dart @@ -51,10 +51,12 @@ final currentOS = OperatingSystem.findByIoName(Platform.operatingSystem); /// [OperatingSystem.none]. // TODO: https://github.com/dart-lang/test/issues/2119 - require compiler SuitePlatform currentPlatform(Runtime runtime, [Compiler? compiler]) => - SuitePlatform(runtime, - compiler: compiler, - os: runtime.isBrowser ? OperatingSystem.none : currentOS, - inGoogle: inGoogle); + SuitePlatform( + runtime, + compiler: compiler, + os: currentOS, + inGoogle: inGoogle, + ); /// A transformer that decodes bytes using UTF-8 and splits them on newlines. final lineSplitter = StreamTransformer, String>( From faab115c6d0bf2553ea2acde6c2f058924c255af Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 17 Jan 2025 02:06:38 +0000 Subject: [PATCH 2/3] Placeholder version bump --- pkgs/test/CHANGELOG.md | 5 +++++ pkgs/test/pubspec.yaml | 6 +++--- pkgs/test_api/CHANGELOG.md | 2 ++ pkgs/test_api/pubspec.yaml | 2 +- pkgs/test_core/CHANGELOG.md | 2 ++ pkgs/test_core/pubspec.yaml | 4 ++-- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md index ed126365f..7959a1d7e 100644 --- a/pkgs/test/CHANGELOG.md +++ b/pkgs/test/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.25.15-wip + +* Support using the OS platform selector to configure browser tests. + TODO: Longer changelog with potential impacts. + ## 1.25.14 * Use secure random for url secrets. diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index 1c796523b..e9e457797 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 1.25.14 +version: 1.25.15-wip description: >- A full featured library for writing and running Dart tests across platforms. repository: https://github.com/dart-lang/test/tree/master/pkgs/test @@ -35,8 +35,8 @@ dependencies: stream_channel: ^2.1.0 # Use an exact version until the test_api and test_core package are stable. - test_api: 0.7.4 - test_core: 0.6.8 + test_api: 0.7.5 + test_core: 0.6.9 typed_data: ^1.3.0 web_socket_channel: '>=2.0.0 <4.0.0' diff --git a/pkgs/test_api/CHANGELOG.md b/pkgs/test_api/CHANGELOG.md index 98d65baea..4fffa4e05 100644 --- a/pkgs/test_api/CHANGELOG.md +++ b/pkgs/test_api/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.7.5-wip + ## 0.7.4 * Allow `analyzer: '>=6.0.0 <8.0.0'` diff --git a/pkgs/test_api/pubspec.yaml b/pkgs/test_api/pubspec.yaml index af5cb931d..17751fea2 100644 --- a/pkgs/test_api/pubspec.yaml +++ b/pkgs/test_api/pubspec.yaml @@ -1,5 +1,5 @@ name: test_api -version: 0.7.4 +version: 0.7.5-wip description: >- The user facing API for structuring Dart tests and checking expectations. repository: https://github.com/dart-lang/test/tree/master/pkgs/test_api diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index 4c305bc61..5e2553d0c 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.6.9-wip + ## 0.6.8 * Fix hang when running multiple precompiled browser tests. diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml index d08e24ca9..480e03c56 100644 --- a/pkgs/test_core/pubspec.yaml +++ b/pkgs/test_core/pubspec.yaml @@ -1,5 +1,5 @@ name: test_core -version: 0.6.8 +version: 0.6.9-wip description: A basic library for writing tests and running them on the VM. repository: https://github.com/dart-lang/test/tree/master/pkgs/test_core resolution: workspace @@ -27,7 +27,7 @@ dependencies: stack_trace: ^1.10.0 stream_channel: ^2.1.0 # Use an exact version until the test_api package is stable. - test_api: 0.7.4 + test_api: 0.7.5 vm_service: ">=6.0.0 <16.0.0" yaml: ^3.0.0 From 0567638caf1539a51a4e13fd567a1ab7482f7740 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 17 Jan 2025 02:11:11 +0000 Subject: [PATCH 3/3] Apparently we have to specify -wip versions in pubspec for the workspace? --- pkgs/test/pubspec.yaml | 4 ++-- pkgs/test_core/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index e9e457797..8a27b9b22 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml @@ -35,8 +35,8 @@ dependencies: stream_channel: ^2.1.0 # Use an exact version until the test_api and test_core package are stable. - test_api: 0.7.5 - test_core: 0.6.9 + test_api: 0.7.5-wip + test_core: 0.6.9-wip typed_data: ^1.3.0 web_socket_channel: '>=2.0.0 <4.0.0' diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml index 480e03c56..0516fbd77 100644 --- a/pkgs/test_core/pubspec.yaml +++ b/pkgs/test_core/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: stack_trace: ^1.10.0 stream_channel: ^2.1.0 # Use an exact version until the test_api package is stable. - test_api: 0.7.5 + test_api: 0.7.5-wip vm_service: ">=6.0.0 <16.0.0" yaml: ^3.0.0