[cfe-dev] alternate testing

David Blaikie dblaikie at gmail.com
Fri Jan 11 19:10:47 PST 2013


On Fri, Jan 11, 2013 at 7:05 PM, reed kotler <rkotler at mips.com> wrote:
> On 01/11/2013 06:53 PM, David Blaikie wrote:
>
> On Fri, Jan 11, 2013 at 6:46 PM, reed kotler <rkotler at mips.com> wrote:
>
> In some clang tests, they seem to use something other than filecheck
>
> for example in Sema/address_spaces.c
>
> // RUN: %clang_cc1 %s -fsyntax-only -verify
>
> #define _AS1 __attribute__((address_space(1)))
> #define _AS2 __attribute__((address_space(2)))
> #define _AS3 __attribute__((address_space(3)))
>
> void bar(_AS2 int a); // expected-error {{parameter may not be qualified
> with an address space}}
>
> void foo(_AS3 float *a,
>          _AS1 float b) // expected-error {{parameter may not be qualified
> with an address space}}
>
>
> Where is this documented?
>
> http://clang.llvm.org/doxygen/classclang_1_1VerifyDiagnosticConsumer.html#details
>
> (though, honestly, I've never read the documentation for it - picked
> it up most by reading/examples/experience. It's fairly simple)
>
> Nice. The doc had what I was looking for.
>
> expected-no-diagnostics
>
>
> Seems like filecheck though is much more powerful. This must be an earlier
> method for generating tests.

I'm not sure that it came before FileCheck - I suspect it may've come
after. It's somewhat more convenient & has certain useful properties
that might be hard to express in FileCheck. (it's also not dissimilar
to a mode that GCC has)

>
> But in my case I would need to write two different tests if I didn't use
> filecheck.
>
> I'm just trying to test that
> __attribute__(mips16)
>
> continues to generate a warning if the architecture is not mips and
> generates no diagnostic if it is mips.

Given how small the test is I'd probably write it as two separate
-verify tests, but a test with two RUN lines (using two different
FileCheck prefixes) would also be fine, so far as I can tell.



More information about the cfe-dev mailing list