From c71ebff86fa79b20388749dd4781fd96fcc5c63a Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 3 Jan 2022 16:25:59 +0100 Subject: more general way to provide additional lines of code that compute_scripts.awk should process as part of a js file --- test/script_loader.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/script_loader.py b/test/script_loader.py index 53de779..f527d9e 100644 --- a/test/script_loader.py +++ b/test/script_loader.py @@ -59,13 +59,16 @@ def load_script(path, code_to_add=None): a dependency to be substituted by a mocked value. """ path = make_relative_path(path) - key = f'{str(path)}:{code_to_add}' if code_to_add is not None else str(path) + key = (str(path), code_to_add) if key in script_cache: return script_cache[key] + append_flags = () if code_to_add is None else ('-A', ':'.join(key)) + awk = subprocess.run(['awk', '-f', str(awk_script), '--', '-D', 'MOZILLA', '-D', 'MV2', '-D', 'TEST', '-D', 'UNIT_TEST', - '-D', 'DEBUG', '--output=amalgamate-js:' + key], + '-D', 'DEBUG', *append_flags, + '--output=amalgamate-js:' + str(path)], stdout=subprocess.PIPE, cwd=script_root, check=True) script = awk.stdout.decode() script_cache[key] = script -- cgit v1.2.3