From 8de4349ebdb6ce398ef4939f9f375a7413d99b09 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 17 Jun 2021 10:30:06 -0700 Subject: Add a `foreach` script for use in lit tests The major drawback of lit tests is that so far they have only supported a single module per test file. This commit adds a new utility script that splits an input file into multiple files and runs a command on each of them, giving lit tests a simple way to test multiple modules per file. --- test/lit/lit.cfg.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/lit/lit.cfg.py') diff --git a/test/lit/lit.cfg.py b/test/lit/lit.cfg.py index 60ba1ced6..bc034b349 100644 --- a/test/lit/lit.cfg.py +++ b/test/lit/lit.cfg.py @@ -15,7 +15,8 @@ for tool_file in os.listdir(bin_dir): tool = tool_file[:-4] if tool_file.endswith('.exe') else tool_file config.substitutions.append((tool, tool_path)) -# Also make the `not` command available -not_file = config.binaryen_src_root + '/scripts/not.py' -python = sys.executable.replace('\\', '/') -config.substitutions.append(('not', python + ' ' + not_file)) +# Also make the `not` and `foreach` commands available +for tool in ('not', 'foreach'): + tool_file = config.binaryen_src_root + '/scripts/' + tool + '.py' + python = sys.executable.replace('\\', '/') + config.substitutions.append((tool, python + ' ' + tool_file)) -- cgit v1.2.3