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

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

Issue 661843003: Fixed extraction of emulated devices name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « build/android/adb_logcat_monitor.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 (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Shutdown adb_logcat_monitor and print accumulated logs. 7 """Shutdown adb_logcat_monitor and print accumulated logs.
8 8
9 To test, call './adb_logcat_printer.py <base_dir>' where 9 To test, call './adb_logcat_printer.py <base_dir>' where
10 <base_dir> contains 'adb logcat -v threadtime' files named as 10 <base_dir> contains 'adb logcat -v threadtime' files named as
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 def FindLogFiles(base_dir): 72 def FindLogFiles(base_dir):
73 """Search a directory for logcat files. 73 """Search a directory for logcat files.
74 74
75 Args: 75 Args:
76 base_dir: directory to search 76 base_dir: directory to search
77 77
78 Returns: 78 Returns:
79 Mapping of device_id to a sorted list of file paths for a given device 79 Mapping of device_id to a sorted list of file paths for a given device
80 """ 80 """
81 logcat_filter = re.compile(r'^logcat_(\w+)_(\d+)$') 81 logcat_filter = re.compile(r'^logcat_(\S+)_(\d+)$')
82 # list of tuples (<device_id>, <seq num>, <full file path>) 82 # list of tuples (<device_id>, <seq num>, <full file path>)
83 filtered_list = [] 83 filtered_list = []
84 for cur_file in os.listdir(base_dir): 84 for cur_file in os.listdir(base_dir):
85 matcher = logcat_filter.match(cur_file) 85 matcher = logcat_filter.match(cur_file)
86 if matcher: 86 if matcher:
87 filtered_list += [(matcher.group(1), int(matcher.group(2)), 87 filtered_list += [(matcher.group(1), int(matcher.group(2)),
88 os.path.join(base_dir, cur_file))] 88 os.path.join(base_dir, cur_file))]
89 filtered_list.sort() 89 filtered_list.sort()
90 file_map = {} 90 file_map = {}
91 for device_id, _, cur_file in filtered_list: 91 for device_id, _, cur_file in filtered_list:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 except: 204 except:
205 logger.exception('Unexpected exception') 205 logger.exception('Unexpected exception')
206 206
207 logger.info('Done.') 207 logger.info('Done.')
208 sh.flush() 208 sh.flush()
209 output_file.write('\nLogcat Printer Event Log\n') 209 output_file.write('\nLogcat Printer Event Log\n')
210 output_file.write(log_stringio.getvalue()) 210 output_file.write(log_stringio.getvalue())
211 211
212 if __name__ == '__main__': 212 if __name__ == '__main__':
213 sys.exit(main(sys.argv[1:])) 213 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/android/adb_logcat_monitor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698