[cfe-dev] Platform header test

Daniel Dunbar daniel at zuster.org
Sat Nov 21 21:16:46 PST 2009


Right, to continue on with that thought, my plan (not yet implemented) is to add
  utils/OptionalTests
as a dumping ground for all the extra tests which we know how to
write, but don't feel like putting in the regular test suite
(non-portable, system dependencies, slow, whatever). I'll probably
move the existing C++Tests directory there once I get around to it.

 - Daniel

On Fri, Nov 20, 2009 at 11:45 AM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Nov 20, 2009, at 11:31 AM, John Thompson wrote:
>
>> Are there any plans for testing compilations of the headers on the
>> various platforms?
>>
>> I would like to look into getting Visual Studio and Windows headers
>> to compile, and the first step would be to see where we are.
>>
>> I'm thinking that if we had some tests that just include individual
>> headers and just syntax check them, that would both give us this
>> information, as well as become a regression test.
>>
>> What I've done locally is to create an "Includes" directory under
>> "test", and put in simple tests of the form:
>>
>> // RUN: clang -fsyntax-only %s
>> #include <stdio.h>
>>
>> I'm using the clang driver because of the -fms-extension issue.
>>
>> Since headers might act differently between C and C++, perhaps each
>> test should have two compile commands, one for C and one for C++.
>> (I haven't figured out the right options to do that yet with the
>> clang driver.)
>>
>> Since stdio.h might include other files, I test those separately.
>> Since these might be platform-specific, I'd use conditionals:
>>
>> // This test is for Windows only.
>> // RUN: clang -fsyntax-only %s
>> #if defined(__WIN32__) || defined(__WIN64__)
>> #include <crtdefs.h>
>> #endif
>>
>> Platform and complier-specific files probably should be in separate
>> directories, perhaps under Includes, i.e.:
>>
>> test
>>     Includes
>>         VisualStudio
>>         Windows
>>         GNU
>>
>> I separated VisualStudio and Windows with respect to the files under
>> Visual Studio and those under the Platform SDK also being separated,
>> but they could be combined.
>>
>> Anyway, let me know what you think.
>
> We definitely want to do this kind of testing. lit actually has some
> support already for "try to syntax-check all of the headers in a given
> directory". Check out, for example, clang/utils/C++Tests/stdc++-
> Syntax, which checks the GCC 4.2.1 C++ headers. Run it from the clang
> source directory with, e.g.,
>
>        lit -sv utils/C++Tests/stdc++-Syntax
>
>        - Doug
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list