diff options
Diffstat (limited to 'testing/tools/common.py')
-rwxr-xr-x | testing/tools/common.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/tools/common.py b/testing/tools/common.py index b6e4a7d62e..c3bc2181f4 100755 --- a/testing/tools/common.py +++ b/testing/tools/common.py @@ -5,6 +5,7 @@ import glob import os +import re import subprocess import sys @@ -96,3 +97,14 @@ class DirectoryFinder: if other_components: result = os.path.join(result, other_components) 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' |