Skip to content

Commit

Permalink
mb: Implement 'quiet' flag in mb lookup
Browse files Browse the repository at this point in the history
This is a partial port of https://chromium-review.googlesource.com/1576022
Needed because recipes assume the flag exists.

Example error (unnoticed until now because it's silently ignored):
https://logs.chromium.org/logs/webrtc/buildbucket/cr-buildbucket.appspot.com/8911948550157608800/+/steps/lookup_GN_args/0/stdout

Bug: chromium:955062
Change-Id: Id3707903dd5747c13bba05df76f799fb523a6faa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139248
Reviewed-by: Mirko Bonadei <[email protected]>
Commit-Queue: Oleh Prypin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#28123}
  • Loading branch information
oprypin authored and Commit Bot committed May 31, 2019
1 parent cecf87f commit d7e2fb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tools_webrtc/mb/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def AddCommonOptions(subp):
help='look up the command for a given config or '
'builder')
AddCommonOptions(subp)
subp.add_argument('--quiet', default=False, action='store_true',
help='Print out just the arguments, '
'do not emulate the output of the gen subcommand.')
subp.set_defaults(func=self.CmdLookup)

subp = subps.add_parser(
Expand Down Expand Up @@ -286,12 +289,15 @@ def CmdIsolate(self):

def CmdLookup(self):
vals = self.Lookup()
cmd = self.GNCmd('gen', '_path_')
gn_args = self.GNArgs(vals)
self.Print('\nWriting """\\\n%s""" to _path_/args.gn.\n' % gn_args)
env = None
if self.args.quiet:
self.Print(gn_args, end='')
else:
cmd = self.GNCmd('gen', '_path_')
self.Print('\nWriting """\\\n%s""" to _path_/args.gn.\n' % gn_args)
env = None

self.PrintCmd(cmd, env)
self.PrintCmd(cmd, env)
return 0

def CmdRun(self):
Expand Down
5 changes: 5 additions & 0 deletions tools_webrtc/mb/mb_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,11 @@ def run_stub(cmd, **_kwargs):
def test_lookup(self):
self.check(['lookup', '-c', 'debug_goma'], ret=0)

def test_quiet_lookup(self):
self.check(['lookup', '-c', 'debug_goma', '--quiet'], ret=0,
out=('is_debug = true\n'
'use_goma = true\n'))

def test_lookup_goma_dir_expansion(self):
self.check(['lookup', '-c', 'rel_bot', '-g', '/foo'], ret=0,
out=('\n'
Expand Down

0 comments on commit d7e2fb3

Please sign in to comment.