Skip to content

Commit 8536b96

Browse files
authored
Terminate flutter test when no longer needed in integration test. (flutter#159117)
Towards flutter#51421. ```sh flutter_tools % dart test test/integration.shard/break_on_framework_exceptions_test.dart 02:38 +29: All tests passed! 54692 ttys003 0:00.02 /opt/homebrew/bin/zsh -il ``` Requires flutter#159115 for the process cleanup to work properly, but this is safe to land as-is, otherwise we still accumulate `flutter` processes over and over as each test case runs which is not WAI.
1 parent c537955 commit 8536b96

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

packages/flutter_tools/test/integration.shard/break_on_framework_exceptions_test.dart

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,29 @@ void main() {
3333

3434
final FlutterTestTestDriver flutter = FlutterTestTestDriver(tempDir);
3535

36-
await _timeoutAfter(
37-
message: 'Timed out launching `flutter test`',
38-
work: () => flutter.test(withDebugger: true, pauseOnExceptions: true),
39-
);
36+
try {
37+
await _timeoutAfter(
38+
message: 'Timed out launching `flutter test`',
39+
work: () => flutter.test(withDebugger: true, pauseOnExceptions: true),
40+
);
4041

41-
await _timeoutAfter(
42-
message: 'Timed out waiting for VM service pause debug event',
43-
work: flutter.waitForPause,
44-
);
42+
await _timeoutAfter(
43+
message: 'Timed out waiting for VM service pause debug event',
44+
work: flutter.waitForPause,
45+
);
4546

46-
int? breakLine;
47-
await _timeoutAfter(
48-
message: 'Timed out getting source location of top stack frame',
49-
work: () async => breakLine = (await flutter.getSourceLocation())?.line,
50-
);
47+
int? breakLine;
48+
await _timeoutAfter(
49+
message: 'Timed out getting source location of top stack frame',
50+
work: () async => breakLine = (await flutter.getSourceLocation())?.line,
51+
);
5152

52-
expect(breakLine, project.lineContaining(project.test, exceptionMessage));
53+
expect(breakLine, project.lineContaining(project.test, exceptionMessage));
54+
} finally {
55+
// Some of the tests will quit naturally, and others won't.
56+
// By this point we don't need the tool anymore, so just force quit.
57+
await flutter.quit();
58+
}
5359
}
5460

5561
testWithoutContext('breaks when AnimationController listener throws', () async {

0 commit comments

Comments
 (0)