[libcxx-dev] RFC: freestanding libc++ lit tests
Louis Dionne via libcxx-dev
libcxx-dev at lists.llvm.org
Tue Nov 17 13:55:55 PST 2020
> On Nov 15, 2020, at 12:19, Ben Craig <ben.craig at ni.com> wrote:
> I'd like to start annotating the libc++ lit tests to indicate which can run in freestanding vs. hosted, while also allowing for vendor extensions to freestanding. I'm going to need to add a new feature to lit though.
> Mark all the hosted tests as "REQUIRES: hosted". Most platforms would have the "hosted" feature set automatically. Freestanding tests would not have any new REQUIRES attribute added.
I would like an approach where we add the minimum number of REQUIRES. Instead, I think using UNSUPPORTED is better. The reason is that by default, when you're porting the test suite to a new platform, you just don't define any lit features, and ideally that enables the full test suite. You can then see what fails, and see what features you actually need to define.
If you're using `REQUIRES:`, then the majority of tests will be disabled by default, if you don't define any Lit features. Of course, both are logically equivalent, but I just find that using `UNSUPPORTED: freestanding` provides more ergonomics than `REQUIRES: hosted`.
> To handle vendor extensions, things get a little more involved. I would like to add a "REQUIRES_ONE" tag, so that we can put expressions like "REQUIRES_ONE: hosted, darwinKernel" and "REQUIRES_ONE: hosted, winKernel". The expression would be satisfied so long as at least one of the listed features is present.
This can be handled with `// REQUIRES: hosted || darwinKernel`. Boolean expressions in REQUIRES work.
All that being said, my actual preference to handle freestanding is to add finer-grained features to describe features that are not available on a specific platform. These features are generic and not target specific. For example, I added a mode of libc++ for platforms that don't support localization, and added the corresponding libcpp-has-no-localization Lit feature. The nice part about this feature is that some platform that supports everything but localization can simply use that, however if another platform is more constrained, they can intersect such features by defining multiple ones: libcpp-has-no-localization, libcpp-has-no-threads, libcpp-has-no-random_device, etc.
I think that's the most extensible way of supporting this. And then, freestanding can simply be an alias of some specific set of Lit features, like no localization, no random device, no this, and no that.
What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libcxx-dev