Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: build/android/tombstones.py

Issue 2201833002: Added tombstones in instrumentation tests results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« build/android/test_runner.py ('K') | « build/android/test_runner.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # Find the most recent tombstone file(s) on all connected devices 7 # Find the most recent tombstone file(s) on all connected devices
8 # and prints their stacks. 8 # and prints their stacks.
9 # 9 #
10 # Assumes tombstone file was created with current symbols. 10 # Assumes tombstone file was created with current symbols.
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 logging.info('%s: %s', str(device), entry) 205 logging.info('%s: %s', str(device), entry)
206 raise 206 raise
207 207
208 # Erase all the tombstones if desired. 208 # Erase all the tombstones if desired.
209 if args.wipe_tombstones: 209 if args.wipe_tombstones:
210 for tombstone_file, _ in all_tombstones: 210 for tombstone_file, _ in all_tombstones:
211 _EraseTombstone(device, tombstone_file) 211 _EraseTombstone(device, tombstone_file)
212 212
213 return ret 213 return ret
214 214
215 def _clearAllTombstones(device):
jbudorick 2016/08/01 17:39:18 nit: _ClearAllTombstones
BigBossZhiling 2016/08/01 22:35:13 Done.
216 """Clear all tombstones in the device..
jbudorick 2016/08/01 17:39:18 nit: only one . at the end
BigBossZhiling 2016/08/01 22:35:13 Done.
217
218 Args:
219 device: An instance of DeviceUtils.
220 """
221 all_tombstones = list(_ListTombstones(device))
222 if not all_tombstones:
223 logging.warning('No tombstones.')
224
225 for tombstone_file, _ in all_tombstones:
226 _EraseTombstone(device, tombstone_file)
215 227
216 def main(): 228 def main():
217 custom_handler = logging.StreamHandler(sys.stdout) 229 custom_handler = logging.StreamHandler(sys.stdout)
218 custom_handler.setFormatter(run_tests_helper.CustomFormatter()) 230 custom_handler.setFormatter(run_tests_helper.CustomFormatter())
219 logging.getLogger().addHandler(custom_handler) 231 logging.getLogger().addHandler(custom_handler)
220 logging.getLogger().setLevel(logging.INFO) 232 logging.getLogger().setLevel(logging.INFO)
221 233
222 parser = argparse.ArgumentParser() 234 parser = argparse.ArgumentParser()
223 parser.add_argument('--device', 235 parser.add_argument('--device',
224 help='The serial number of the device. If not specified ' 236 help='The serial number of the device. If not specified '
225 'will use all devices.') 237 'will use all devices.')
226 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') 238 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
227 parser.add_argument('-a', '--all-tombstones', action='store_true', 239 parser.add_argument('-a', '--all-tombstones', action='store_true',
228 help='Resolve symbols for all tombstones, rather than ' 240 help='Resolve symbols for all tombstones, rather than '
229 'just the most recent.') 241 'just the most recent.')
230 parser.add_argument('-s', '--stack', action='store_true', 242 parser.add_argument('-s', '--stack', action='store_true',
231 help='Also include symbols for stack data') 243 help='Also include symbols for stack data')
232 parser.add_argument('-w', '--wipe-tombstones', action='store_true', 244 parser.add_argument('-w', '--wipe-tombstones', action='store_true',
233 help='Erase all tombstones from device after processing') 245 help='Erase all tombstones from device after processing')
234 parser.add_argument('-j', '--jobs', type=int, 246 parser.add_argument('-j', '--jobs', type=int,
235 default=4, 247 default=4,
236 help='Number of jobs to use when processing multiple ' 248 help='Number of jobs to use when processing multiple '
237 'crash stacks.') 249 'crash stacks.')
238 parser.add_argument('--output-directory', 250 parser.add_argument('--output-directory',
239 help='Path to the root build directory.') 251 help='Path to the root build directory.')
240 parser.add_argument('--adb-path', type=os.path.abspath, 252 parser.add_argument('--adb-path', type=os.path.abspath,
241 help='Path to the adb binary.') 253 help='Path to the adb binary.')
254 parser.add_argument('--erase-all-with-noprocess', action='store_true',
255 help='Erase all tombstones without doing any process.')
242 args = parser.parse_args() 256 args = parser.parse_args()
243 257
244 devil_chromium.Initialize(adb_path=args.adb_path) 258 devil_chromium.Initialize(adb_path=args.adb_path)
245 259
246 blacklist = (device_blacklist.Blacklist(args.blacklist_file) 260 blacklist = (device_blacklist.Blacklist(args.blacklist_file)
247 if args.blacklist_file 261 if args.blacklist_file
248 else None) 262 else None)
249 263
250 if args.output_directory: 264 if args.output_directory:
251 constants.SetOutputDirectory(args.output_directory) 265 constants.SetOutputDirectory(args.output_directory)
252 # Do an up-front test that the output directory is known.
253 constants.CheckOutputDirectory()
254 266
255 if args.device: 267 if args.device:
256 devices = [device_utils.DeviceUtils(args.device)] 268 devices = [device_utils.DeviceUtils(args.device)]
257 else: 269 else:
258 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 270 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
259 271
260 # This must be done serially because strptime can hit a race condition if 272 if args.erase_all_with_noprocess:
261 # used for the first time in a multithreaded environment. 273 for device in devices:
262 # http://bugs.python.org/issue7980 274 for tombstone_file, _ in _ListTombstones(device):
263 tombstones = [] 275 _EraseTombstone(device, tombstone_file)
264 for device in devices: 276 else:
265 tombstones += _GetTombstonesForDevice(device, args) 277 # Do an up-front test that the output directory is known.
278 constants.CheckOutputDirectory()
266 279
267 _ResolveTombstones(args.jobs, tombstones) 280 # This must be done serially because strptime can hit a race condition if
268 281 # used for the first time in a multithreaded environment.
282 # http://bugs.python.org/issue7980
283 tombstones = []
284 for device in devices:
285 tombstones += _GetTombstonesForDevice(device, args)
286 _ResolveTombstones(args.jobs, tombstones)
269 287
270 if __name__ == '__main__': 288 if __name__ == '__main__':
271 sys.exit(main()) 289 sys.exit(main())
OLDNEW
« build/android/test_runner.py ('K') | « build/android/test_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698