[PATCH] D76829: [lit] Introduce setup and teardown routines

Sergej Jaskiewicz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 05:56:35 PDT 2020


broadwaylamb marked an inline comment as done.
broadwaylamb added a comment.

In D76829#1945166 <https://reviews.llvm.org/D76829#1945166>, @yln wrote:

> Ideally, setup/teardown would execute around the suite that defined it.  We can't easily accomplish this because after test discovery, a "lit run" (run.py) is just the list of all discovered tests.


Yes, I thought about it too and indeed it's not easy to do. Not only because the information about suites is "lost", but also because I think it would significantly complicate the logic in case of parallelism.
I agree that although it would be a natural thing to do, I don't see any issue if we run those routines before and after the whole lit invocation.



================
Comment at: llvm/utils/lit/lit/LitConfig.py:208
+        for callback in self._setup_callbacks:
+            callback()
+    
----------------
yln wrote:
> Should we provide self (the lit_config) or is this implicitly captured on the caller side?
Yes, it can be captured.


================
Comment at: llvm/utils/lit/tests/Inputs/setup-teardown/lit.cfg:10
+def setup():
+    print("Running setup code...")
+
----------------
yln wrote:
> Can this access the surrounding context?
Yes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76829/new/

https://reviews.llvm.org/D76829





More information about the llvm-commits mailing list