MySQL 8.0.39
Source Code Documentation
Unit Tests Added to Main Test Runs

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.