OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import collections | 7 import collections |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 if not results: | 221 if not results: |
222 return | 222 return |
223 if results.DidRunPass(): | 223 if results.DidRunPass(): |
224 self.TearDownPerfMonitoring(test) | 224 self.TearDownPerfMonitoring(test) |
225 | 225 |
226 if self.coverage_dir: | 226 if self.coverage_dir: |
227 self.device.PullFile( | 227 self.device.PullFile( |
228 self.coverage_device_file, self.coverage_host_file) | 228 self.coverage_device_file, self.coverage_host_file) |
229 self.device.RunShellCommand( | 229 self.device.RunShellCommand( |
230 'rm -f %s' % self.coverage_device_file) | 230 'rm -f %s' % self.coverage_device_file) |
231 elif self.package_info: | 231 elif self.package_info and not self.options.skip_clear_data: |
232 self.device.ClearApplicationState(self.package_info.package) | 232 self.device.ClearApplicationState(self.package_info.package) |
233 | 233 |
234 def TearDownPerfMonitoring(self, test): | 234 def TearDownPerfMonitoring(self, test): |
235 """Cleans up performance monitoring if the specified test required it. | 235 """Cleans up performance monitoring if the specified test required it. |
236 | 236 |
237 Args: | 237 Args: |
238 test: The name of the test that was just run. | 238 test: The name of the test that was just run. |
239 Raises: | 239 Raises: |
240 Exception: if there's anything wrong with the perf data. | 240 Exception: if there's anything wrong with the perf data. |
241 """ | 241 """ |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 result_name, ' '.join(flag_modifiers.add)) | 411 result_name, ' '.join(flag_modifiers.add)) |
412 if flag_modifiers.remove: | 412 if flag_modifiers.remove: |
413 result_name = '%s without {%s}' % ( | 413 result_name = '%s without {%s}' % ( |
414 result_name, ' '.join(flag_modifiers.remove)) | 414 result_name, ' '.join(flag_modifiers.remove)) |
415 result.SetName(result_name) | 415 result.SetName(result_name) |
416 results.AddResult(result) | 416 results.AddResult(result) |
417 | 417 |
418 self.TestTeardown(test, results) | 418 self.TestTeardown(test, results) |
419 | 419 |
420 return (results, None if results.DidRunPass() else test) | 420 return (results, None if results.DidRunPass() else test) |
OLD | NEW |