OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Script to parse perf data from Chrome Endure test executions, to be graphed. | 6 """Script to parse perf data from Chrome Endure test executions, to be graphed. |
7 | 7 |
8 This script connects via HTTP to a buildbot master in order to scrape and parse | 8 This script connects via HTTP to a buildbot master in order to scrape and parse |
9 perf data from Chrome Endure tests that have been run. The perf data is then | 9 perf data from Chrome Endure tests that have been run. The perf data is then |
10 stored in local text files to be graphed by the Chrome Endure graphing code. | 10 stored in local text files to be graphed by the Chrome Endure graphing code. |
11 | 11 |
12 It is assumed that any Chrome Endure tests that show up on the waterfall have | 12 It is assumed that any Chrome Endure tests that show up on the waterfall have |
13 names that are of the following form: | 13 names that are of the following form: |
14 | 14 |
15 "endure_<webapp_name>-<test_name>" (non-Web Page Replay tests) | 15 "endure_<webapp_name>-<test_name>" |
16 | |
17 or | |
18 | |
19 "endure_<webapp_name>_wpr-<test_name>" (Web Page Replay tests) | |
20 | |
21 For example: "endure_gmail_wpr-testGmailComposeDiscard" | |
22 | 16 |
23 This script accepts either a URL or a local path as a buildbot location. | 17 This script accepts either a URL or a local path as a buildbot location. |
24 It switches its behavior if a URL is given, or a local path is given. | 18 It switches its behavior if a URL is given, or a local path is given. |
25 | 19 |
26 When a URL is given, it gets buildbot logs from the buildbot builders URL | 20 When a URL is given, it gets buildbot logs from the buildbot builders URL |
27 e.g. http://build.chromium.org/p/chromium.endure/builders/. | 21 e.g. http://build.chromium.org/p/chromium.endure/builders/. |
28 | 22 |
29 When a local path is given, it gets buildbot logs from buildbot's internal | 23 When a local path is given, it gets buildbot logs from buildbot's internal |
30 files in the directory e.g. /home/chrome-bot/buildbot. | 24 files in the directory e.g. /home/chrome-bot/buildbot. |
31 """ | 25 """ |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 413 |
420 def ExtractTestNames(log_location, is_dbg): | 414 def ExtractTestNames(log_location, is_dbg): |
421 """Extract test names from |log_location|. | 415 """Extract test names from |log_location|. |
422 | 416 |
423 Returns: | 417 Returns: |
424 A dict of a log location, webapp's name and test's name. False if error. | 418 A dict of a log location, webapp's name and test's name. False if error. |
425 """ | 419 """ |
426 if log_location.startswith('http://'): | 420 if log_location.startswith('http://'): |
427 location = urllib.unquote(log_location) | 421 location = urllib.unquote(log_location) |
428 test_pattern = r'endure_([^_]+)(_test |-)([^/]+)/' | 422 test_pattern = r'endure_([^_]+)(_test |-)([^/]+)/' |
429 wpr_test_pattern = r'endure_([^_]+)_wpr(_test |-)([^/]+)/' | |
430 else: | 423 else: |
431 location = log_location | 424 location = log_location |
432 test_pattern = r'endure_([^_]+)(_test_|-)([^/]+)-stdio' | 425 test_pattern = r'endure_([^_]+)(_test_|-)([^/]+)-stdio' |
433 wpr_test_pattern = 'endure_([^_]+)_wpr(_test_|-)([^/]+)-stdio' | |
434 | 426 |
435 found_wpr_result = False | |
436 match = re.findall(test_pattern, location) | |
437 if not match: | |
438 match = re.findall(wpr_test_pattern, location) | |
439 if match: | |
440 found_wpr_result = True | |
441 else: | |
442 logging.error('Test name not in expected format: ' + location) | |
443 return False | |
444 match = match[0] | 427 match = match[0] |
445 webapp_name = match[0] + '_wpr' if found_wpr_result else match[0] | 428 webapp_name = match[0] |
446 webapp_name = webapp_name + '_dbg' if is_dbg else webapp_name | 429 webapp_name = webapp_name + '_dbg' if is_dbg else webapp_name |
447 test_name = match[2] | 430 test_name = match[2] |
448 | 431 |
449 return { | 432 return { |
450 'location': log_location, | 433 'location': log_location, |
451 'webapp_name': webapp_name, | 434 'webapp_name': webapp_name, |
452 'test_name': test_name, | 435 'test_name': test_name, |
453 } | 436 } |
454 | 437 |
455 | 438 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 if not success: | 815 if not success: |
833 logging.error('Failed to update perf data files.') | 816 logging.error('Failed to update perf data files.') |
834 sys.exit(0) | 817 sys.exit(0) |
835 | 818 |
836 GenerateIndexPage(options.graph_dir) | 819 GenerateIndexPage(options.graph_dir) |
837 logging.debug('All done!') | 820 logging.debug('All done!') |
838 | 821 |
839 | 822 |
840 if __name__ == '__main__': | 823 if __name__ == '__main__': |
841 main() | 824 main() |
OLD | NEW |