Index: tools/android/loading/sandwich_runner.py |
diff --git a/tools/android/loading/sandwich_runner.py b/tools/android/loading/sandwich_runner.py |
index fb48b7cb0144d014b9fcbb47942cdcbf52289c6a..834d286a3d707d53b3b4b7302511f0718d9e42d2 100644 |
--- a/tools/android/loading/sandwich_runner.py |
+++ b/tools/android/loading/sandwich_runner.py |
@@ -254,3 +254,24 @@ class SandwichRunner(object): |
self._PullCacheFromDevice() |
self._chrome_ctl = None |
+ |
+ |
+def WalkRepeatedRuns(runner_output_dir): |
+ """Yields unordered repeat_id, repeat_dir. |
+ |
+ Args: |
+ runner_output_dir: Same as for SandwichRunner.output_dir. |
+ """ |
+ repeated_run_count = 0 |
+ for node_name in os.listdir(runner_output_dir): |
+ repeat_dir = os.path.join(runner_output_dir, node_name) |
+ if not os.path.isdir(repeat_dir): |
+ continue |
+ try: |
+ repeat_id = int(node_name) |
+ except ValueError: |
+ continue |
+ yield repeat_id, repeat_dir |
+ repeated_run_count += 1 |
+ assert repeated_run_count > 0, ('Error: not a sandwich runner output ' |
+ 'directory: {}').format(runner_output_dir) |