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

Side by Side Diff: build/android/test_wrapper/test_runner_wrapper.py

Issue 2163833003: Logdog for logcats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update logdog revision + test_runner_wrapper for stream name support 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 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 import os
9 import subprocess
10 import logging
11
ghost stip (do not use) 2016/07/27 01:14:18 nit: two newlines before top level declarations
nicholaslin 2016/07/27 19:08:06 Done.
12 def CommandParser():
13 # Parses the command line arguments being passed in
14 parser = argparse.ArgumentParser()
15 parser.add_argument('--test-runner-command',
ghost stip (do not use) 2016/07/27 01:14:17 so I think we have to redo this a bit. we should s
nicholaslin 2016/07/27 19:08:06 Do we need a test_command argument? Placing all lo
ghost stip (do not use) 2016/07/29 01:09:07 I'd prefer using the named positional argument and
16 help=('Command line arguments to run android tests'))
17 parser.add_argument('--logdog-command',
18 help=('Logdog command line arguments'))
19 return parser
20
ghost stip (do not use) 2016/07/27 01:14:17 newline
nicholaslin 2016/07/27 19:08:05 Done.
21 def LogdogParser():
22 # Parses the useful logdog flags for generating the URL
23 # This includes the project, prefix, and name flags
24 parser = argparse.ArgumentParser()
25 parser.add_argument('-project')
ghost stip (do not use) 2016/07/27 01:14:17 add help here, maybe just saying "passed to logdog
nicholaslin 2016/07/27 19:08:05 Specifying the logdog args in the CommandParser ma
26 parser.add_argument('-prefix')
27 parser.add_argument('-name')
28 return parser
29
ghost stip (do not use) 2016/07/27 01:14:17 newline
nicholaslin 2016/07/27 19:08:06 Done.
30 def CreateUrl(project, prefix, name):
31 url_prefix = prefix.replace('/', '%2F')
32 url = ('https://luci-logdog-dev.appspot.com/v/?s={0}%2F'
ghost stip (do not use) 2016/07/27 01:14:18 we use % instead of .format(): url = ('https://lu
nicholaslin 2016/07/27 19:08:06 Done.
33 '{1}%2F%2B%2F{2}').format(project, url_prefix, name)
34 return url
ghost stip (do not use) 2016/07/27 01:14:17 can just make this return ('https://' ....) instea
nicholaslin 2016/07/27 19:08:06 Done.
35
ghost stip (do not use) 2016/07/27 01:14:18 newline
nicholaslin 2016/07/27 19:08:06 Done.
36 def main():
37 parser = CommandParser()
38 args, extra_args = parser.parse_known_args(sys.argv[1:])
39 test_cmd = args.test_runner_command.split() + extra_args
40 if args.logdog_command:
41 subprocess.check_call(test_cmd)
42 cmd = args.logdog_command
43 if '${SWARMING_TASK_ID}' in cmd:
ghost stip (do not use) 2016/07/27 01:14:17 weird, but does give you flexibility in mb.py. I'l
44 cmd = cmd.replace('${SWARMING_TASK_ID}',
45 os.environ.get('SWARMING_TASK_ID'))
46 cmd = cmd.split()
ghost stip (do not use) 2016/07/27 01:14:17 this is going to sound nuts but I think we should
nicholaslin 2016/07/27 19:08:06 The new command parser specifies all logdog argume
ghost stip (do not use) 2016/07/29 01:09:07 nope, this was leftover from an older review pass.
47 logdog_parser = LogdogParser()
48 url_args = logdog_parser.parse_known_args(cmd)[0]
49 logging.basicConfig(level=logging.DEBUG)
ghost stip (do not use) 2016/07/27 01:14:18 remove lines 49 and 50
nicholaslin 2016/07/27 19:08:06 Done.
50 logging.info("NOTE: below arguments are for streaming logcats to logdog")
51 url = CreateUrl(url_args.project, url_args.prefix, url_args.name)
52 logging.info('Logcats are located at: %s', url)
53 return subprocess.call(cmd)
54 return subprocess.call(test_cmd)
55
56 if __name__ == '__main__':
57 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698