the Compartmented Robust Posix C++ Unit Test system

Chapter 2. Preparation

Download crpcut

If you haven't already done so, download the crpcut sources from http://downloads.sourceforge.net/crpcut/crpcut-0.8.4.tar.bz2. The directory you unpack the sources to will be called <source-dir> in the rest of this guide. You may also want to download the documentation from http://downloads.sourceforge.net/crpcut/crpcut-doc-0.8.4.tar.bz2.

Where to install to

crpcut defaults to install under /usr/{lib,include,share}. If you want to use another destination, add the command line parameter -DCMAKE_INSTALL_PREFIX=<path> to the CMake line. The directory you want to install to will be called <prefix-dir> in the rest of this guide.

Support for valgrind

You are highly encouraged to build crpcut on a machine that has valgrind installed.

If <valgrind/valgrind.h> can be found when running CMake, crpcut will add instrumentation instructions for valgrind. These instrumentation instructions are no-ops when running natively, or on a machine that doesn't have valgrind, but can help immensely in finding memory access errors when running tests under valgrind.

If you build crpcut for a binary distribution, you should definitely build on a machine with valgrind.

Which compiler to use

If you want to use another compiler than the default for CMake, or if CMake is unable to find one, prefix the CMake line with CXX="<compilername>", for example:


     bash > CXX="g++-4.1.2" cmake /tmp/download/crpcut

Debug compiled lib

Compiling crpcut with debugging enabled may make it easier to debug your tests, or analyze core dumps, since the tests are started from crpcut

To enable debug builds, add the command line parameter -DCMAKE_BUILD_TYPE="debug" to the CMake line when building.

Self test after build?

Running a self test after build is a good way to verify that crpcut functions correctly. To run a self test, you need ruby, and you must enable core-dumps as "core" in the current working directory (since the self test verifies that certain crashes do dump core as expected.) If you run Linux, ensure that /proc/sys/kernel/core_pattern contains only the word "core".

If you have google-mock installed, you can add a few test cases that verify google-mock interaction with crpcut by adding the command line parameter -DWITH_GOOGLE_MOCK=yes to the CMake. Should CMake be unable to find your google-mock installation, you can help it by adding the command line parameter -DGOOGLE_MOCK_DIR=<path-to-google-mock>.

Build documentation

You are not encouraged to build the documentation yourself, but rather download it from sourceforge via http://downloads.sourceforge.net/crpcut/crpcut-doc-0.8.4.tar.bz2. However, should you choose to build it anyway, you will need

You will also need to add -DWITH_HTML_DOCS=yes to the CMake command line.