the Compartmented Robust Posix C++ Unit Test system

The command line

The command line parameters to a test program is:

<programname> {flags} {names}

{names} is zero or more names of tests or testsuites.

{flags} are zero or more of:

flag

-c number / --children=number

Set number of parallel test case processes to number. number must be a value in the range 1 to 8 inclusively.

crpcut defaults to one child process

With a multi-core CPU, or with tests that spend a lot of time waiting, using many parallel test case processes can considerably shorten the run time of a test program.

[Note]Note
-c / --children cannot be combined with -s / --single-shot
-d dirname / --working-dir=dirname

Set the working directory for crpcut to dirname. dirname may be a relative path. The name dirname must refer to an existing directory that crpcut has write access to. The tests will run in child directories created by crpcut

-l / --list

crpcut::run() prints the names of all tests matching any in {names} (or all tests if {names} is empty) to the output stream and return -1.

[Note]Note
-l / --list cannot be combined with any other option.
-n / --nodeps

Ignore all dependencies and consider all tests available for running.

[Note]Note
-n / --nodeps is implied by -s / --single-shot
-o filename / --output=filename

Direct the test report to filename. By default the test report will be in XML format. Combine with -x / --xml to get a human readable report to filename. A report summary will still be printed on stdout unless suppressed with the -q / --quiet.

[Note]Note
-o / --output cannot be combined with -s--single-shot
-p name=value / --param=name=value

Define a named parameter for the tests to use. The syntax is -p name=value or --param=name=value. Several named parameters can be defined with multiple -p / --param options on the command line, each defining a different named parameter.

Tests pick up the values with crpcut::get_parameter().

-q / --quiet

Suppress the printing of a brief report summary, resulting from the -o filename / --output=filename option.

[Note]Note
-q / --quiet is implied by -s / --single-shot
-s / --single-shot

Run the one test that matches {names}, without spawning a separate test process. Only one single test can be selected. This is useful for running a test in a debugger.

[Caution]Caution
This is a markedly different environment where many of the crpcut features are unavailable. stdout and stderr have their normal functions, instead of being processed by crpcut. INFO is sent to stdout. It is not possible for crpcut to monitor time consumed by the test case, and neither is it possible to monitor abnormal exits. Any failed assertion results in a call to abort().
-v / --verbose

Include the output from passed tests in the report.

[Note]Note
-v / --verbose is implied by -s / --single-shot
-x / --xml

Switch between XML and human readable test report format. A test report to stdout defaults to human readable, but is changed to XML using -x / --xml. A test report to a named file, using -o filename / --output=filename, defaults to XML but is changed to human readable using -x / --xml.

[Note]Note
-x / --xml cannot be combined with -s / --single-shot

Example:

    testprog --nodeps --parameter=pwd=`pwd` --xml suite_1

Will run all tests in the testsuite suite_1 regardless of dependencies, and will provide the named parameter pwd the name of the current working directory.