OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 datetime | 5 import datetime |
6 import functools | 6 import functools |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import shutil | 9 import shutil |
10 import tempfile | 10 import tempfile |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 self._devices = None | 87 self._devices = None |
88 self._concurrent_adb = args.enable_concurrent_adb | 88 self._concurrent_adb = args.enable_concurrent_adb |
89 self._enable_device_cache = args.enable_device_cache | 89 self._enable_device_cache = args.enable_device_cache |
90 self._logcat_monitors = [] | 90 self._logcat_monitors = [] |
91 self._logcat_output_dir = args.logcat_output_dir | 91 self._logcat_output_dir = args.logcat_output_dir |
92 self._logcat_output_file = args.logcat_output_file | 92 self._logcat_output_file = args.logcat_output_file |
93 self._max_tries = 1 + args.num_retries | 93 self._max_tries = 1 + args.num_retries |
94 self._skip_clear_data = args.skip_clear_data | 94 self._skip_clear_data = args.skip_clear_data |
95 self._target_devices_file = args.target_devices_file | 95 self._target_devices_file = args.target_devices_file |
96 self._tool_name = args.tool | 96 self._tool_name = args.tool |
97 self._trace_output = args.trace_output | 97 self._trace_output = None |
| 98 if hasattr(args, 'trace_output'): |
| 99 self._trace_output = args.trace_output |
98 | 100 |
99 devil_chromium.Initialize( | 101 devil_chromium.Initialize( |
100 output_directory=constants.GetOutDirectory(), | 102 output_directory=constants.GetOutDirectory(), |
101 adb_path=args.adb_path) | 103 adb_path=args.adb_path) |
102 | 104 |
103 # Some things such as Forwarder require ADB to be in the environment path. | 105 # Some things such as Forwarder require ADB to be in the environment path. |
104 adb_dir = os.path.dirname(adb_wrapper.AdbWrapper.GetAdbPath()) | 106 adb_dir = os.path.dirname(adb_wrapper.AdbWrapper.GetAdbPath()) |
105 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | 107 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
106 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | 108 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
107 | 109 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 else: | 270 else: |
269 trace_event.trace_disable() | 271 trace_event.trace_disable() |
270 self._JsonToTrace(self._trace_output + '.json', | 272 self._JsonToTrace(self._trace_output + '.json', |
271 self._trace_output) | 273 self._trace_output) |
272 | 274 |
273 def EnableTracing(self): | 275 def EnableTracing(self): |
274 if trace_event.trace_is_enabled(): | 276 if trace_event.trace_is_enabled(): |
275 logging.warning('Tracing is already running.') | 277 logging.warning('Tracing is already running.') |
276 else: | 278 else: |
277 trace_event.trace_enable(self._trace_output + '.json') | 279 trace_event.trace_enable(self._trace_output + '.json') |
OLD | NEW |