Skip to content

Commit d8a0918

Browse files
authored
Remove hard exit hack (#1280)
Closes #599 Close `ReceivePort` instances that are passed to spawned isolated. This resolves at least one cause of the test runner hanging. Drop support for and usage of the `FORCE_TEST_EXIT` environment.
1 parent b8bac52 commit d8a0918

File tree

10 files changed

+13
-14
lines changed

10 files changed

+13
-14
lines changed

.github/workflows/dart.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ defaults:
1313
shell: bash
1414
env:
1515
PUB_ENVIRONMENT: bot.github
16-
FORCE_TEST_EXIT: true
1716

1817
jobs:
1918
job_001:

mono_repo.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
self_validate: analyze_and_format
33

44
github:
5-
env:
6-
FORCE_TEST_EXIT: true
75
# Setting just `cron` keeps the defaults for `push` and `pull_request`
86
cron: '0 0 * * 0' # “At 00:00 (UTC) on Sunday.”
97
on_completion:

pkgs/test/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 1.17.10-dev
2+
13
## 1.17.9
24

35
* Fix a bug where a tag level configuration would cause test suites with that

pkgs/test/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: test
2-
version: 1.17.9
2+
version: 1.17.10-dev
33
description: >-
44
A full featured library for writing and running Dart tests across platforms.
55
repository: https://github.com/dart-lang/test/blob/master/pkgs/test
@@ -34,7 +34,7 @@ dependencies:
3434
yaml: ^3.0.0
3535
# Use an exact version until the test_api and test_core package are stable.
3636
test_api: 0.4.1
37-
test_core: 0.3.29
37+
test_core: 0.3.30
3838

3939
dev_dependencies:
4040
fake_async: ^1.0.0

pkgs/test/test/runner/runner_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,7 @@ void main(List<String> args) async {
714714
test.completeShutdown();
715715
}''').create();
716716
var test = await runDart(['runner.dart', '--no-color', '--', 'test.dart'],
717-
description: 'dart runner.dart -- test.dart',
718-
environment: {'FORCE_TEST_EXIT': 'false'});
717+
description: 'dart runner.dart -- test.dart');
719718
expect(
720719
test.stdout,
721720
emitsThrough(containsInOrder([

pkgs/test_core/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.30-dev
2+
3+
* Remove support for `FORCE_TEST_EXIT`.
4+
15
## 0.3.29
26

37
* Fix a bug where a tag level configuration would cause test suites with that

pkgs/test_core/lib/src/executable.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ Future<void> _execute(List<String> args) async {
166166
await runner?.close();
167167
}
168168

169-
// TODO(grouma) - figure out why the executable can hang in the travis
170-
// environment. https://github.com/dart-lang/test/issues/599
171-
if (Platform.environment['FORCE_TEST_EXIT'] == 'true') {
172-
exit(exitCode);
173-
}
174-
175169
return;
176170
}
177171

pkgs/test_core/lib/src/runner/spawn_hybrid.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ StreamChannel spawnHybridUri(String url, Object? message, Suite suite) {
5454
var disconnector = Disconnector();
5555
onExitPort.listen((_) {
5656
disconnector.disconnect();
57+
port.close();
5758
onExitPort.close();
5859
});
5960

@@ -62,6 +63,7 @@ StreamChannel spawnHybridUri(String url, Object? message, Suite suite) {
6263
.transformSink(StreamSinkTransformer.fromHandlers(handleDone: (sink) {
6364
// If the user closes the stream channel, kill the isolate.
6465
isolate.kill();
66+
port.close();
6567
onExitPort.close();
6668
sink.close();
6769
}));

pkgs/test_core/lib/src/runner/vm/platform.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class VMPlatform extends PlatformPlugin {
6363
StreamSubscription<Event>? eventSub;
6464
var channel = IsolateChannel.connectReceive(receivePort)
6565
.transformStream(StreamTransformer.fromHandlers(handleDone: (sink) {
66+
receivePort.close();
6667
isolate!.kill();
6768
eventSub?.cancel();
6869
client?.dispose();

pkgs/test_core/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: test_core
2-
version: 0.3.29
2+
version: 0.3.30-dev
33
description: A basic library for writing tests and running them on the VM.
44
homepage: https://github.com/dart-lang/test/blob/master/pkgs/test_core
55

0 commit comments

Comments
 (0)