gn_helper: ignore spaces on gn lines

Change-Id: I2f676411a5282c938fc1d095acbbde0bbe6efde3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5668281
Commit-Queue: Junji Watanabe <jwata@google.com>
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
changes/81/5668281/3
Fumitoshi Ukai 11 months ago committed by LUCI CQ
parent 367c6f720d
commit d7d8221581

@ -48,7 +48,7 @@ def lines(output_dir):
yield line_without_comment
_gn_arg_pattern = re.compile(r"(^|\s)([^=\s]*)\s*=\s*(\S*)\s*$")
_gn_arg_pattern = re.compile(r"(^|\s*)([^=\s]*)\s*=\s*(\S*)\s*$")
def args(output_dir):

@ -67,6 +67,21 @@ class GnHelperTest(trial_dir.TestCase):
('use_remoteexec', 'true'),
])
def test_args_spaces(self):
out_dir = os.path.join('out', 'dir')
# Make sure nested import directives work. This is based on the
# reclient test.
write(os.path.join(out_dir, 'args.gn'), 'import("//out/common.gni")')
write(os.path.join('out', 'common.gni'), 'import("common_2.gni")')
write(os.path.join('out', 'common_2.gni'), ' use_remoteexec = true ')
lines = list(gn_helper.args(out_dir))
# The test will only pass if both imports work and
# 'use_remoteexec=true' is seen.
self.assertListEqual(lines, [
('use_remoteexec', 'true'),
])
if __name__ == '__main__':
unittest.main()

Loading…
Cancel
Save