OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import shutil | 7 import shutil |
8 import sys | 8 import sys |
9 import tempfile | 9 import tempfile |
10 | 10 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 for repeat_id in xrange(self.repeat): | 247 for repeat_id in xrange(self.repeat): |
248 self._RunUrl(run_id=repeat_id) | 248 self._RunUrl(run_id=repeat_id) |
249 finally: | 249 finally: |
250 if self._local_cache_directory_path: | 250 if self._local_cache_directory_path: |
251 shutil.rmtree(self._local_cache_directory_path) | 251 shutil.rmtree(self._local_cache_directory_path) |
252 self._local_cache_directory_path = None | 252 self._local_cache_directory_path = None |
253 if self.cache_operation == CacheOperation.SAVE: | 253 if self.cache_operation == CacheOperation.SAVE: |
254 self._PullCacheFromDevice() | 254 self._PullCacheFromDevice() |
255 | 255 |
256 self._chrome_ctl = None | 256 self._chrome_ctl = None |
| 257 |
| 258 |
| 259 def WalkRepeatedRuns(runner_output_dir): |
| 260 """Yields unordered (repeat id, path of the repeat directory). |
| 261 |
| 262 Args: |
| 263 runner_output_dir: Same as for SandwichRunner.output_dir. |
| 264 """ |
| 265 repeated_run_count = 0 |
| 266 for node_name in os.listdir(runner_output_dir): |
| 267 repeat_dir = os.path.join(runner_output_dir, node_name) |
| 268 if not os.path.isdir(repeat_dir): |
| 269 continue |
| 270 try: |
| 271 repeat_id = int(node_name) |
| 272 except ValueError: |
| 273 continue |
| 274 yield repeat_id, repeat_dir |
| 275 repeated_run_count += 1 |
| 276 assert repeated_run_count > 0, ('Error: not a sandwich runner output ' |
| 277 'directory: {}').format(runner_output_dir) |
OLD | NEW |