<Alexander G. Riccio> via llvm-dev
2016-Apr-13 20:55 UTC
[llvm-dev] lit conditional compilation/checking?
How can I platform-conditionally compile/check sections of code with lit? Can I rely on preprocessor defines like _WIN32? Specifically, I'm adding new tests to existing lit tests, but the new tests should only be compiled and run on Windows. Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160413/089aac07/attachment.html>
Robinson, Paul via llvm-dev
2016-Apr-13 23:05 UTC
[llvm-dev] lit conditional compilation/checking?
Clang should be setting up the usual preprocessor defines based on the target. So, you can bracket chunks of C/C++ source in a lit test with #if to guard target-dependent stuff. Charles Li has been updating a bunch of tests to have sections guarded by tests on the value of __cplusplus, for example (e.g. see r266239). If you're asking about conditionally executing RUN lines, I don't think there's a way to do that; you'd need to split the new stuff into its own file and use REQUIRES to set the correct conditions. --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of <Alexander G. Riccio> via llvm-dev Sent: Wednesday, April 13, 2016 1:56 PM To: llvm-dev Subject: [llvm-dev] lit conditional compilation/checking? How can I platform-conditionally compile/check sections of code with lit? Can I rely on preprocessor defines like _WIN32? Specifically, I'm adding new tests to existing lit tests, but the new tests should only be compiled and run on Windows. Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio<http://about.me/ariccio> <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160413/aa154886/attachment.html>
Matthias Braun via llvm-dev
2016-Apr-13 23:44 UTC
[llvm-dev] lit conditional compilation/checking?
If the new tests should not be run together with the old tests just consider creating a new file. In general mixing tests is of course possible: - Specify a target triple in the RUN: line to force output for a specific system, this works regardless of your host system. (However make sure that the target you specify is actually available by placing the test in a directory with lit.local.cfg set apropriately). - You can specify multiple check-prefixes with FileCheck. A typical pattern would be: RUN: ... flags for variant1 | FileCheck %s --check-prefix=CHECK --check-prefix=VARIANT1 RUN: ... flags for variant2 | FileCheck %s --check-prefix=CHECK --check-prefix=VARIANT2 CHECK: check this for all variants VARIANT1: ... VARIANT2: ... ... In general the best way to learn how to write good tests is spending some time looking into the existing ones. - Matthias> On Apr 13, 2016, at 1:55 PM, <Alexander G. Riccio> via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > How can I platform-conditionally compile/check sections of code with lit? Can I rely on preprocessor defines like _WIN32? > > Specifically, I'm adding new tests to existing lit tests, but the new tests should only be compiled and run on Windows. > > > Sincerely, > Alexander Riccio > -- > "Change the world or go home." > about.me/ariccio <http://about.me/ariccio> > > <http://about.me/ariccio> > If left to my own devices, I will build more. > ⁂ > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160413/1962e8a5/attachment.html>
<Alexander G. Riccio> via llvm-dev
2016-Apr-14 21:42 UTC
[llvm-dev] lit conditional compilation/checking?
> > Clang should be setting up the usual preprocessor defines based on the > target. >placeholder text It doesn't seem like that works as I'd expect: an #if defined(_WIN32) didn't seem to fire on my local Windows machine. What #defines can I use? Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ On Wed, Apr 13, 2016 at 7:05 PM, Robinson, Paul < Paul_Robinson at playstation.sony.com> wrote:> Clang should be setting up the usual preprocessor defines based on the > target. So, you can bracket chunks of C/C++ source in a lit test with #if > to guard target-dependent stuff. Charles Li has been updating a bunch of > tests to have sections guarded by tests on the value of __cplusplus, for > example (e.g. see r266239). > > If you're asking about conditionally executing RUN lines, I don't think > there's a way to do that; you'd need to split the new stuff into its own > file and use REQUIRES to set the correct conditions. > > --paulr > > > > *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *<Alexander > G. Riccio> via llvm-dev > *Sent:* Wednesday, April 13, 2016 1:56 PM > *To:* llvm-dev > *Subject:* [llvm-dev] lit conditional compilation/checking? > > > > How can I platform-conditionally compile/check sections of code with lit? > Can I rely on preprocessor defines like _WIN32? > > > > Specifically, I'm adding new tests to existing lit tests, but the new > tests should only be compiled and run on Windows. > > > > > Sincerely, > Alexander Riccio > -- > "Change the world or go home." > > about.me/ariccio > > > <http://about.me/ariccio> > > If left to my own devices, I will build more. > > ⁂ >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160414/73f0d10d/attachment.html>
<Alexander G. Riccio> via llvm-dev
2016-Apr-14 22:06 UTC
[llvm-dev] lit conditional compilation/checking?
> > If the new tests should not be run together with the old tests just > consider creating a new file. In general mixing tests is of course possible: >Maybe I should just create a new file. That said, I'd still like to know how to mix tests, for future reference. - Specify a target triple in the RUN: line to force output for a specific> system, this works regardless of your host system. (However make sure that > the target you specify is actually available by placing the test in a > directory with lit.local.cfg set apropriately). > - You can specify multiple check-prefixes with FileCheck. A typical > pattern would be: > > RUN: ... flags for variant1 | FileCheck %s --check-prefix=CHECK > --check-prefix=VARIANT1 > RUN: ... flags for variant2 | FileCheck %s --check-prefix=CHECK > --check-prefix=VARIANT2 > > CHECK: check this for all variants > VARIANT1: ... > VARIANT2: ... > ... >It looks like FileCheck is mainly for assembly/IR level. I'm trying to test some static-analyzer level things, and I need to skip some test functions. In general the best way to learn how to write good tests is spending some> time looking into the existing ones. >Slowly, I will. I'm still quite new to the LLVM testing infrastructure. Sorry! Sincerely, Alexander Riccio -- "Change the world or go home." about.me/ariccio <http://about.me/ariccio> If left to my own devices, I will build more. ⁂ On Wed, Apr 13, 2016 at 7:44 PM, Matthias Braun <mbraun at apple.com> wrote:> If the new tests should not be run together with the old tests just > consider creating a new file. In general mixing tests is of course possible: > > - Specify a target triple in the RUN: line to force output for a specific > system, this works regardless of your host system. (However make sure that > the target you specify is actually available by placing the test in a > directory with lit.local.cfg set apropriately). > - You can specify multiple check-prefixes with FileCheck. A typical > pattern would be: > > RUN: ... flags for variant1 | FileCheck %s --check-prefix=CHECK > --check-prefix=VARIANT1 > RUN: ... flags for variant2 | FileCheck %s --check-prefix=CHECK > --check-prefix=VARIANT2 > > CHECK: check this for all variants > VARIANT1: ... > VARIANT2: ... > ... > > In general the best way to learn how to write good tests is spending some > time looking into the existing ones. > > - Matthias > > On Apr 13, 2016, at 1:55 PM, <Alexander G. Riccio> via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > How can I platform-conditionally compile/check sections of code with lit? > Can I rely on preprocessor defines like _WIN32? > > Specifically, I'm adding new tests to existing lit tests, but the new > tests should only be compiled and run on Windows. > > > Sincerely, > Alexander Riccio > -- > "Change the world or go home." > about.me/ariccio > > <http://about.me/ariccio> > If left to my own devices, I will build more. > ⁂ > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160414/e6abe951/attachment.html>