Kill compiler process when test does not exit cleanly (#34616)

This commit is contained in:
Jenn Magder 2019-06-18 11:24:19 -07:00 committed by GitHub
parent cc541e6724
commit 8be46a0c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -738,6 +738,7 @@ class ResidentCompiler {
if (_server == null) {
return 0;
}
printTrace('killing pid ${_server.pid}');
_server.kill();
return _server.exitCode;
}

View File

@ -85,6 +85,7 @@ class TestCompiler {
Future<void> dispose() async {
await compilerController.close();
await _shutdown();
}
/// Create the resident compiler used to compile the test.

View File

@ -59,6 +59,15 @@ void main() {
expect(await testCompiler.compile('test/foo.dart'), null);
expect(fs.file('test/foo.dart.dill').existsSync(), false);
verify(residentCompiler.shutdown()).called(1);
}));
test('Disposing test compiler shuts down backing compiler', () => testbed.run(() async {
testCompiler.compiler = residentCompiler;
expect(testCompiler.compilerController.isClosed, false);
await testCompiler.dispose();
expect(testCompiler.compilerController.isClosed, true);
verify(residentCompiler.shutdown()).called(1);
}));
});
}