[llvm-dev] [llvm-lit] Is it possible to write a test for Linux only?

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Sat Mar 4 19:06:26 PST 2017



> -----Original Message-----
> From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of
> Taewook Oh via llvm-dev
> Sent: Friday, March 03, 2017 7:56 PM
> To: Jonathan Roelofs; llvm-dev at lists.llvm.org
> Subject: Re: [llvm-dev] [llvm-lit] Is it possible to write a test for
> Linux only?
> 
> Maybe I was totally confused. When I see /test/lit.cfg
> (https://github.com/llvm-mirror/clang/blob/master/test/lit.cfg), some
> available_features are based on config.target_triple (e.g.
> https://github.com/llvm-mirror/clang/blob/master/test/lit.cfg#L420), so I
> though REQUIRES is not necessarily about $host.

REQUIRES is something of a grab bag.  Some of its features are based on
host, I think some are based on other configuration things, and you can
also put elements of the target triple in there.

You could specify a target triple in your test, but that generally means
restricting it to both a particular architecture and a particular OS
(for example, x86_64-unknown-linux).  If you want a test that runs on
any architecture but only for linux, I would expect `REQUIRES: linux` to
work, as it would look for `linux` as a target triple component.

There are some differences between the feature sets supported in the
LLVM suite versus the Clang suite, and without a bit more research
(which unfortunately I cannot do at the moment, I am away this weekend)
I can't be sure whether my suggestion actually works.  :-)  But you could
try some experiments in this direction and see if you can get it to work.

Good luck,
--paulr

> 
> On 3/3/17, 7:40 PM, "Jonathan Roelofs" <jonathan at codesourcery.com> wrote:
> 
> 
> 
>     On 3/3/17 8:29 PM, Taewook Oh wrote:
>     > It is $target dependent. I’m curious what makes you think it is
> $host dependent.
> 
>     Because you're asking about REQUIRES, which refers to features of the
>     $host. If you just want to write a target dependent test, use -target
> /
>     -triple.
> 
> 
>     Jon
> 
>     >
>     > Thanks,
>     > Taewook
>     >
>     > On 3/3/17, 5:10 PM, "Jonathan Roelofs" <jonathan at codesourcery.com>
> wrote:
>     >
>     >
>     >
>     >      On 3/3/17 12:23 PM, Taewook Oh wrote:
>     >      > Thanks Jon. Actually I tried “x86_64-linux”, but it makes the
> test “Unsupported” from my linux machine, and it was because my test is
> under clang, not llvm. It seems that clang doesn’t support “x86_64-linux”
> yet. Thanks again!
>     >
>     >      Oh, ok. Follow-up question: why is your clang test $host
> platform
>     >      dependent (instead of $target dependent)?
>     >
>     >
>     >      Jon
>     >
>     >      >
>     >      > Best,
>     >      > Taewook
>     >      >
>     >      > On 3/3/17, 10:57 AM, "Jonathan Roelofs"
> <jonathan at codesourcery.com> wrote:
>     >      >
>     >      >
>     >      >
>     >      >      On 3/3/17 11:46 AM, Taewook Oh via llvm-dev wrote:
>     >      >      > Hello,
>     >      >      >
>     >      >      >
>     >      >      >
>     >      >      > I wonder if I can write a test that runs only on
> Linux. I was thinking
>     >      >      > of adding “REQUIRES” to the test, but couldn’t find a
> feature name for
>     >      >      > Linux (if one exists). Thanks!
>     >      >
>     >      >      $ grep -r REQUIRES ../llvm/test/ | grep linux
>     >      >
>     >      >      The feature name you want is: "x86_64-linux"
>     >      >
>     >      >
>     >      >      Jon
>     >      >
>     >      >
>     >      >      >
>     >      >      >
>     >      >      >
>     >      >      > Best,
>     >      >      >
>     >      >      > Taewook
>     >      >      >
>     >      >      >
>     >      >      >
>     >      >      > _______________________________________________
>     >      >      > LLVM Developers mailing list
>     >      >      > llvm-dev at lists.llvm.org
>     >      >      > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-
> 2Ddev&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=kOsLCgQzH7N8ptZ7diJD9g&m=bzBdn7W
> Cgwl6-
> 0aL2ULfM0PsytR1IyK9EOCcVbUvlT4&s=Wtp9I5P84Z8qjfl3UMV9sOVOpNNik3wJH5knbhrN7
> 5s&e=
>     >      >      >
>     >      >
>     >      >      --
>     >      >      Jon Roelofs
>     >      >      jonathan at codesourcery.com
>     >      >      CodeSourcery / Mentor Embedded
>     >      >
>     >      >
>     >
>     >      --
>     >      Jon Roelofs
>     >      jonathan at codesourcery.com
>     >      CodeSourcery / Mentor Embedded
>     >
>     >
>     >
> 
>     --
>     Jon Roelofs
>     jonathan at codesourcery.com
>     CodeSourcery / Mentor Embedded
> 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list