Add periodic output to test.py so test infrastructure doesn't time out.

Every 5 minutes, test.py prints a status update.

Change-Id: Id11d9e4a01a94dc8515a7e2d1df4f3d417998cc1
Reviewed-on: https://dart-review.googlesource.com/75262
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
diff --git a/tools/testing/dart/test_configurations.dart b/tools/testing/dart/test_configurations.dart
index b963cec..05c85c8 100644
--- a/tools/testing/dart/test_configurations.dart
+++ b/tools/testing/dart/test_configurations.dart
@@ -223,6 +223,9 @@
       eventListener.add(new TimingPrinter(startTime));
     }
     eventListener.add(new SkippedCompilationsPrinter());
+    if (progressIndicator == Progress.status) {
+      eventListener.add(new TimedProgressPrinter());
+    }
   }
 
   if (firstConf.writeTestOutcomeLog) {
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index 7ba27a0..bdb8a0b 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -2,6 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:async';
 import 'dart:convert';
 import 'dart:io';
 
@@ -67,6 +68,33 @@
   }
 }
 
+class TimedProgressPrinter extends EventListener {
+  static const interval = Duration(minutes: 5);
+  int _numTests = 0;
+  int _numCompleted = 0;
+  bool _allKnown = false;
+  Timer _timer;
+
+  TimedProgressPrinter() {
+    _timer = Timer.periodic(interval, callback);
+  }
+
+  void callback(Timer timer) {
+    if (_allKnown) {
+      print('$_numCompleted out of $_numTests completed');
+    }
+    print("Tests running for ${(interval * timer.tick).inMinutes} minutes");
+  }
+
+  void testAdded() => _numTests++;
+
+  void done(TestCase test) => _numCompleted++;
+
+  void allTestsKnown() => _allKnown = true;
+
+  void allDone() => _timer.cancel();
+}
+
 class IgnoredTestMonitor extends EventListener {
   static final int maxIgnored = 10;