Running C++ unit tests and MMS tests#
The C++ unit tests (libtests) and Method of Manufactured Solutions (MMS) tests are implemented using CppUnit and a common test driver, pylith::testing::TestDriver.
TestDriver provides support for command line arguments to control the tests run and set PETSc options.
All of the C++ unit test or MMS test executables support the following command line arguments:
--helpShow help for command line arguments.--listList tests run by the executable.--tests=TESTSRun subset of the tests.TESTSis a comma separated list of tests.--petsc VALUE=ARGSet PETSc option-VALUE=ARG.--journal.info=NAMEActivate Pythia info journal forNAME.--journal.debug=NAMEActivate Pythia debug journal forNAME.--journal.warning=NAMEActivate Pythia warning journal forNAME.
$ cd tests/libtests/problems
# List tests
$ ./test_problems --list
# Run all TestObserversPhysics tests.
$ ./test_problems --tests=pylith::problems::TestObserversPhysics
# Run TestObserversPhysics testVerifyObservers and testNotifyObservers tests.
$ ./test_problems --tests=pylith::problems::TestObserversPhysics::testVerifyObservers,pylith::problems::TestObserversPhysics::testNotifyObservers
# Turn on timedependent info journal.
$ ./test_problems --journal.info=timedependent
# Turn on timedependent debug journal.
$ ./test_problems --journal.debug=timedependent
Using the debugger#
The executables in the build directory are shell script wrappers created by libtool.
The underlying binary executables are in the .libs directory.
When using the debugger, pass the binary executable to the debugger.
For example, gdb .libs/test_problems.
Using valgrind#
# Run valgrind on the test_problems executable
$ valgrind --log-file=valgrind_problems.log \
--suppressions=$PYLITH_DIR/share/valgrind-python.supp .libs/test_problems