[PATCH] D76290: [lit] Allow passing extra commands to executeShTest
Louis Dionne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 17 08:31:34 PDT 2020
ldionne created this revision.
ldionne added a reviewer: delcypher.
Herald added subscribers: llvm-commits, dexonsmith, jkorous.
Herald added a project: LLVM.
ldionne added a comment.
I couldn't find existing unit tests for `executeShTest` that I could have added to, but please LMK if there are some.
This allows creating custom test formats on top of `executeShTest` that
inject commands at the beginning of the file, without having to create
a temporary file, write `RUN:` lines to it, and then pass that to
`executeShTest`.
For example, with this change, it becomes possible to define a libc++
style `.pass.cpp` test as a shell test that injects commands to compile
and run the source file at the beginning.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76290
Files:
llvm/utils/lit/lit/TestRunner.py
Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -1461,13 +1461,17 @@
def executeShTest(test, litConfig, useExternalSh,
- extra_substitutions=[]):
+ extra_substitutions=[],
+ extra_commands=[]):
if test.config.unsupported:
return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported')
- script = parseIntegratedTestScript(test)
- if isinstance(script, lit.Test.Result):
- return script
+ script = list(extra_commands)
+ parsed = parseIntegratedTestScript(test, require_script=False if script else True)
+ if isinstance(parsed, lit.Test.Result):
+ return parsed
+ script += parsed
+
if litConfig.noExecute:
return lit.Test.Result(Test.PASS)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76290.250788.patch
Type: text/x-patch
Size: 898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200317/310931a7/attachment.bin>
More information about the llvm-commits
mailing list