From 720b9986fbd675f778ab115d36ed7e9cf2b978ba Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 17 Jan 2025 01:56:45 +0000 Subject: [PATCH] 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>(