Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve test coverage #2351
This PR updates the coverage report generation target, replaces lcov with gcov and adds extensive unit tests to cover the CLI module. It also fixes a bug I discovered during unit test development, where the
In addition, all uses of qCritical() with untranslatble raw char* sequences were removed in favor of proper locale strings. These are written to STDERR through QTextStreams and support output redirection for testing purposes. With this change, error messages don't depend on the global Qt logging settings and targets anymore and go directly to the terminal or into a file if needed.
Lastly, all CLI commands received a dedicated -h/--help option.
Motivation and context
Generation of unit test coverage reports used to be quite complicated and required a lot of different settings, including a custom CMake build type. This patch updates the coverage CMake module to only require -DWITH_COVERAGE=ON to be set on a normal Debug build in order to create a coverage target.
This patch also moves away from lcov in favor of gcovr, since lcov appears to be broken in GCC 8. However, the routines for generating lcov reports still exist, so provided lcov receives updates and there is sufficient reason to switch back, it is easy to do so.
How has this been tested?
Tests pass and increase coverage by about 5%.
Types of changes