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

Side by Side Diff: tools/telemetry/list_telemetry_unittests

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « tools/telemetry/json_format ('k') | tools/telemetry/pylintrc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import argparse
7 import sys
8
9
10 def _ExtractQueuedTestName(line):
11 _, test_name, _ = line.split(' ')
12 return test_name
13
14
15 def _ExtractPassedTestName(line):
16 _, test_name, _, _ = line.split(' ')
17 return test_name
18
19
20 def _IsQueued(line):
21 return line.endswith(' queued')
22
23
24 def _IsPassed(line):
25 return 'passed' in line.split(' ')
26
27
28 def _ProcessLogFile(file_path):
29 passed_unittests = []
30 queued_unittests = []
31 with open(file_path, 'r') as f:
32 for line in f:
33 line = line.strip()
34 if not line.startswith('['):
35 continue
36 if _IsQueued(line):
37 queued_unittests.append(_ExtractQueuedTestName(line))
38 elif _IsPassed(line):
39 passed_unittests.append(_ExtractPassedTestName(line))
40 queued_unittests.sort()
41 passed_unittests.sort()
42 return queued_unittests, passed_unittests
43
44
45 def main(args):
46 parser = argparse.ArgumentParser(
47 description=('Process telemetry unittests log to print out passed '
48 'or queued tests.'))
49 parser.add_argument(
50 'filepath', help='path to log file of telemetry unittest')
51 parser.add_argument(
52 '-p', '--list-passed-tests', action='store_true',
53 help='List all the passed telemetry unittests')
54 parser.add_argument(
55 '-q', '--list-queued-tests', action='store_true',
56 help='List all the queued telemetry unittests')
57 options = parser.parse_args(args)
58 queued_unittests, passed_unittests = _ProcessLogFile(options.filepath)
59 if options.list_passed_tests:
60 print 'All passed telemetry unittests:\n'
61 print '\n'.join(passed_unittests)
62 if options.list_queued_tests:
63 print 'All queued telemetry unittests:\n'
64 print '\n'.join(queued_unittests)
65 return 0
66
67
68 if __name__ == '__main__':
69 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « tools/telemetry/json_format ('k') | tools/telemetry/pylintrc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698