Robert’s rules of Boost testing

By the way of trying to figure out how to make tests building faster? (I will post about it later), I have learned some interesting practices regarding Boost testing in general. Especially, Robert Ramey shared his best practices, worth to look at really. New release of Boost will be released next week, so I’m testing Boost.Geometry library and it is a good opportunity to apply some of Robert’s rules.

I’m testing against “known good” components – the next release branch.

How to run tests of current development line of a library (a Boost library, e.g. Boost.Geometry) against Boost release branch? Assuming all the library development happens in Boost trunk, let’s say in ${DEV}/boost/_svn/trunk where ${DEV} is your base workshop location, do this:

  • Checkout Boost release branch
    mkdir -p ${DEV}/boost/_svn/branches/release
    cd ${DEV}/boost/_svn/branches/release
    svn co https://svn.boost.org/svn/boost/branches/release/ .
    

  • Stay in ${DEV}/boost/_svn/branches/release
  • Build and install Boost.Build v2 from the release branch:
    cd tools/build/v2
    # On Windows, run bootstrap.bat
    ./bootstrap.sh
    # On Windows, I use C:\usr as prefix for my Boost installation
    ./b2 --prefix=/usr/local install
    # Note, this command will also install b2 utility in ${prefix}/bin
    
  • Switch Boost.Geometry directories to trunk:
    svn switch https://svn.boost.org/svn/boost/trunk/boost/geometry boost/geometry
    svn switch https://svn.boost.org/svn/boost/trunk/libs/geometry libs/geometry
    
  • Run tests and generate full log in file:
    export BGLOG=boost-geometry-test.log
    date > $BGLOG & b2 >> $BGLOG 2<&1 & date >> $BGLOG
    
    # On Windows, I run this with logging this way:
    set BGLOG=%CD%\boost-geometry-test.log
    dateu.exe > %BGLOG% & b2 >> %BGLOG% 2<&1 & dateu.exe >> %BGLOG%
    

    Note, the dateu.exe is renamed Unix utility date.exe installed from GnuWin32 packages. I just like it.

Inspect the log file for test failures, for example by quick check of number of passed tests:

$ grep "\*passed\*" boost-geometry-test.log | wc -l
111

That’s it.

Try this out – it will help a lot.

Boost.Geometry mailing list moved

I have moved mailing list of the Boost.Geometry library from server at OSGeo to Boost mailing list server. All existing subscribers and archives have been moved to the new server.

The new list is available at geometry at lists dot boost dot org. It is also mirrored at Nabble as Boost.Geometry.

The old ggl at lists dot osgeo dot org will be wiped out soon.

If anyone experiences any problems with the new geometry at lists.boost.org, please contact me directly.

Big thanks to the OSGeo Foundation for hosting the ggl mailing list and thanks to Boost admins for help with the new server.

Visual Studio 11 support for Boost.Build

I have just submitted patch with update for Boost.Build machinery to properly detect Visual Studio 11 (currently available as Developer Preview).

I have very little experience with Boost.Build v2 internals, so the patch may need further improvements. It works in my environment on Windows 7 (64-bit) with Visual Studio 2010 Express Edition installed alongside the Visual Studio 11 Developer Preview.

If you want to use Visual Studio 11 as Boost.Build toolset, just put the following entry in your user-config.jam file:

using msvc : 11.0 ;

To verify if the toolset is recognised correctly, use b2 debugging options:

b2 --debug-configuration --debug-building --debug-generator buffer.cpp
notice: found boost-build.jam at D:/dev/boost/_svn/trunk/boost-build.jam
notice: loading Boost.Build from D:/dev/boost/_svn/trunk/tools/build/v2
notice: Searching C:\Windows C:\Users\mloskot C:\Users\mloskot D:\dev\boost\_svn\trunk\tools/build/v2 D:/dev/boost/_svn/trunk/tools/build/v2/kernel D:/dev/
boost/_svn/trunk/tools/build/v2/util D:/dev/boost/_svn/trunk/tools/build/v2/build D:/dev/boost/_svn/trunk/tools/build/v2/tools D:/dev/boost/_svn/trunk/tool
s/build/v2/contrib D:/dev/boost/_svn/trunk/tools/build/v2/. for site-config configuration file site-config.jam .
notice: Loading site-config configuration file site-config.jam from D:/dev/boost/_svn/trunk/tools/build/v2/site-config.jam .
notice: Searching C:\Users\mloskot C:\Users\mloskot D:\dev\boost\_svn\trunk\tools/build/v2 D:/dev/boost/_svn/trunk/tools/build/v2/kernel D:/dev/boost/_svn/
trunk/tools/build/v2/util D:/dev/boost/_svn/trunk/tools/build/v2/build D:/dev/boost/_svn/trunk/tools/build/v2/tools D:/dev/boost/_svn/trunk/tools/build/v2/
contrib D:/dev/boost/_svn/trunk/tools/build/v2/. for user-config configuration file user-config.jam .
notice: Loading user-config configuration file user-config.jam from C:/Users/mloskot/user-config.jam .
notice: [msvc-cfg] msvc-11.0 detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe'
notice: [msvc-cfg] msvc-10.0 detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe'
notice: [msvc-cfg] msvc-10.0express detected, command: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe'
notice: will use 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe' for msvc, condition <toolset>msvc-11.0
notice: [msvc-cfg] condition: '<toolset>msvc-11.0/<architecture>/<address-model>', setup: 'call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcv
arsall.bat" x86 >nul
...

and look for the following message reported:

notice: will use 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe' for msvc, condition <toolset>msvc-11.0

Visual Studio 11 visualizers for Boost.Geometry

Some time ago Barend Gehrels blogged about Visual Studio 2010 debugger visualizers for Boost.Geometry. Barend’s templates added to autoexp.dat file are of great help while working with the Boost.Geometry library in Visual Studio.

Recently, I’ve started using Visual Studio 11 Developer Preview and discovered the new style debugger visualizers this new edition introduces. I decided to port Barend’s work to the new XML-based format in .natvis files.

vs11-visualizers-boost-geometry

All my visualizers, not only for Boost.Geometry but also for other libraries, are available in visualstudio11 Git repository on my GitHub. The .natvis files are not overly complicated and the installation is dead easy, see README file attached.

Comments, suggestions and fixes are welcome.

FindBoost.cmake patched for Visual Studio 11

My patch updating CMake module FindBoost.cmake for Boost C++ Libraries lookup has been accepted and committed to the CMake Git repository. Thanks to Brad King for quick review.

The patch adds most recent versions of Boost 1.47 and 1.48 to the lookup table and uses correct toolset tag vc110 (see Library Naming) when checking for libraries built using Visual Studio 11.

Building Boost with Visual Studio 11 Developer Preview

Yesterday, I installed Visual Studio 11 Developer Preview. The new release is available for free and is usable for free until June 2012, so it’s a great opportunity to try and learn what Microsoft has to offer for C++ programmers. And, it looks it offers a lot, including SCARY features.

The first test I usually do when it comes to test a new C++ toolset is to build Boost C++ Libraries using mainstream development sources.

The Boost simply builds well. I have even configured build of Boost.Python using Python version 3.2.

There are no hacks required to make the build happen. Simply, follow Boost Getting Started on Windows, section 5.3. Or, Build Binaries From Source. Once the Boost.Build tools bootstrapped, I issued the following command:

b2 --toolset=msvc variant=debug runtime-link=shared threading=multi define=_CRT_NONSTDC_NO_DEPRECATE define=_CRT_SECURE_NO_DEPRECATE define=_SCL_SECURE_NO_DEPRECATE stage

Fifteen minutes later, the Boost build was ready and staged.

By the way, some time ago Christian Henning posted a quick cheat sheet of bjam commands for Visual Studio. It’s very handy.