Learning Objective:
In this guide you will learn to set up SeqAn3's library tests to make sure that your contributions don't break anything.
Difficulty | Easy |
---|---|
Duration | 20 Minutes |
Prerequisite tutorials | Quick Setup (using CMake) |
Recommended reading |
Unit tests are the most important tests, they should cover all functionality and all code-paths of the library. Before submitting a pull request to our repository, make sure that the unit tests pass on your system.
Assume that you have cloned SeqAn including submodules into /home/me/devel/seqan3
and performed some local changes.
Create an out-of-source build directory and change to it:
Invoke CMake (this is often referred to as the "Configure" step):
The build type could be "Release", but stick to "Debug" if you aim to make contributions to the SeqAn3 codebase. Specifying the compiler is optional; depending on your setup, you may need to give the full path.
Invoke Make (this is the actual build step):
You may want to pass -j x
where is x
is the number of CPUs on your system to speed up the build. If you have build failures, it is recommend to run make again without -j x
to receive better readable output.
After all test have been successfully built, run ctest to ensure correct results:
Fix any issues you encounter and re-run make and ctest. You only need to re-run cmake if you add or remove unit tests in between your changes.
If you are working on a very specific piece of code, it might be beneficial to ensure that specific test builds and passes before re-building the entire set.
This builds the test for seqan3::dna4:
And this runs the test:
Note that you need to give the (relative) path when running the executable, but not when building the test. Running the test executable individually will also tell you which parts of the test fail.
SeqAn has the following test suites:
If your unit tests pass and you submit a pull request, our continuous integration builds also run the other test suites. You might encounter failures in one of them in which case you need to also setup that test suite to fix your problems before you re-submit/update your pull request.
The only difference in setting up the other test suites is a different path when invoking CMake. Since you used out-of-source builds, you can simply create another directory for the other test suite(s).
This will setup snippet tests:
Documentation tests do not require setting a build type or compiler, but they require that doxygen be installed on the system. Locally built documentation will be placed into /home/me/devel/seqan3-build/documentation/doc_usr/html/
.
gmake
whenever you would call make
.