[vm/concurrency] Print something periodically to prevent bot from dying due to no-output

TEST=Attempt at fixing "iso-stress-linux" builder infra failure.

Change-Id: I81b23d78bf7401cf41f54a0b6e28cfbd1fc5a304
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200424
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
diff --git a/runtime/tests/concurrency/run_stress_test_shards.dart b/runtime/tests/concurrency/run_stress_test_shards.dart
index e719c4a..3157880 100644
--- a/runtime/tests/concurrency/run_stress_test_shards.dart
+++ b/runtime/tests/concurrency/run_stress_test_shards.dart
@@ -124,13 +124,24 @@
   final shards = int.parse(options['shards']);
   final shard = int.parse(options['shard']) - 1;
 
-  final thisShardsConfigurations = [];
-  for (int i = 0; i < configurations.length; i++) {
-    if ((i % shards) == shard) {
-      thisShardsConfigurations.add(configurations[i]);
+  // Tasks will eventually be killed if they do not have any output for some
+  // time. So we'll explicitly print something every 4 minutes.
+  final sw = Stopwatch()..start();
+  final timer = Timer.periodic(const Duration(minutes: 4), (_) {
+    print('[${sw.elapsed}] ... still working ...');
+  });
+
+  try {
+    final thisShardsConfigurations = [];
+    for (int i = 0; i < configurations.length; i++) {
+      if ((i % shards) == shard) {
+        thisShardsConfigurations.add(configurations[i]);
+      }
     }
-  }
-  for (final config in thisShardsConfigurations) {
-    await config.runTest();
+    for (final config in thisShardsConfigurations) {
+      await config.runTest();
+    }
+  } finally {
+    timer.cancel();
   }
 }