Documentation Home
The MySQL Test Framework, Version 2.0
Download this Manual
PDF (US Ltr) - 0.5Mb
PDF (A4) - 0.5Mb
EPUB - 126.6Kb


The MySQL Test Framework, Version 2.0  /  Creating and Executing Unit Tests  /  Unit Tests Added to Main Test Runs

7.3 Unit Tests Added to Main Test Runs

From MySQL 5.5.11, mysql-test-run.pl will also run unit tests at the end of full test runs, when being run from within a build directory. It depends on the unit tests having been built and defined in a file CTestTestfile.cmake in the top level build directory. Those will normally be there after a build using CMake, but will not be in a binary package.

The unit tests are run simply by executing ctest with no arguments from the top level build directory. The result will be shown as a single test at the end, named unit_tests which passes if and only if all unit tests pass. A summary of the result will be printed, including the name of any failed unit tests. The set of unit tests will be counted as one test (either passed or failed) in the overall test summary.

Unit tests will by default be run only if you have not specified any specific tests or suites on the command line for mysql-test-run.pl. This can be overridden by setting the environment variable MTR_UNIT_TESTS to 0 or 1. This in turn can be overriden by a command line argument --unit-tests or --nounit-tests.

If the file CTestTestfile.cmake and the ctest command are not both available, unit tests will be silently skipped, unless you have used the command line option --unit-tests.