mysql-test Auxiliary files
Contents
In mysql-test framework besides test anf result files, there are many other files that affect the testing process.
suite disabled.def
file
This file can be used to disable certain tests temporarily. For example, if one test fails and you are working on that, you may want to push the changeset that disables it in the test suite so that others won't be disturbed by this failure.
File contains test names and the comment (that should explain why the test was disabled) separated by a colon. Lines that start from a hash sign () are ignored. A typical
disabled.def
may look like this (note that a hash sign in the middle of a line does not start a comment):
# List of disabled tests # test name : comment rpl_redirect : Fails due to bug#49978 events_time_zone : need to fix the timing
During testing, mtr will print disabled tests like this:
... rpl.rpl_redirect [ disabled ] Fails due to bug#49978 rpl.events_time_zone [ disabled ] need to fix the timing ...
This file should be located in the suite directory.
suite suite.opt
file
This file lists server options that will be added to the mysqld
command line for every test of this suite. It can refer to environment variables with the $NAME
syntax. Shell meta-characters should be quoted. For example
--plugin-load=$AUTH_PAM_SO --max-connections=40 --net_read_timeout=5 "--replicate-rewrite-db=test->rewrite"
Note that options may be put on one line or or different lines. It is a good idea to start an option name with --loose-
prefix if the server may or may not recognize it depending on the configuration. An unknown option in the .opt
file will not let server to start and the test will be aborted.
This file should be located in the suite directory.
other *.opt
files
For any test or include file somefile.test
or somefile.inc
mtr will look for somefile.opt
, somefile-master.opt
and somefile-slave.opt
. These files have exactly the same syntax as the suite.opt
above. Options from these files will also be added to the server command line (all servers started for this test, only master, or only slave respectively) for all affected tests, for example, for all tests that include somefile.inc
directly or indirectly.
A typical usage example is, for example, include/have_blackhole.inc
and include/have_blackhole.opt
. The latter contains the necessary command line options to load the Blackhole storage engine, while the former verifies that it was really loaded. And any test that needs Blackhole engine, only needs to start from source include/have_blackhole.inc;
and the engine will be automatically loaded for it.
suite my.cnf
file
This is not the my.cnf
file that tests from this suite will use, but rather a template of it. It will be converted later to an actual my.cnf
. If a suite contains no my.cnf
template, a default one — include/default_my.cnf
— will be used. Or suite/rpl/my.cnf
if the test includes master-slave.inc
(it's one of the few bits of the old MySQL mysql-test-run magic that we did not remove yet). Typically a suite template will not contain a complete server configuration, but rather start from
!include include/default_my.cnf
and then add the necessary modifications.
The syntax of my.cnf
template is the same of a normal my.cnf
file, with a few extensions and assumptions. They are:
- For any group with the name
[mysqld.N]
, where N is a number, mtr will start onemysqld
process. Usually one needs to have only[mysqld.1]
group, and[mysqld.2]
group for replication tests.
- There can be groups with non-standard names (
[foo]
,[bar]
, whatever), not used bymysqld
. Thesuite.pm
files (see below) may use them somehow.
- Values can refer to each other using the syntax
@groupname.optionname
— these references be expanded as needed. For example
[mysqld.2] master-port= @mysqld.1.port
it sets the value of the master-port
in the [mysqld.2]
group to the value of port
in the [mysqld.1]
group.
- An option name may start from a hash sign
. In the resulting
my.cnf
it will look like a comment, but it still can be referred to. For example:
[example]
- location = localhost:@mysqld.1.port bar = server:@example.#location/data
- There is the
[ENV]
group. It sets values for the environment variables. For example
[ENV] MASTER_MYPORT=@mysqld.1.port
Also, one can refer to values of environment variables via this group:
[mysqld.1] user=@ENV.LOGNAME
- There is the
[OPT]
group. It is used to allow invoke functions and generate values. Currently it contains only one option@OPT.port
. Every time this option is referred to in some other group in themy.cnf
template, a new unique port number is generated. It will not match any other port number used by this test run. For example
[ENV] SPHINXSEARCH_PORT = @OPT.port
This file should be located in the suite directory.
other *.cnf
files
suite combinations
file
can be disabled from suite.pm can use $ENV added to command line, not my.cnf