Skip to content

Commit

Permalink
Track the OS for browser platforms
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
natebosch committed Jan 17, 2025
1 parent f364fc8 commit 720b998
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions integration_tests/wasm/test/hello_world_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions pkgs/test_api/lib/src/backend/suite_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
Expand Down
10 changes: 6 additions & 4 deletions pkgs/test_core/lib/src/util/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<int>, String>(
Expand Down

0 comments on commit 720b998

Please sign in to comment.