Documentation Home
The MySQL Test Framework, Version 1.0
Download this Manual
PDF (US Ltr) - 443.9Kb
PDF (A4) - 445.6Kb

The MySQL Test Framework, Version 1.0  /  Running Test Cases

Chapter 3 Running Test Cases

Table of Contents     [+/-]

3.1 Constraints on Simultaneous Test Runs

Typically, you run the test suite either from within a source tree (after MySQL has been built), or on a host where the MySQL server distribution has been installed. To run tests, your current working directory should be the mysql-test directory of your source tree or installed distribution. In a source distribution, mysql-test is under the root of the source tree. In a binary distribution, the location of mysql-test depends on the distribution layout. The program that runs the test suite,, will figure out whether you are in a source tree or an installed directory tree.

To run the test suite, change location into your mysql-test directory and invoke the script:

shell> cd mysql-test
shell> ./ accepts options on the command line. For example:

shell> ./ --force --local

By default, exits if a test case fails. --force causes execution to continue regardless of test case failure.

The --local option tells not to use an already running server, but to start a server itself to use for the tests. This option is the default as of MySQL 4.1, so it is necessary only before 4.1.

For a full list of the supported options, see Section 5.3, “ — Run MySQL Test Suite”.

To run one or more specific test cases, name them on the command line. Test case files have names like t/test_name.test, where test_name is the name of the test case, but each name given on the command line should be the test case name, not the full test case file name. The following command runs the test case named rpl_abcd, which has a test file of t/rpl_abcd.test:

shell> ./ rpl_abcd

To run a family of test cases for which the names share a common prefix, use the --do-test option:

shell> ./ --do-test=prefix

For example, the following command runs the replication tests (test cases that have names beginning with rpl):

shell> ./ --do-test=rpl starts the MySQL server if necessary, sets up the environment for calling the mysqltest program, and invokes mysqltest to run the test case. For each test case to be run, mysqltest handles operations such as reading input from the test case file, creating server connections, and sending SQL statements to servers.

The language used in test case files is a mix of commands that the mysqltest program understands and SQL statements. Input that mysqltest doesn't understand is assumed to consist of SQL statements to be sent to the database server. This makes the test case language familiar to those that know how to write SQL and powerful enough to add the control needed to write test cases.

You need not start a MySQL server first before running tests. Instead, the program will start the server or servers as needed. Any servers started for the test run use ports in the range around 9300. To avoid conflicts, a production server should not use ports in that range, if you happen to have one on the same machine.