<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I think I like it.  I'll restate it to check for understanding.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As a first pass, I'll apply an "UNSUPPORTED: freestanding" to all the facilities that the standard lists as hosted.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As we identify areas of vendor extension, we will label that area in the negative.  For example, assume some crazy vendor had a freestanding platform that supported iostreams.  At that point, we would add a libcpp-has-no-iostreams feature.  We would then remove
 "UNSUPPORTED:freestanding" from the associated tests and add "UNSUPPORTED:libcpp-has-no-iostreams" in its place.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This would have the effect of temporarily breaking the tests of all the vendors that don't support iostreams on freestanding.  But that's fine, they can fix things by adding libcpp-has-no-iostreams to their feature list.  They could also be pleasantly surprised
 to discover that their platform happens to support iostreams.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm not thrilled with the double negative in "UNSUPPORTED:libcpp-has-no-iostreams", but the workflow gets the job done.<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Louis Dionne <ldionne@apple.com><br>
<b>Sent:</b> Tuesday, November 17, 2020 3:55 PM<br>
<b>To:</b> Ben Craig <ben.craig@ni.com><br>
<b>Cc:</b> libcxx-dev@lists.llvm.org <libcxx-dev@lists.llvm.org>; Stephan T. Lavavej <stl@exchange.microsoft.com><br>
<b>Subject:</b> [EXTERNAL] Re: RFC: freestanding libc++ lit tests</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space"><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Nov 15, 2020, at 12:19, Ben Craig <<a href="mailto:ben.craig@ni.com" class="">ben.craig@ni.com</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
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.</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<b class="">Recommendation:</b><br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
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.</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>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.</div>
<div><br class="">
</div>
<div>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`.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
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.</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>This can be handled with `// REQUIRES: hosted || darwinKernel`. Boolean expressions in REQUIRES work.</div>
<div><br class="">
</div>
<div>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.</div>
<div><br class="">
</div>
<div>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.</div>
<div><br class="">
</div>
<div>What do you think?</div>
<div>Louis</div>
<div><br class="">
</div>
</div>
</div>
</body>
</html>