Unconditionally shut down the resident frontend server after each VM Service test run that uses it

Change-Id: I67af9d4813a5b9e7a3b425bb8dc3394923f9a90d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403400
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/vm_service/test/common/test_helper.dart b/pkg/vm_service/test/common/test_helper.dart
index c699f7f..9604c37 100644
--- a/pkg/vm_service/test/common/test_helper.dart
+++ b/pkg/vm_service/test/common/test_helper.dart
@@ -364,6 +364,16 @@
     });
 
     final exitCode = await process.exitCode;
+    if (shouldTesteeBeLaunchedWithDartRunResident) {
+      print(
+        '** Shutting down resident frontend compiler that was used by VM '
+        'Service tests',
+      );
+      await io.Process.run(
+        io.Platform.executable,
+        ['compilation-server', 'shutdown'],
+      );
+    }
     if (exitCode != 0) {
       if (!(process.killedByTester || allowForNonZeroExitCode)) {
         throw 'Testee exited with unexpected exitCode: $exitCode';