[PATCH] D81782: [lit] Allow for tests to have non-parsed requirements
Casey Carter via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 13:47:00 PDT 2020
CaseyCarter updated this revision to Diff 270845.
CaseyCarter marked 2 inline comments as done.
CaseyCarter added a comment.
Hack together test.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81782/new/
https://reviews.llvm.org/D81782
Files:
llvm/utils/lit/lit/TestRunner.py
llvm/utils/lit/tests/Inputs/unparsed-requirements/test.py
llvm/utils/lit/tests/unparsed-requirements.py
Index: llvm/utils/lit/tests/unparsed-requirements.py
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/unparsed-requirements.py
@@ -0,0 +1,18 @@
+# RUN: %{python} %s %{inputs}/unparsed-requirements 2> %t.err
+
+import sys
+from lit.Test import Result, Test, TestSuite
+from lit.TestRunner import parseIntegratedTestScript
+from lit.TestingConfig import TestingConfig
+
+class CustomTest(Test):
+ def __init__(self, suite, path_in_suite, config, file_path = None):
+ Test.__init__(self, suite, path_in_suite, config, file_path)
+ self.requires = ["meow"]
+
+config = TestingConfig(None, "config", [".txt"], None, [], [], False, sys.argv[1], sys.argv[1], [], [], True)
+suite = TestSuite("suite", sys.argv[1], sys.argv[1], config)
+test = CustomTest(suite, ["test.py"], config)
+parseIntegratedTestScript(test)
+if test.requires != ["meow", "woof"]:
+ exit(1)
Index: llvm/utils/lit/tests/Inputs/unparsed-requirements/test.py
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/unparsed-requirements/test.py
@@ -0,0 +1,2 @@
+# REQUIRES: woof
+# RUN:
Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -1463,9 +1463,9 @@
except ValueError as e:
return lit.Test.Result(Test.UNRESOLVED, str(e))
script = parsed['RUN:'] or []
- test.xfails = parsed['XFAIL:'] or []
- test.requires = parsed['REQUIRES:'] or []
- test.unsupported = parsed['UNSUPPORTED:'] or []
+ test.xfails = test.xfails + (parsed['XFAIL:'] or [])
+ test.requires = test.requires + (parsed['REQUIRES:'] or [])
+ test.unsupported = test.unsupported + (parsed['UNSUPPORTED:'] or [])
if parsed['ALLOW_RETRIES:']:
test.allowed_retries = parsed['ALLOW_RETRIES:'][0]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81782.270845.patch
Type: text/x-patch
Size: 1966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200615/f0ad0d6b/attachment.bin>
More information about the llvm-commits
mailing list