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

[ffigen] Fix flaky test #2018

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pkgs/ffigen/test/native_objc_test/block_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,10 @@ void main() {
}
});

var isExited = false;
final isExited = Completer<void>();
late final RawReceivePort exitPort;
exitPort = RawReceivePort((_) {
isExited = true;
isExited.complete();
exitPort.close();
});

Expand Down Expand Up @@ -912,7 +912,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Both blocks are still alive.
expect(isExited, isFalse);
expect(isExited.isCompleted, isFalse);

(await isolateSendPort.future).send('Destroy blkKeepAlive');
await blkKeepAliveDestroyed.future;
Expand All @@ -923,7 +923,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Only blkDontKeepAlive is alive.
expect(isExited, isTrue);
await isExited;

receivePort.close();
}, skip: !canDoGC);
Expand All @@ -942,10 +942,10 @@ void main() {
}
});

var isExited = false;
final isExited = Completer<void>();
late final RawReceivePort exitPort;
exitPort = RawReceivePort((_) {
isExited = true;
isExited.complete();
exitPort.close();
});

Expand Down Expand Up @@ -974,7 +974,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Both blocks are still alive.
expect(isExited, isFalse);
expect(isExited.isCompleted, isFalse);

(await isolateSendPort.future).send('Destroy blkKeepAlive');
await blkKeepAliveDestroyed.future;
Expand All @@ -985,7 +985,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Only blkDontKeepAlive is alive.
expect(isExited, isTrue);
await isExited;

receivePort.close();
}, skip: !canDoGC);
Expand All @@ -1004,10 +1004,10 @@ void main() {
}
});

var isExited = false;
final isExited = Completer<void>();
late final RawReceivePort exitPort;
exitPort = RawReceivePort((_) {
isExited = true;
isExited.complete();
exitPort.close();
});

Expand Down Expand Up @@ -1036,7 +1036,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Both blocks are still alive.
expect(isExited, isFalse);
expect(isExited.isCompleted, isFalse);

(await isolateSendPort.future).send('Destroy blkKeepAlive');
await blkKeepAliveDestroyed.future;
Expand All @@ -1047,7 +1047,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Only blkDontKeepAlive is alive.
expect(isExited, isTrue);
await isExited;

receivePort.close();
}, skip: !canDoGC);
Expand Down
8 changes: 4 additions & 4 deletions pkgs/ffigen/test/native_objc_test/protocol_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,10 @@ void main() {
}
});

var isExited = false;
final isExited = Completer<void>();
late final RawReceivePort exitPort;
exitPort = RawReceivePort((_) {
isExited = true;
isExited.complete();
exitPort.close();
});

Expand Down Expand Up @@ -591,7 +591,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Both blocks are still alive.
expect(isExited, isFalse);
expect(isExited.isCompleted, isFalse);

(await isolateSendPort.future).send('Destroy protoKeepAlive');
await protoKeepAliveDestroyed.future;
Expand All @@ -602,7 +602,7 @@ void main() {
await Future<void>.delayed(Duration.zero); // Let exit message arrive.

// Only protoDontKeepAlive is alive.
expect(isExited, isTrue);
await isExited;

receivePort.close();
}, skip: !canDoGC);
Expand Down
Loading