Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable windows for the unit_tests in the test package #1612

Merged
merged 11 commits into from
Oct 25, 2021
226 changes: 168 additions & 58 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion pkgs/test/dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ tags:
add_tags: [browser]
timeout: 2x

firefox: {add_tags: [dart2js]}
firefox:
add_tags: [dart2js]
test_on: linux
chrome: {add_tags: [dart2js]}

safari:
Expand All @@ -40,6 +42,7 @@ tags:
ie:
add_tags: [dart2js]
test_on: windows
skip: https://github.com/dart-lang/test/issues/1614

# Tests that run pub. These tests may need to be excluded when there are local
# dependency_overrides.
Expand All @@ -50,3 +53,4 @@ tags:
# don't have Node installed.
node:
timeout: 2x
test_on: linux
27 changes: 27 additions & 0 deletions pkgs/test/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,36 @@ stages:
- analyze: --fatal-infos
dart:
- dev
os:
- linux
- unit_test:
- command: xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 0
- command: xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 1
- command: xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 2
- command: xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 3
- command: xvfb-run -s "-screen 0 1024x768x24" dart test --preset travis --total-shards 5 --shard-index 4
- command: dart test --preset travis --total-shards 5 --shard-index 0
os:
- windows
dart:
- stable
- command: dart test --preset travis --total-shards 5 --shard-index 1
os:
- windows
dart:
- stable
- command: dart test --preset travis --total-shards 5 --shard-index 2
os:
- windows
dart:
- stable
- command: dart test --preset travis --total-shards 5 --shard-index 3
os:
- windows
dart:
- stable
- command: dart test --preset travis --total-shards 5 --shard-index 4
os:
- windows
dart:
- stable
3 changes: 2 additions & 1 deletion pkgs/test/test/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ final Future<String> packageDir =
Isolate.resolvePackageUri(Uri(scheme: 'package', path: 'test/'))
.then((uri) {
var dir = p.dirname(uri!.path);
if (dir.startsWith('/C:')) dir = dir.substring(1);
// If it starts with a `/C:` or other drive letter, remove the leading `/`.
if (dir[0] == '/' && dir[2] == ':') dir = dir.substring(1);
return dir;
});

Expand Down
13 changes: 9 additions & 4 deletions pkgs/test/test/runner/configuration/platform_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
import 'dart:convert';
import 'dart:io';

import 'package:test_descriptor/test_descriptor.dart' as d;

Expand Down Expand Up @@ -205,8 +206,10 @@ void main() {
var test = await runTest(['.']);
expect(
test.stdout,
containsInOrder(
['+0: ./test_foo.dart: test_foo', '+1: All tests passed!']));
containsInOrder([
'+0: .${Platform.pathSeparator}test_foo.dart: test_foo',
'+1: All tests passed!'
]));
await test.shouldExit(0);
});

Expand Down Expand Up @@ -241,8 +244,10 @@ void main() {
var test = await runTest(['.']);
expect(
test.stdout,
containsInOrder(
['+0: ./foo_test.dart: foo_test', '+1: All tests passed!']));
containsInOrder([
'+0: .${Platform.pathSeparator}foo_test.dart: foo_test',
'+1: All tests passed!'
]));
await test.shouldExit(0);
});

Expand Down
13 changes: 7 additions & 6 deletions pkgs/test/test/runner/configuration/randomize_order_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@TestOn('vm')
import 'dart:convert';
import 'dart:io';

import 'package:test_descriptor/test_descriptor.dart' as d;

Expand Down Expand Up @@ -148,14 +149,14 @@ void main() {
test.stdout,
emitsInAnyOrder([
containsInOrder([
'./1_test.dart: test 1.2',
'./1_test.dart: test 1.3',
'./1_test.dart: test 1.1'
'.${Platform.pathSeparator}1_test.dart: test 1.2',
'.${Platform.pathSeparator}1_test.dart: test 1.3',
'.${Platform.pathSeparator}1_test.dart: test 1.1'
]),
containsInOrder([
'./2_test.dart: test 2.2',
'./2_test.dart: test 2.3',
'./2_test.dart: test 2.1'
'.${Platform.pathSeparator}2_test.dart: test 2.2',
'.${Platform.pathSeparator}2_test.dart: test 2.3',
'.${Platform.pathSeparator}2_test.dart: test 2.1'
]),
contains('+6: All tests passed!')
]));
Expand Down
4 changes: 3 additions & 1 deletion pkgs/test/test/runner/configuration/top_level_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ void main() {
await expectLater(
test.stdout, emitsThrough(contains('+1: All tests passed!')));
await test.shouldExit(0);
}, tags: 'chrome');
}, tags: 'chrome', onPlatform: const {
'windows': Skip('https://github.com/dart-lang/test/issues/1613')
});

test('runs skipped tests with run_skipped: true', () async {
await d.file('dart_test.yaml', jsonEncode({'run_skipped': true})).create();
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test/test/runner/hybrid_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

@TestOn('vm')
@OnPlatform({'windows': Skip('https://github.com/dart-lang/test/issues/1618')})

import 'dart:io';
import 'dart:isolate';
Expand Down Expand Up @@ -90,7 +91,7 @@ void main() {

void hybridMain(StreamChannel channel) {
channel.sink
..add(File("$path").readAsStringSync())
..add(File(r"$path").readAsStringSync())
..close();
}
""").stream.first, completion(contains("hybrid emits numbers")));
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/test/runner/name_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void main() {

var test = await runTest(['test.dart?name=selected&full-name=selected 1']);

await test.shouldExit(255);
await test.shouldExit(64);
});

group('with the --name flag,', () {
Expand Down
1 change: 1 addition & 0 deletions pkgs/test/test/runner/pause_after_load_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

@TestOn('vm')
@OnPlatform({'windows': Skip('https://github.com/dart-lang/test/issues/1613')})

import 'dart:async';
import 'dart:io';
Expand Down
14 changes: 9 additions & 5 deletions pkgs/test/test/runner/precompiled_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('vm')
@OnPlatform({'windows': Skip('https://github.com/dart-lang/test/issues/1617')})

import 'dart:async';
import 'dart:io';
import 'dart:isolate';
Expand All @@ -13,7 +15,6 @@ import 'package:path/path.dart' as p;
import 'package:test_descriptor/test_descriptor.dart' as d;
import 'package:test_process/test_process.dart';

import 'package:test_core/src/util/io.dart';
import 'package:test/test.dart';
import 'package:test/src/util/package_map.dart';

Expand Down Expand Up @@ -46,10 +47,12 @@ void main() {
]).create();

var dart2js = await TestProcess.start(
p.join(sdkDir, 'bin', 'dart2js'),
Platform.resolvedExecutable,
[
'compile',
'js',
...Platform.executableArguments,
'--packages=${await Isolate.packageConfig}',
'--packages=${(await Isolate.packageConfig)!.toFilePath()}',
'to_precompile.dart',
'--out=precompiled/test.dart.browser_test.dart.js'
],
Expand Down Expand Up @@ -104,9 +107,10 @@ void main() {

var jsPath = p.join(d.sandbox, 'test', 'test.dart.node_test.dart.js');
var dart2js = await TestProcess.start(
p.join(sdkDir, 'bin', 'dart2js'),
Platform.resolvedExecutable,
[
...Platform.executableArguments,
'compile',
'js',
'--packages=${await Isolate.packageConfig}',
p.join('test', 'test.dart'),
'--out=$jsPath',
Expand Down
2 changes: 2 additions & 0 deletions pkgs/test/test/runner/runner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ void main(List<String> args) async {
])));
await test.shouldExit(0);
});
}, onPlatform: const {
'windows': Skip('https://github.com/dart-lang/test/issues/1615')
});

group('nnbd', () {
Expand Down
38 changes: 26 additions & 12 deletions pkgs/test/test/runner/shard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

@TestOn('vm')

import 'dart:io';

import 'package:test_descriptor/test_descriptor.dart' as d;

import 'package:test_core/src/util/exit_codes.dart' as exit_codes;
Expand Down Expand Up @@ -94,10 +96,14 @@ void main() {
test.stdout,
emitsInOrder([
emitsAnyOf([
containsInOrder(
['+0: ./1_test.dart: test 1.1', '+1: ./2_test.dart: test 2.1']),
containsInOrder(
['+0: ./2_test.dart: test 2.1', '+1: ./1_test.dart: test 1.1'])
containsInOrder([
'+0: .${Platform.pathSeparator}1_test.dart: test 1.1',
'+1: .${Platform.pathSeparator}2_test.dart: test 2.1'
]),
containsInOrder([
'+0: .${Platform.pathSeparator}2_test.dart: test 2.1',
'+1: .${Platform.pathSeparator}1_test.dart: test 1.1'
])
]),
contains('+2: All tests passed!')
]));
Expand All @@ -108,10 +114,14 @@ void main() {
test.stdout,
emitsInOrder([
emitsAnyOf([
containsInOrder(
['+0: ./1_test.dart: test 1.2', '+1: ./2_test.dart: test 2.2']),
containsInOrder(
['+0: ./2_test.dart: test 2.2', '+1: ./1_test.dart: test 1.2'])
containsInOrder([
'+0: .${Platform.pathSeparator}1_test.dart: test 1.2',
'+1: .${Platform.pathSeparator}2_test.dart: test 2.2'
]),
containsInOrder([
'+0: .${Platform.pathSeparator}2_test.dart: test 2.2',
'+1: .${Platform.pathSeparator}1_test.dart: test 1.2'
])
]),
contains('+2: All tests passed!')
]));
Expand All @@ -122,10 +132,14 @@ void main() {
test.stdout,
emitsInOrder([
emitsAnyOf([
containsInOrder(
['+0: ./1_test.dart: test 1.3', '+1: ./2_test.dart: test 2.3']),
containsInOrder(
['+0: ./2_test.dart: test 2.3', '+1: ./1_test.dart: test 1.3'])
containsInOrder([
'+0: .${Platform.pathSeparator}1_test.dart: test 1.3',
'+1: .${Platform.pathSeparator}2_test.dart: test 2.3'
]),
containsInOrder([
'+0: .${Platform.pathSeparator}2_test.dart: test 2.3',
'+1: .${Platform.pathSeparator}1_test.dart: test 1.3'
])
]),
contains('+2: All tests passed!')
]));
Expand Down
34 changes: 27 additions & 7 deletions tool/ci.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.