[cfe-dev] question regarding the C++ test case under LLVM test
Jonathan Roelofs via cfe-dev
cfe-dev at lists.llvm.org
Tue Sep 20 15:33:28 PDT 2016
On 9/20/16 4:15 PM, Lin, Jin wrote:
> I think a better solution is to extend the utility llvm-lit to
> process the -target option. If the target option and the host match,
> the script will be executed. Otherwise just ignore the test case.
> What do you think?
That's actually not better.
The problem you're going to run into is that your host system's headers
are leaking into a target test. Now you have a testcase that could pass
on one machine, but fail on another (even if they're both linux
machines). The buildbots are very good at noticing this kind of thing
because they all run on different host platforms.
If you look through Clang's codegen tests, you'll find that none of them
include anything from the host system... that is not an accident. It was
done very purposefully: all of the codegen tests should behave precisely
the same, no matter what the host platform is, and no matter what
versions of libc/libm/c++ standard library/etc are installed.
There are solutions to the specific questions you're asking (about how
to prevent a testcase from running on a specific platform), but I'm
avoiding telling you them because I think they're solving the wrong
problem (specifically, this is a case of an XY problem:
http://http://xyproblem.info/).
Jon
>
> Thanks,
>
> Jin
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the cfe-dev
mailing list