Gmane
Gravatar
From: João Abecasis <jpabecasis <at> gmail.com>
Subject: Re: Compile tests for headers
Newsgroups: gmane.comp.lib.boost.build, gmane.comp.lib.boost.devel
Date: 2006-04-19 10:32:42 GMT (3 years, 10 weeks, 5 days, 23 hours and 58 minutes ago)
Emil Dotchevski wrote:
> I need to test each header in my libs, to make sure that it compiles without 
> errors when included as the first header in a CPP. What is the easiest way 
> to accomplish this?
> 
> I was thinking of writing a simple tool which takes the command line for the 
> complier, generates a CPP file which includes the specified header and then 
> runs the compiler, however this would have to interface somehow with 
> boost-build, to get the command line (depending on the toolset used, and the 
> configuration), and I don't know how to do that.
> 
> Any suggestions?

Incidentally, just yesterday I finally ported to bjam+BBv2 a shell 
script I've been using for the same purpose. See attached. You should 
put headers.jam file in the same directory as your Jamfile[.v2] or 
somewhere where Boost.Build can find it (e.g., in BOOST_BUILD_PATH).

For example, to test the compilation of Boost.Spirit headers, in 
(boost-root)/libs/spirit/test/Jamfile.v2 one could have:

     import headers ;
     import testing ;

     test-suite "spirit.headers"
         : [ headers ../../../boost/spirit ]
         ;

At this point the code is the documentation, but I added some comments 
explaining each function's purpose.

Perhaps this, or something along the lines of it, could be added to the 
regression tests, to ensure that all headers compile independently. 
FWIW, my former bash script used to report lots of non-compilable files 
inside boost.

What do others think about this? I'd like to hear your comments on the 
approach and implementation, as well as bug reports ;-)

Best regards,

João
Attachment (headers.jam): application/x-extension-jam, 3844 bytes
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build