The %T substitution in llvm-lit returns a temporary folder common to the directory that the test is in. Because it is not unique to the individual test, %T can lead to races if not used carefully. Because of this it has been deprecated for about seven years (https://github.com/llvm/llvm-project/commit/a2e0c2462a5ed4ddabab03dfddb97efc54682bde). There were very few tests in tree still using this functionality. I have recently cleaned up the remaining uses in the tree and am looking to remove support for %T from lit so new tests do not end up using the feature. I wanted to solicit feedback from the community on the best way to do this to make this reasonably easy for downstreams.
I think there are three feasible options with varying degrees of friction for downstreams:
-
Add a flag or config option to disable %T substitutions within the monorepo. We would then enable this flag within the monorepo to prevent usage there. This has the upside of being zero friction for downstreams as it is opt-in. This doesn’t have a good path for fully deprecating %T though and adds the maintenance burden of maintaining a flag.
-
We could disable %T by default but add a flag/config option to restore the previous behavior that we eventually plan to fully remove. This would mean downstreams only need to change a line or two of configs/build system logic to get the previous behavior while still allowing for a full deprecation. This is slightly more friction and keeps some maintenance in lit itself, but has some advantages. It ensures downstreams are aware of the issue because they have to opt in and it scopes the upstream maintenance burden to a specific period of time.
-
We rip out all support for %T and require downstreams that still want to use the feature to manually add the substitution (most likely by subclassing ShTest if they do not already have a custom test format). This has the advantage that it is zero maintenance today and does not require any extended deprecation period. It has the downside of being more complicated for downstreams to implement than the previous two, although is still relatively uncomplicated.
There is one upstream consumer of %T in libc++, and we are planning on just adding a custom substitution within libc++’s custom test format, as described in option 3.
I do not work downstream much so I am unsure what people prefer. I think option three is the most attractive as it is not too much work for downstreams and keeps upstream maintenance to a minimum.