From d9b0dac5e78795fa916c163fac385182fc9ceea9 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Wed, 9 Aug 2017 16:43:25 -0400 Subject: Extracting GetBooleanGnArg from coverage_report.py Change-Id: I5475b37aad69361e2e7fae4ce69faf011e3b5c40 Reviewed-on: https://pdfium-review.googlesource.com/10030 Reviewed-by: Ryan Harrison Commit-Queue: Henrique Nakashima --- testing/tools/common.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'testing/tools/common.py') diff --git a/testing/tools/common.py b/testing/tools/common.py index c3bc2181f4..737169f8d3 100755 --- a/testing/tools/common.py +++ b/testing/tools/common.py @@ -99,12 +99,14 @@ class DirectoryFinder: return result -def GetBooleanGnArg(arg_name, build_dir): - '''Extract the value of a boolean flag in args.gn''' - cwd = os.getcwd() - os.chdir(build_dir) - gn_args_output = subprocess.check_output( - ['gn', 'args', '.', '--list=%s' % arg_name, '--short']) - os.chdir(cwd) - arg_match_output = re.search('%s = (.*)' % arg_name, gn_args_output).group(1) - return arg_match_output == 'true' +def GetBooleanGnArg(arg_name, build_dir, verbose=False): + '''Extract the value of a boolean flag in args.gn''' + cwd = os.getcwd() + os.chdir(build_dir) + gn_args_output = subprocess.check_output( + ['gn', 'args', '.', '--list=%s' % arg_name, '--short']) + os.chdir(cwd) + arg_match_output = re.search('%s = (.*)' % arg_name, gn_args_output).group(1) + if verbose: + print >> sys.stderr, "Found '%s' for value of %s" % (arg_match_output, arg) + return arg_match_output == 'true' -- cgit v1.2.3