| 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 collections | 5 import collections |
| 6 import io | 6 import io |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import pickle | 10 import pickle |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 logging.info('%d files in the output dir were archived.', num_files) | 199 logging.info('%d files in the output dir were archived.', num_files) |
| 200 else: | 200 else: |
| 201 logging.warning('No files in the output dir. Archive is empty.') | 201 logging.warning('No files in the output dir. Archive is empty.') |
| 202 return archive.getvalue() | 202 return archive.getvalue() |
| 203 | 203 |
| 204 @staticmethod | 204 @staticmethod |
| 205 def _SaveResult(result): | 205 def _SaveResult(result): |
| 206 pickled = os.path.join(constants.PERF_OUTPUT_DIR, result['name']) | 206 pickled = os.path.join(constants.PERF_OUTPUT_DIR, result['name']) |
| 207 if os.path.exists(pickled): | 207 if os.path.exists(pickled): |
| 208 with file(pickled, 'r') as f: | 208 with file(pickled, 'r') as f: |
| 209 previous = pickle.loads(f.read()) | 209 previous = pickle.load(f) |
| 210 result['output'] = previous['output'] + result['output'] | 210 result['output'] = previous['output'] + result['output'] |
| 211 with file(pickled, 'w') as f: | 211 with file(pickled, 'w') as f: |
| 212 f.write(pickle.dumps(result)) | 212 pickle.dump(result, f) |
| 213 | 213 |
| 214 def _TestTearDown(self): | 214 def _TestTearDown(self): |
| 215 if self._output_dir: | 215 if self._output_dir: |
| 216 shutil.rmtree(self._output_dir, ignore_errors=True) | 216 shutil.rmtree(self._output_dir, ignore_errors=True) |
| 217 self._output_dir = None | 217 self._output_dir = None |
| 218 self._heart_beat.Stop() | 218 self._heart_beat.Stop() |
| 219 self._current_test = None | 219 self._current_test = None |
| 220 | 220 |
| 221 @property | 221 @property |
| 222 def current_test(self): | 222 def current_test(self): |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 # override | 529 # override |
| 530 def _RunTest(self, _device, _test): | 530 def _RunTest(self, _device, _test): |
| 531 raise NotImplementedError | 531 raise NotImplementedError |
| 532 | 532 |
| 533 | 533 |
| 534 class TestDictVersionError(Exception): | 534 class TestDictVersionError(Exception): |
| 535 pass | 535 pass |
| 536 | 536 |
| 537 class PerfTestRunGetStepsError(Exception): | 537 class PerfTestRunGetStepsError(Exception): |
| 538 pass | 538 pass |
| OLD | NEW |