mtr mysql-test-run.pl — Run MySQL Test Suite

The mysql-test-run.pl Perl script is the main application used to run the MySQL test suite.
pl Perl脚本是用来运行MySQL测试套件的主要应用程序。

It invokes mysqltest to run individual test cases.
它调用mysqltest来运行单独的测试用例。

Invoke mysql-test-run.pl in the mysql-test directory like this:
像这样在mysql-test目录下调用mysql-test-run.pl:

shell> mysql-test-run.pl [options] [test_name] ...

Each test_name argument names a test case. The test case file that corresponds to the test name is t/test_name.test.
每个test_name参数命名一个测试用例。对应测试名的测试用例文件是t/test_name.test。

For each test_name argument, mysql-test-run.pl runs the named test case. With no test_name arguments, mysql-test-run.pl runs all .test files in the t subdirectory.
对于每个test_name参数,mysql-test-run.pl运行指定的测试用例。如果没有test_name参数,mysql-test-run.pl将运行t子目录下的所有.test文件。

If no suffix is given for the test name, a suffix of .test is assumed. Any leading path name is ignored. These commands are equivalent:
如果没有为测试名指定后缀,则假定后缀为.test。任何前导路径名都会被忽略。这些命令是等价的:

shell> mysql-test-run.pl mytest
shell> mysql-test-run.pl mytest.test
shell> mysql-test-run.pl t/mytest.test

A suite name can be given as part of the test name. That is, the syntax for naming a test is:
套件名可以作为测试名的一部分给出。也就是说,命名测试的语法是:

[suite_name.]test_name[.suffix]

If a suite name is given, mysql-test-run.pl looks in that suite for the test. The test file corresponding to a test named suite_name.test_name is found in suite/suite_name/t/test_name.test. There is also an implicit suite name main for the tests in the top t directory. With no suite name, mysql-test-run.pl looks in the default list of suites for a match and runs the test in any suites where it finds the test. Suppose that the default suite list is main, binlog, rpl, and that a test mytest.test exists in the main and rpl suites. With an argument of mytest or mytest.test, mysql-test-run.pl will run mytest.test from the main and rpl suites.
如果给出了套件名,mysql-test-run.pl将在该套件中查找测试。测试文件对应于一个名为suite_name的测试。Test_name在suite/suite_name/t/ Test_name .test中。在top t目录中还有一个用于测试的隐式套件名称main。如果没有套件名,mysql-test-run.pl将在默认套件列表中查找匹配,并在找到测试的任何套件中运行测试。假设默认套件列表是main、binlog、rpl,测试是mytest。测试存在于主套件和RPL套件中。用mytest或mytest来辩论。测试,mysql-test-run.pl将运行mytest。从主套件和RPL套件进行测试。

To run a family of test cases for which the names share a common prefix, use the --do-test=prefix option. For example, --do-test=rpl runs the replication tests (test cases that have names beginning with rpl). --skip-test has the opposite effect of skipping test cases for which the names share a common prefix.
要运行名称共享一个公共前缀的一系列测试用例,请使用——do-test=prefix选项。例如,——do-test=rpl运行复制测试(名称以rpl开头的测试用例)。——skip-test的效果与跳过名称共享公共前缀的测试用例相反。

The argument for the --do-test and --skip-test options also allows more flexible specification of which tests to perform or skip. If the argument contains a pattern metacharacter other than a lone period, it is interpreted as a Perl regular expression and applies to test names that match the pattern. If the argument contains a lone period or does not contain any pattern metacharacters, it is interpreted the same way as previously and matches test names that begin with the argument value. For example, --do-test=testa matches tests that begin with testa, --do-test=main.testa matches tests in the main test suite that begin with testa, and --do-test=main.testa matches test names that contain main followed by testa with anything in between. In the latter case, the pattern match is not anchored to the beginning of the test name, so it also matches names such as xmainytesta.
——do-test和——skip-test选项的参数还允许更灵活地说明要执行或跳过哪些测试。如果参数包含模式元字符而不是单个句点,则将其解释为Perl正则表达式,并应用于匹配该模式的测试名称。如果参数包含一个单独的句点或不包含任何模式元字符,则它的解释方式与前面相同,并匹配以参数值开头的测试名称。例如,——do-test=testa匹配以testa开头的测试,——do-test=main。Testa匹配主测试套件中以Testa开头的测试,并且——do-test=main。
testa匹配包含main后跟testa以及中间任何内容的测试名。在后一种情况下,模式匹配没有固定在测试名的开头,因此它也匹配诸如xmainytesta之类的名称。

It is also possible to put a list of test names in a file and have mysql-test-run.pl run those tests, using the option --do-test-list=file. The tests should be listed one per line in the file. A line beginning with # indicates a comment and is ignored. Similary an empty line in the file is also ignored.
也可以在文件中放入一个测试名称列表,并使用选项——do-test-list=file让mysql-test-run.pl运行这些测试。应该在文件中每行列出一个测试。以#开头的行表示注释,将被忽略。类似地,文件中的空行也会被忽略。

mysql-test-run.pl also supports a --do-suite option, which is similar to --do-test but permits specifying entire suites of tests to run.
pl还支持——do-suite选项,它类似于——do-test,但允许指定要运行的测试的整个套件。

To perform setup prior to running tests, mysql-test-run.pl needs to invoke mysqld with the --initialize and --skip-grant-tables options. If MySQL was built with the compiler flag -DDISABLE_GRANT_OPTIONS, then --initialize, --skip-grant-tables, and --init-file will be disabled. To handle this, set the MYSQLD_BOOTSTRAP environment variable to the full path name of a server that has all options enabled. mysql-test-run.pl will use that server to perform setup; it is not used to run the tests.
为了在运行测试之前执行设置,mysql-test-run.pl需要使用——initialize和——skip-grant-tables选项调用mysqld。如果MySQL是用编译器标志-DDISABLE_GRANT_OPTIONS构建的,那么——initialize,——skip-grant-tables和——init-file将被禁用。要处理这个问题,可以将MYSQLD_BOOTSTRAP环境变量设置为启用了所有选项的服务器的完整路径名。Mysql-test-run.pl将使用该服务器执行设置;它不用于运行测试。

The init_file test will fail if --init-file is disabled. This is an expected failure in this case.
如果禁用——init-file, init_file测试将失败。在这种情况下,这是一个预期的失败。

To run mysql-test-run.pl on Windows, you'll need either Cygwin or ActiveState Perl to run it. You may also need to install the modules required by the script. To run the test script, change location into the mysql-test directory, set the MTR_VS_CONFIG environment variable to the configuration you selected earlier (or use the --vs-config option), and invoke mysql-test-run.pl. For example (using Cygwin and the bash shell):
要在Windows上运行mysql-test-run.pl,您需要Cygwin或ActiveState Perl来运行它。您可能还需要安装脚本所需的模块。要运行测试脚本,将位置更改为mysql-test目录,将MTR_VS_CONFIG环境变量设置为您之前选择的配置(或者使用——vs-config选项),并调用mysql-test-run.pl。例如(使用Cygwin和bash shell):

shell> cd mysql-test
shell> export MTR_VS_CONFIG=debug
shell> ./mysqltest-run.pl --force --timer
shell> ./mysqltest-run.pl --force --timer --ps-protocol

mysql-test-run.pl uses several environment variables. Some of them are listed in the following table. Some of these are set from the outside and used by mysql-test-run.pl, others are set by mysql-test-run.pl instead, and may be referred to in tests.
pl使用了几个环境变量。下表列出了其中一些。其中一些是在外部设置的,由mysql-test-run.pl使用,其他则由mysql-test-run.pl设置,可以在测试中引用。

Variable Description
EXE_MYSQL Path to the mysql client executable
MTR_BUILD_THREAD If set, defines which port number range is used for the server
MTR_MAX_PARALLEL If set, defines maximum number of parallel threads if --parallel=auto is given
MTR_MEM If set to anything, will run tests with files in "memory" using tmpfs or ramdisk. Not available on Windows. Same as --mem option
MTR_NAME_TIMEOUT Setting of a timeout in minutes or seconds, corresponding to command line option --name-timeout. Avaliable timeout names are TESTCASE, SUITE (both in minutes) and START, SHUTDOWN, CTEST (all in seconds). MTR_CTEST_TIMEOUT is for ctest unit tests.
MTR_PARALLEL If set, defines number of parallel threads executing tests. Same as --parallel option
MTR_PORT_BASE If set, defines which port number range is used for the server
MTR_RECORD Set to 1 if a MTR run is started with --record option, 0 otherwise.
MTR_UNIQUE_IDS_DIR The method in which the free ports are allocated is by maintaining a list under the unique ids directory. In case there are multiple chroot environments on the same host, then the same set of ports may get allocated for all environments, because there will be multiple unique ids directories in different physical locations, but MTR assumes it is the same directory. This will lead to a conflict while reserving ports for the different MTR runs. To avoid this problem, when using chroot environments, MTR_UNIQUE_IDS_DIR environment variable can be set to a common location, so that all the MTR processes will use the same unique ids directory. Users have to make sure this variable is set to the same path on all environments, and that this common path is mounted on all the environments.
MYSQL Full path to mysql client executable ,along with options passed to server.
MYSQL_BIN_PATH Path to the directory having mysql binaries.
MYSQL_CLIENT_BIN_PATH Path to the directory having client binaries.
MYSQL_CONFIG_EDITOR Path name to mysql_config_editor binary.
MYSQL_OPTIONS Options passed to server when connecting from mysql client.
MYSQL_TEST Path name to mysqltest binary
MYSQL_TEST_DIR Full path to the mysql-test directory where tests are being run from
MYSQL_TEST_LOGIN_FILE Path name to login file used by mysql_config_editor. If not set, the default is $HOME/.mylogin.cnf, or %APPDATA%\MySQL.mylogin.cnf on Windows.
MYSQL_TMP_DIR Path to temp directory used for temporary files during tests
MYSQLD Full path to server executable used in tests.
MYSQLD_BOOTSTRAP Full path name to mysqld that has all options enabled
MYSQLD_BOOTSTRAP_CMD Full command line used for initial database setup for this test batch
MYSQLD_CMD Command line for starting server as used in tests, with the minimum set of required arguments.
MYSQLTEST_VARDIR Path name to the var directory that is used for logs, temporary files, and so forth
NUMBER_OF_CPUS Defines number of processors.
TSAN_OPTIONS Path name to a file containing ThreadSanitizer suppressions.

The variable MTR_PORT_BASE is a more logical replacement for the original variable MTR_BUILD_THREAD. It gives the actual port number directly (will be rounded down to a multiple of 10). If you use MTR_BUILD_THREAD, the port number is found by multiplying this by 10 and adding 10000.
变量MTR_PORT_BASE是原始变量MTR_BUILD_THREAD的更合乎逻辑的替代。它直接给出实际的端口号(将四舍五入到10的倍数)。如果使用MTR_BUILD_THREAD,则通过将其乘以10并加上10000来找到端口号。

The variable MYSQL contains path to mysql client executable along with options .
变量MYSQL包含路径MYSQL客户端可执行连同选项。

Tests sometimes rely on certain environment variables being defined. For example, certain tests assume that MYSQL_TEST is defined so that mysqltest can invoke itself with exec MYSQL_TEST调用自身。

Other tests may refer to the last three variables listed in the preceding table, to locate files to read or write. For example, tests that need to create files will typically put them in MYSQL_TMP_DIR/file_name. 其他测试可能引用上表中列出的最后三个变量,以定位要读或写的文件。例如,需要创建文件的测试通常会将它们放在MYSQL_TMP_DIR/file_name中。

The variable MYSQLD_CMD将包括所有添加了——mysqld选项到mysql-test-run.pl的服务器选项,但不包括为当前运行的测试添加的服务器选项。

mysql-test-run.pl supports the options in the following list. An argument of – tells mysql-test-run.pl not to process any following arguments as options.
mysql-test-run.pl 支持以下列表中的选项。参数-告诉mysql-test-run.pl不要将以下任何参数作为选项处理。

  • --help, -h

    Display a help message and exit.
    显示帮助信息并退出。

  • --big-test

    Allow tests marked as "big" to run. Tests can be thus marked by including the line --source include/big_test.inc, and they will only be run if this option is given, or if the environment variable BIG_TEST is set to 1.
    允许运行标记为“大”的测试。因此,可以通过包含一行——source include/big_test来标记测试。只有当给出了这个选项,或者环境变量BIG_TEST被设置为1时,它们才会运行。

    This is typically done for tests that take very long to run, or that use very much resources, so that they are not suitable for running as part of a normal test suite run.
    这通常用于运行时间很长或使用大量资源的测试,因此它们不适合作为普通测试套件运行的一部分运行。

    If both --big-test and --only-big-tests are given, --only-big-tests is ignored.
    如果两者都有——大的考试和——只有大的考试,——只有大的考试被忽略。

    Note

    • This option is enabled by default when test cases are specified on command line.
      当测试用例在命令行上指定时,这个选项默认启用。
  • --boot-dbx

    Run the mysqld server used for bootstrapping the database through the dbx debugger.
    运行mysqld服务器,通过dbx调试器引导数据库。

  • --boot-ddd

    Run the mysqld server used for bootstrapping the database through the ddd debugger.
    运行mysqld服务器,通过ddd调试器引导数据库。

  • --boot-gdb

    Run the mysqld server used for bootstrapping the database through the gdb debugger.
    运行mysqld服务器,通过gdb调试器引导数据库。

    See also the --manual-boot-gdb option.
    另请参阅——manual-boot-gdb选项。

  • --build-thread=number

    Specify a number to calculate port numbers from. The formula is 10 * build_thread + 10000. Instead of a number, it can be set to auto, which is also the default value, in which case mysql-test-run.pl will allocate a number unique to this host.
    指定一个数字来计算端口号。公式是10 * build_thread + 10000。它可以被设置为auto,而不是一个数字,这也是默认值,在这种情况下,mysql-test-run.pl将为这个主机分配一个唯一的数字。

    The value (number or auto) can also be set with the MTR_BUILD_THREAD environment variable.
    这个值(number或auto)也可以用MTR_BUILD_THREAD环境变量来设置。

    This option is kept for backward compatibility. The more logical --port-base is recommended instead.
    保留这个选项是为了向后兼容。相反,建议使用更符合逻辑的——port-base。

  • --callgrind

    Instructs valgrind to use callgrind.
    指导valgrind使用callgrind。

  • --charset-for-testdb=charset_name

    Specify the default character set for the test database. The default value is latin1.
    为测试数据库指定默认字符集。默认值为latin1。

  • --check-testcases

    Check test cases for side effects. This is done by checking the system state before and after each test case. If there is any difference, the test case is marked as failed because of it.
    检查测试用例的副作用。这是通过在每个测试用例前后检查系统状态来完成的。如果存在任何差异,测试用例就会因此被标记为失败。

    Similarly, when --check-testcases option is enabled, MTR does additional check for missing .result file and a test case not having its corresponding .result file is marked as failed.
    类似地,当启用——check-testcases选项时,MTR会对缺少的.result文件进行额外的检查,并且没有相应的.result文件的测试用例会被标记为失败。

    This check is enabled by default. To disable it, use the --nocheck-testcases option.
    这个检查是默认启用的。要禁用它,可以使用——nocheck-testcases选项。

  • --clean-vardir

    Clean up the var directory with logs and test results etc. after the test run, but only if there were no test failures. This option only has effect if also running with option --mem. The intent is to alleviate the problem of using up memory for test results, in cases where many different test runs are being done on the same host.
    在测试运行后清理var目录,包括日志和测试结果等,但只有在没有测试失败的情况下。此选项仅在与选项——mem一起运行时有效。这样做的目的是在同一台主机上运行多个不同的测试时,缓解测试结果内存耗尽的问题。

  • --client-bindir=path

    The path to the directory where client binaries are located.
    客户端二进制文件所在目录的路径。

  • --client-dbx

    Start mysqltest in the dbx debugger.
    在dbx调试器中启动mysqltest。

  • --client-ddd

    Start mysqltest in the ddd debugger.
    在ddd调试器中启动mysqltest。

  • --client-debugger=debugger

    Start mysqltest in the named debugger.
    在命名调试器中启动mysqltest。

  • --client-gdb

    Start mysqltest in the gdb debugger.
    在gdb调试器中启动mysqltest。

  • --client-libdir=path

    The path to the directory where client libraries are located.
    客户端库所在目录的路径。

  • --colored-diff

    Colorize the diff part of the output.
    对输出的差值部分着色。

    When this option is enabled, mysql-test-run.pl passes --colored-diff option to mysqltest. If colored diff is enabled, mysqltest uses diff command with --color='always' option to print the colored diff.
    当这个选项被启用时,mysql-test-run.pl将——colored-diff选项传递给mysqltest。如果有色的差异被启用,mysqltest使用diff命令和——color='always'选项来打印有色的差异。

    Note

    • --color option for diff command is available from GNU diffutils version 3.4.
      diff命令的——color选项在GNU diffutils 3.4版本中可用。
  • --combination=value

    Extra option to pass to mysqld. The value should consist of a single mysqld option including dashes. This option is similar to --mysqld but has a different effect. mysql-test-run.pl executes multiple test runs, using the options for each instance of --combination in successive runs. If --combination is given only once, it has no effect and behaves similar to --mysqld option.
    传递给mysqld的额外选项。该值应该包含一个mysqld选项,包括破折号。这个选项类似于——mysqld,但是有不同的效果。Mysql-test-run.pl执行多个测试运行,在连续运行中使用每个——combination实例的选项。如果——combination只给出一次,它没有效果,行为类似于——mysqld选项。

    If a test being run, passes the same --mysqld option from an opt file which is also passed from --combination, then that --combination run is skipped because opt file always takes higher precedence over command line options. The test will just run once using the options provided in the opt file.
    如果正在运行一个测试,从一个opt文件中传递同样的——mysqld选项,这个选项也从——combination中传递,那么——combination运行将被跳过,因为opt文件总是比命令行选项具有更高的优先级。使用opt文件中提供的选项,测试只运行一次。

    For test runs specific to a given test suite, an alternative to the use of --combination is to create a combinations file in the suite directory. The file should contain a section of options for each test run. See Passing Options from mysql-test-run.pl to mysqld or mysqltest.
    对于特定于给定测试套件的测试运行,使用——combination的另一种方法是在套件目录中创建一个组合文件。该文件应该包含每个测试运行的选项部分。请参阅将选项从mysql-test-run.pl传递给mysqld或mysqltest。

    For test specific combinations, onc can use test_name.combinations file in the test directory.
    对于特定于测试的组合,onc可以使用test目录下的test_name.combination文件。

  • --comment=str

    Write str to the output within lines filled with #, as a form of banner.
    在填充#的行中将str写入输出,作为横幅的一种形式。

  • --compress

    Compress all information sent between the client and the server if both support compression.
    压缩客户端和服务器之间发送的所有信息,如果两者都支持压缩。

  • --cursor-protocol

    Pass the --cursor-protocol option to mysqltest (implies --ps-protocol).
    将——cursor-protocol选项传递给mysqltest(暗示——ps-protocol)。

  • --dbx

    Start mysqld in the dbx debugger.
    在dbx调试器中启动mysqld。

  • --ddd

    Start mysqld in the ddd debugger.
    在ddd调试器中启动mysqld。

  • --debug

    Dump trace output for all clients and servers.
    转储所有客户机和服务器的跟踪输出。

  • --debugger=debugger

    Start mysqld using the named debugger.
    使用命名调试器启动mysqld。

  • --debug-common

    This option works similar to --debug but turns on debug only for the debug macro keywords query, info, error, enter, exit which are considered the most commonly used.
    该选项的工作方式类似于——debug,但只对调试宏关键字query, info, error, enter, exit打开调试,这些关键字被认为是最常用的。

  • --debug-server

    Runs mysqld.debug (if available) instead of mysqld as server. If it does find mysqld.debug, it will search for plugin libraries in a subdirectory debug under the directory where it's normally located. This option does not turn on trace output and is independent of the debug option.
    运行mysqld.debug(如果可用)而不是mysqld作为服务器。如果它找到了mysqld.debug,它将在它通常所在目录下的子目录debug中搜索插件库。此选项不会打开跟踪输出,并且独立于调试选项。

  • --debug-sync-timeout=seconds

    Controls whether the Debug Sync facility for testing and debugging is enabled. The option value is a timeout in seconds. The default value is 300. A value of 0 disables Debug Sync. The value of this option also becomes the default timeout for individual synchronization points.
    控制是否启用用于测试和调试的“调试同步”功能。选项值为超时时间,单位为秒。缺省值是300。值0禁用调试同步。这个选项的值也会成为各个同步点的默认超时。

    mysql-test-run.pl passes --loose-debug-sync-timeout=seconds to mysqld. The --loose prefix is used so that mysqld does not fail if Debug Sync is not compiled in.
    Mysql-test-run.pl传递——loose-debug-sync-timeout=seconds给mysqld。使用——loose前缀,这样mysqld在没有编译调试同步时也不会失败。

    For information about using the Debug Sync facility for testing, see Thread Synchronization in Test Cases.
    有关使用调试同步工具进行测试的信息,请参见测试用例中的线程同步。

  • ---default-myisam

    Use MyISAM as the default storage engine for all except InnoDB-specific tests. This option is off by default.
    除了innodb特定的测试,所有测试都使用MyISAM作为默认存储引擎。这个选项默认是关闭的。

  • --defaults-file=file_name

    Use the named file as fixed config file template for all tests.
    使用命名文件作为所有测试的固定配置文件模板。

  • --defaults_extra_file=file_name

    Add setting from the named file to all generated configs.
    将命名文件中的设置添加到所有生成的配置。

  • --do-suite=prefix or regex

    Run all test cases from suites having a name that begins with the given prefix value or matches the regular expression. If the argument matches no existing suite, mysql-test-run.pl aborts.
    运行名称以给定前缀值开头或匹配正则表达式的套件中的所有测试用例。如果参数不匹配现有套件,mysql-test-run.pl将终止。

    The argument for the --do-suite option allows more flexible specification of which tests to perform. See the description of the --do-test option for details.
    do-suite选项允许更灵活地说明要执行哪些测试。详细信息请参见——do-test选项的描述。

    In case a suite or a list of suites is specified using the --suite option along with a pattern or regular expression given through --do-suite, only suite(s) from the list which match the prefix or regular expression are picked up.
    如果使用——suite选项指定套件或套件列表,以及通过——do-suite给出的模式或正则表达式,则只从列表中选取匹配前缀或正则表达式的套件。

    When the --do-suite option is specified more than once on the command line, only the last occurrence is considered.
    当在命令行上不止一次地指定——do-suite选项时,只考虑最后一次出现。

  • --do-test=prefix or regex

    Run all test cases having a name that begins with the given prefix value or matches the regular expression. This option provides a convenient way to run a family of similarly named tests.
    运行名称以给定的前缀值开头或匹配正则表达式的所有测试用例。此选项提供了一种方便的方式来运行一系列命名类似的测试。

    The argument for the --do-test option allows more flexible specification of which tests to perform. If the argument contains a pattern metacharacter other than a lone period, it is interpreted as a Perl regular expression and applies to test names that match the pattern. If the argument contains a lone period or does not contain any pattern metacharacters, it is interpreted the same way as previously and matches test names that begin with the argument value. For example, --do-test=testa matches tests that begin with testa, --do-test=main.testa matches tests in the main test suite that begin with testa, and --do-test=main.testa matches test names that contain main followed by testa with anything in between. In the latter case, the pattern match is not anchored to the beginning of the test name, so it also matches names such as xmainytestz.
    do-test选项允许更灵活地说明要执行哪些测试。如果参数包含模式元字符而不是单个句点,则将其解释为Perl正则表达式,并应用于匹配该模式的测试名称。如果参数包含一个单独的句点或不包含任何模式元字符,则它的解释方式与前面相同,并匹配以参数值开头的测试名称。例如,——do-test=testa匹配以testa开头的测试,——do-test=main。Testa匹配主测试套件中以Testa开头的测试,并且——do-test=main。
    testa匹配包含main后跟testa以及中间任何内容的测试名。在后一种情况下,模式匹配没有固定在测试名称的开头,因此它也匹配诸如xmainytestz之类的名称。

  • --do-test-list=file

    Run all tests listed in the file file. In this file, tests should be listed one per line in any of the following forms.
    运行文件文件中列出的所有测试。在这个文件中,测试应该以下列任何一种形式每行列出一个。

    
    .test
    .
    ..test
    path_to_the_test_file
    

    Path to the test file should either be an absolute path or a relative path from base directory.
    测试文件的路径应该是一个绝对路径或一个相对路径从基本目录。

    To run a test present in a non-default test suite, either the test name qualified with the suite name i.e suite_name.test_name[.test] or a path to the test file should be mentioned.
    要运行一个存在于非默认测试套件中的测试,可以使用套件名限定测试名,例如suite_name.test_name[。Test]或测试文件的路径应该被提及。

    A line beginning with # will be ignored and is considered as a comment. Similarly an empty line in the file is also ignored.
    以#开头的行将被忽略,并被视为注释。类似地,文件中的空行也会被忽略。

    For example, consider a test list file test_list containing following tests.
    例如,考虑一个包含以下测试的测试列表文件test_list。

    # Main suite test '1st.test'
    1st
    1st.test
    main.1st
    main.1st.test
    mysql-test/t/1st.test
    
    # GIS suite test 'geohash_functions.test'
    gis.geohash_functions
    mysql-test/suite/gis/t/geohash_functions.test
    
    # Non-default suite 'test_services'
    test_services.test_services
    mysql-test/suite/test_services/t/test_services.test
    
    # Internal suite test 'i_main.user_var'
    i_main.user_var
    internal/mysql-test/suite/i_main/t/user_var.test
    

    Following command runs the list of tests mentioned in the file.
    下面的命令运行文件中提到的测试列表。

    ./mysql-test-run.pl --do-test-list=test_list
    

    If both --suite and --do-test-list are given, and if suite name is not part of the test names listed in the file, then those tests are searched only in the suites mentioned in --suite option.
    如果同时给出了——suite和——do-test-list,并且套件名称不是文件中列出的测试名称的一部分,则只在——suite选项中提到的套件中搜索这些测试。

  • --enable-disabled

    Ignore any disabled.def file, and run also tests marked as disbaled. Success or failure of those tests will be reported the same way as other tests.
    忽略任何disabled.def文件,并运行标记为disabled的测试。这些测试的成功或失败将以与其他测试相同的方式报告。

    Note

    • This option is enabled by default when test cases are specified on command line.
      当测试用例在命令行上指定时,这个选项默认启用。
  • --explain-protocol

    Run EXPLAIN EXTENDED on all SELECT, INSERT, REPLACE, UPDATE and DELETE queries.
    在所有的SELECT、INSERT、REPLACE、UPDATE和DELETE查询上运行EXPLAIN extension。

  • --extern option=value

    Use an already running server. The option/value pair is what is needed by the mysql client to connect to the server. Each --extern can only take one option/value pair as argument, so it you need more you need to repeat --extern for each of them.
    使用已经在运行的服务器。选项/值对是mysql客户端连接到服务器所需要的。每个——extern只能接受一个选项/值对作为参数,所以你需要对每个变量重复——extern。

    ./mysql-test-run.pl --extern socket=var/tmp/mysqld.1.sock main.1st
    

    During server initialization, mysql-test-run.pl creates a default database test which is used while establishing an initial connection with the server. When running a test case with –extern option, if test database doesn't exist on an already running server, then the test case will fail with following error.
    在服务器初始化期间,mysql-test-run.pl创建一个默认数据库test,在与服务器建立初始连接时使用该数据库。当使用-extern选项运行测试用例时,如果已经运行的服务器上不存在测试数据库,则测试用例将失败,并出现以下错误。

    mysqltest: Could not open connection 'default': 1049 Unknown database 'test'
    

    So if you're running a test case on an already running server using –extern option, it is necessary to create test database on the server before running the test case if it doesn't exist.
    因此,如果您使用-extern选项在已经运行的服务器上运行测试用例,如果测试用例不存在,则有必要在运行测试用例之前在服务器上创建测试数据库。

    Similarly, mysql-test-run.pl creates mtr database during server initialization which contains tables and procedures used to suppress global or test specific warnings. If a test case refers to this database and the database doesn't exist on running server, then the test case will fail.
    类似地,mysql-test-run.pl在服务器初始化期间创建mtr数据库,其中包含用于抑制全局或测试特定警告的表和过程。如果测试用例引用了这个数据库,并且运行的服务器上不存在这个数据库,那么测试用例将失败。

    Note

    • If a test case has an .opt file that requires the server to be restarted with specific options, the file will not be used. The test case likely will fail as a result.
      如果测试用例有一个.opt文件,要求服务器使用特定选项重新启动,则不会使用该文件。因此,测试用例可能会失败。
  • --fast

    Do not perform controlled shutdown when servers need to be restarted or at the end of the test run. This is equivalent to using --shutdown-timeout=0.
    当服务器需要重新启动或在测试运行结束时,不要执行受控关机。这相当于使用——shutdown-timeout=0。

  • --force

    Normally, mysql-test-run.pl exits if a test case fails. --force causes execution to continue regardless of test case failure.
    通常,如果测试用例失败,mysql-test-run.pl将退出。——force导致执行继续,不管测试用例失败。

  • --force-restart

    Always restart the server(s) between each tast case, whether it's needed or not. Will also restart between repeated runs of the same test case. This may be useful e.g. when looking for the source of a memory leak, as there will only have been one test run before the server exits.
    无论是否需要,总是在每个测试案例之间重新启动服务器。也将在相同测试用例的重复运行之间重新启动。这可能很有用,例如,当寻找内存泄漏的来源时,因为在服务器退出前只会运行一次测试。

    Enabling this option will cause mysql-test-run.pl to restart the server(s) on a newly intialized data directory.
    启用这个选项将导致mysql-test-run.pl在一个新初始化的数据目录上重新启动服务器。

    This option can also be mentioned in test-name-master.opt file for a test case to restart the server(s) before it runs.
    这个选项也可以在test-name-master中提到。为测试用例选择文件,以便在运行之前重新启动服务器。

  • --gcov

    Run tests with the gcov test coverage tool.
    使用gcov测试覆盖率工具运行测试。

  • --gdb

    Start mysqld in the gdb debugger.
    在gdb调试器中启动mysqld。

  • --gprof

    Run tests with the gprof profiling tool.
    使用gprof分析工具运行测试。

  • --include-ndbcluster, --include-ndb

    Run also tests that need Cluster.
    还运行需要Cluster的测试。

  • --initialize=value

    Extra bootstrap options that need be to be passed during the server initialization process can be passed as a value to --initialize. The server is then started with the specified value. Only one option may be specified in value; to specify more than one, use additional --initialize options.
    在服务器初始化过程中需要传递的额外引导选项可以作为一个值传递给——initialize。然后使用指定的值启动服务器。只能在value中指定一个选项;要指定多个,请使用附加的——initialize选项。

    Options passed as a value to --mysqld will have precedence over the options passed to --initialize, regardless of the order in which they passed on the command line.
    作为值传递给——mysqld的选项将优先于传递给——initialize的选项,不管它们在命令行上传递的顺序如何。

  • --json-explain-protocol

    Run EXPLAIN FORMAT=JSON on all SELECT, INSERT, REPLACE, UPDATE and DELETE queries.
    对所有SELECT、INSERT、REPLACE、UPDATE和DELETE查询执行EXPLAIN FORMAT=JSON。

  • --manual-boot-gdb

    This option is similar to --boot-gdb but attaches the debugger to the server during the bootstrapping process, permitting the use of a remote debugger.
    该选项类似于——boot-gdb,但在引导过程中将调试器附加到服务器,允许使用远程调试器。

  • --manual-dbx

    Use a server that has already been started by the user in the dbx debugger.
    使用一个用户已经在dbx调试器中启动的服务器。

  • --manual-ddd

    Use a server that has already been started by the user in the ddd debugger.
    在ddd调试器中使用用户已经启动的服务器。

  • --manual-debug

    Use a server that has already been started by the user in a debugger.
    在调试器中使用用户已经启动的服务器。

  • --manual-gdb

    Use a server that has already been started by the user in the gdb debugger.
    使用用户已经在gdb调试器中启动的服务器。

  • --mark-progress

    Marks progress with timing (in milliseconds) and line number in var/log/testname.progress.
    在var/log/testname.progress中使用计时(毫秒)和行号标记进度。

  • --max-connections=num

    The maximum number of simultaneous server connections that may be used per test. If not set, the maximum is 128. Minimum allowed limit is 8, maximum is 5120. Corresponds to the same option for mysqltest.
    每次测试可同时使用的最大服务器连接数。如果未设置,则最大为128。最小允许的数量是8,最大是5120。对应于mysqltest的相同选项。

  • --max-save-core=N

    Limit the number of core files saved, to avoid filling up disks in case of a frequently crashing server. Defaults to 5, set to 0 for no limit. May also be set with the environment variable MTR_MAX_SAVE_CORE.
    限制保存的核心文件的数量,避免在服务器频繁崩溃的情况下填满磁盘。默认为5,设置为0表示无限制。也可以使用环境变量MTR_MAX_SAVE_CORE进行设置。

  • --max-save-datadir=N

    Limit the number of data directories saved after failed tests, to avoid filling up disks in case of frequent failures. Defaults to 20, set to 0 for no limit. May also be set with the environment variable MTR_MAX_SAVE_DATADIR.
    限制测试失败后保存的数据目录数量,避免频繁失败时磁盘被填满。默认值为20,设置为0表示无限制。也可以使用环境变量MTR_MAX_SAVE_DATADIR进行设置。

  • --max-test-fail=N

    Stop execution after the specified number of tests have failed, to avoid using up resources (and time) in case of massive failures. retries are noe counted. Defaults to 10, set to 0 for no limit. May also be set with the environment variable MTR_MAX_TEST_FAIL.
    在指定数量的测试失败后停止执行,以避免在出现大量失败时耗尽资源(和时间)。重试不计算在内。默认为10,设置为0表示无限制。也可以使用环境变量MTR_MAX_TEST_FAIL进行设置。

  • --mem

    This option is not supported on Windows and on MacOS.
    Windows和MacOS不支持此选项。

    Run the test suite in memory, using tmpfs or ramdisk. This can decrease test times significantly, in particular if you would otherwise be running over a remote file system. mysql-test-run.pl attempts to find a suitable location using a built-in list of standard locations for tmpfs and puts the var directory there. This option also affects placement of temporary files, which are created in var/tmp.
    使用tmpfs或ramdisk在内存中运行测试套件。这可以显著减少测试时间,特别是在您将在远程文件系统上运行时。pl尝试使用TMPFS的标准位置的内置列表找到合适的位置,并将var目录放在那里。此选项还影响在var/tmp中创建的临时文件的放置。

    The default list includes /dev/shm, /run/shm and /tmp. You can also enable this option by setting the environment variable MTR_MEM[=dir_name]. If dir_name is given, it is added to the beginning of the list of locations to search, so it takes precedence over any built-in locations.
    默认列表包括“/dev/shm”、“/run/shm”和“/tmp”。也可以通过设置环境变量MTR_MEM[=dir_name]来启用该选项。如果给出了dir_name,它将被添加到要搜索的位置列表的开头,因此它优先于任何内置位置。

    Once you have run tests with --mem within a mysql-test directory, a soflink var will have been set up to the temporary directory, and this will be re-used the next time, until the soflink is deleted. Thus, you do not have to repeat the --mem option next time.
    一旦你在mysql-test目录中使用——mem运行测试,soflink的var就会被设置到临时目录中,这个var会在下一次被重用,直到soflink被删除。因此,下次不必重复——mem选项。

  • --mysqld=value

    Extra option to pass to mysqld. Only one option may be specified in value; to specify more than one, use additional –mysqld options. See Passing Options from mysql-test-run.pl to mysqld or mysqltest.
    传递给mysqld的额外选项。只能在value中指定一个选项;要指定多个选项,可以使用附加的-mysqld选项。请参阅将选项从mysql-test-run.pl传递给mysqld或mysqltest。

  • --mysqld-env=variable=value

    Sets (or changes) an environment variable before starting mysqld. Varibles set in the environment from which you run mysql-test-run.pl will normally also be propagated to mysqld, but there may be cases where you want a setting just for a single run, or you may not want the setting to affect other programs. You may use additional --mysqld-env options to set more than one variable.
    在启动mysqld之前设置(或更改)一个环境变量。在运行mysql-test-run.pl的环境中设置的变量通常也会传播到mysqld,但在某些情况下,您可能只希望设置一次运行,或者不希望该设置影响其他程序。你可以使用额外的——mysqld-env选项来设置多个变量。

  • --mysqltest=options

    Extra options to pass to mysqltest.
    传递给mysqltest的额外选项。

  • --ndb-connectstring=str

    Pass --ndb-connectstring=str to the master MySQL server. This option also prevents mysql-test-run.pl from starting a cluster. It is assumed that there is already a cluster running to which the server can connect with the given connectstring.
    将——ndb-connectstring=str传递给MySQL主服务器。这个选项还可以防止mysql-test-run.pl启动集群。假设已经有一个集群在运行,服务器可以使用给定的connectstring连接到该集群。

  • --no-skip

    This option forces all tests to run, ignoring any --skip commands used in the test. This ensures that all tests are run. An excluded list (excludenoskip.list) is maintained to track which tests should continue to be skipped. The --no-skip option continues to skip the tests that are named in the excluded list. In case the test or file invoking the --skip command is not present in the excluded list, the outcome of the test will be identified as [ noskip-pass ] or [ noskip-fail ] .The default value of –no-skip introduced variable is OFF, which implies users are not forced to run all tests unless the –no-skip is explicitly used.
    此选项强制运行所有测试,忽略测试中使用的任何——skip命令。这将确保运行所有测试。维护排除列表(excludenoskip.list)以跟踪应该继续跳过哪些测试。——no-skip选项继续跳过排除列表中指定的测试。如果测试调用——跳过命令或文件不存在在排除列表中,测试的结果将被认定为[noskip-pass]或[noskip-fail],没有跳过引入变量的默认值,这意味着用户不强制运行所有的测试,除非显式地使用没有跳过。

    shell> mysql-test-run.pl --suite=innodb --no-skip
    
  • --nocheck-testcases

    Disable the check for test case side effects. For additional information, see the description of the --check-testcases option.
    禁用测试用例副作用的检查。有关其他信息,请参见——check-testcases选项的描述。

  • --noreorder

    Do not reorder tests to reduce number of restarts, but run them in exactly the order given. If a whole suite is to be run, the tests are run in alphabetic order, though similiar combinations will be grouped together. If more than one suite is listed, the tests are run one suite at a time, in the order listed.
    不要重新排序测试以减少重新启动的次数,而是按照给定的顺序运行它们。如果要运行整个套件,那么测试将按照字母顺序运行,尽管相似的组合将被组合在一起。如果列出了多个套件,则测试按列出的顺序一次只运行一个套件。

  • --notimer

    Cause mysqltest not to generate a timing file. The effect of this is that the report from each test case does not include the timing in milliseconds as it normally does.
    导致mysqltest不生成计时文件。这样做的结果是,来自每个测试用例的报告不像通常那样包括以毫秒为单位的时间。

  • --nounit-tests

    Do not run unit tests, overriding default behavior or setting of the MTR_UNIT_TESTS variable.
    不要运行单元测试,覆盖MTR_UNIT_TESTS变量的默认行为或设置。

  • --nowarnings

    Do not look for and report errors and warning in the server logs.
    不要在服务器日志中查找并报告错误和警告。

    Note

    • In addition to being passed as a command-line option, --nowarnings can also be passed in the .opt file of a test case.
      除了作为命令行选项传递外,——nowarnings也可以在测试用例的.opt文件中传递。
  • --only-big-tests

    This option causes only big tests to run. Normal (non-big) tests are skipped. If both --big-test and --only-big-tests are given, --only-big-tests is ignored.
    这个选项只会导致运行大型测试。跳过普通(非大型)测试。如果两者都有——大的考试和——只有大的考试,——只有大的考试被忽略。

  • --opt-trace-protocol

    Prints the optimizer trace of SQL statements in a test. Running any MTR test with this option executes the following SQL statement after every DML statement that it encounters:
    打印测试中SQL语句的优化器跟踪。使用该选项运行MTR测试时,在遇到的每个DML语句之后执行以下SQL语句:

    SELECT trace FROM information_schema.optimizer_trace /* injected by --opt-trace-protocol */;
    
  • --parallel={N|auto}

    Run tests using N parallel threads. By default, 1 thread is used. Use --parallel=auto to set N automatically.
    使用N个并行线程运行测试。默认情况下,使用1个线程。使用——parallel=auto自动设置N。

    Setting the MTR_PARALLEL environment variable to N has the same effect as specifying --parallel=N.
    将MTR_PARALLEL环境变量设置为N与指定——parallel=N具有相同的效果。

    The MTR_MAX_PARALLEL environment variable, if set, specifies the maximum number of parallel workers that can be spawned when the --parallel=auto option is specified. If --parallel=auto is not specified, MTR_MAX_PARALLEL variable has no effect.
    MTR_MAX_PARALLEL环境变量,如果设置,将指定——parallel=auto选项时可以生成的最大并行工作者数量。如果没有指定——parallel=auto, MTR_MAX_PARALLEL变量不起作用。

  • --port-base=P

    Specify base of port numbers to be used; a block of 10 will be allocated. P should be divisible by 10; if it is not, it will be rounded down. If running with more than one parallel test thread, thread 2 will use the next block of 10 and so on.
    指定要使用的端口号基数;将分配一个10的块。P应该能被10整除;如果不是,则将其四舍五入。如果运行多个并行测试线程,线程2将使用下一个10的块,以此类推。

    If the port number is given as auto, which is also the default, mysql-test-run.pl will allocate a number unique to this host. The value may also be given with the environment variable MTR_PORT_BASE.
    如果将端口号指定为auto(这也是默认值),那么mysql-test-run.pl将为该主机分配一个唯一的编号。该值也可以通过环境变量MTR_PORT_BASE给出。

    --port-base was added as a more logical alternative to --build-thread. If both are used, --port-base takes precedence.
    添加——port-base作为——build-thread的一个更合乎逻辑的替代。如果两者都使用,则——port-base优先。

  • --print-testcases

    Do not run any tests, but print details about all tests, in the order they would have been run.
    不要运行任何测试,但按运行测试的顺序打印有关所有测试的详细信息。

  • --ps-protocol

    Pass the --ps-protocol option to mysqltest.
    将——ps-protocol选项传递给mysqltest。

  • --quiet

    Reuse the output buffer and maintain a single line for reporting successful tests, skipped tests and disabled tests. Failed tests and the necessary information about the failure will be printed on a separate line.
    重用输出缓冲区,并维护一行用于报告成功测试、跳过测试和禁用测试。失败的测试和有关失败的必要信息将在单独一行中打印。

    When --quiet option is enabled, MTR prints only the test name and result of the test run.
    当启用——quiet选项时,MTR只打印测试名称和测试运行的结果。

  • --record

    Pass the --record option to mysqltest. This option requires a specific test case to be named on the command line.
    将——record选项传递给mysqltest。这个选项需要在命令行上命名一个特定的测试用例。

  • --reorder

    Reorder tests to minimize the number of server restarts needed. This is the default behavior. There is no guarantee that a particular set of tests will always end up in the same order.
    重新排序测试,以尽量减少需要重新启动的服务器数量。这是默认行为。不能保证一组特定的测试将总是以相同的顺序结束。

  • --repeat=N

    Run each test N number of times, in parallel if --parallel option value is greater than 1.
    每个测试运行N次,如果——parallel选项值大于1,则并行运行。

  • --report-features

    Display the output of SHOW ENGINES and SHOW VARIABLES. This can be used to verify that binaries are built with all required features.
    显示“显示引擎”和“显示变量”的输出。这可以用来验证二进制文件是否包含了所有需要的特性。

  • --report-times

    At the end of the test run, write a summary of how much time was spent in various phases of execution. If you run with --parallel, the total will exceed the wall clock time passed, since it will be summed over all threads.
    在测试运行的最后,写一个关于在执行的各个阶段花费了多少时间的摘要。如果使用——parallel运行,则总时间将超过所经过的挂钟时间,因为它将对所有线程求和。

    The times reported should only be treated as approximations, and the exact points where the time is taken may also change between releases. If the test run is aborted, including if a test fails and --force is not in use, the time report will not be produced.
    所报告的时间应该只作为近似值,而且在不同版本之间所花费的时间也可能会发生变化。如果测试运行被终止,包括测试失败和——force未使用,则不会生成时间报告。

  • --report-unstable-tests

    The option can be used to distinguish unstable tests which pass on at least one retry attempt from hard failing ones. Unstable tests are reported separately in the end summary in the format: test_name(num_of_failures/num_of_attempts).
    该选项可用于区分至少通过一次重试尝试的不稳定测试和严重失败的测试。不稳定测试在最后的摘要中分别报告,格式为test_name(num_of_failures/num_of_attempts)。

    In case all failures encountered are due to unstable tests, MTR will print the below warning and exit with a zero status code.
    如果遇到的所有故障都是由于不稳定的测试造成的,MTR将打印以下警告并以零状态代码退出。

    mysql-test-run: WARNING: There are failures due to unstable test cases.
    However, the tests are not hard-failing.
    

    This option has no effect unless --force is used and both --retry and --retry-failure are set to values greater than 1.
    除非使用——force并且——retry和——retry-failure的值都设置为大于1,否则此选项无效。

  • --retry=N

    If a test fails, it is retried up to a maximum of N runs, but will terminate after 2 failures. Default is 3, set to 1 or 0 for no retries. This option has no effect unless --force is also used; without it, test execution will terminate after the first failure.
    如果测试失败,将重试最多N次,但在2次失败后将终止。默认为3,当不重试时设置为1或0。这个选项没有效果,除非——force也被使用;如果没有它,测试执行将在第一次失败后终止。

    The --retry and --retry-failure options do not affect how many times a test repeated with --repeat may fail in total, as each repetition is considered a new test case, which may in turn be retried if it fails.
    ——retry和——retry-failure选项不影响使用——repeat可能总共失败的测试重复的次数,因为每次重复都被认为是一个新的测试用例,如果它失败了,则可以依次重新尝试。

  • --retry-failure=N

    Allow a failed and retried test to fail more than the default 2 times before giving it up. Setting it to 0 or 1 effectively turns off retries
    允许一个失败并重试的测试失败超过默认的2次,然后放弃它。将其设置为0或1可以有效地关闭重试

  • --sanitize

    Scan the server log files for warnings from various sanitizers. Use of this option assumes that MySQL was configured with -DWITH_ASAN or -DWITH_UBSAN.
    扫描服务器日志文件以获取来自各种杀毒程序的警告。使用这个选项假设MySQL配置了-DWITH_ASAN或-DWITH_UBSAN。

    The TSAN_OPTIONS environment variable can be set to specify the path name of a file containing ThreadSanitizer suppressions.
    可以设置TSAN_OPTIONS环境变量来指定包含ThreadSanitizer抑制的文件的路径名。

  • --shutdown-timeout=seconds

    Max number of seconds to wait for servers to do controlled shutdown before killing them. Default is 10.
    在服务器被杀死之前,等待服务器进行受控关闭的最大秒数。默认是10。

  • --skip-combinations

    Do not apply combinations; ignore combinations file or option.
    不要应用组合;忽略组合文件或选项。

  • --skip-ndbcluster, --skip-ndb

    Do not start NDB Cluster; skip Cluster test cases. This option only has effect if you do have NDB, if not it will have no effect as it cannot run those tests anyway.
    不启动NDB集群;跳过集群测试用例。这个选项只有在你有NDB的情况下才有效果,如果没有,它将没有效果,因为它无论如何都不能运行那些测试。

  • --skip-ndbcluster-slave, --skip-ndb-slave

    Do not start an NDB Cluster slave.
    不要启动NDB集群slave。

  • --skip-rpl

    Skip replication test cases.
    跳过复制测试用例。

  • --skip-test=regex

    Specify a regular expression to be applied to test case names. Cases with names that match the expression are skipped. tests to skip.
    指定要应用于测试用例名称的正则表达式。名称匹配表达式的情况将被跳过。测试跳过。

    The argument for the --skip-test option allows more flexible specification of which tests to skip. If the argument contains a pattern metacharacter other than a lone period, it is interpreted as a Perl regular expression and applies to test names that match the pattern. See the description of the --do-test option for details.
    ——skip-test选项的参数允许更灵活地说明要跳过哪些测试。如果参数包含模式元字符而不是单个句点,则将其解释为Perl正则表达式,并应用于匹配该模式的测试名称。详细信息请参见——do-test选项的描述。

  • --skip-test-list=file

    Specify a file listing tests that should be skipped (disabled).
    指定一个文件,列出应该跳过(禁用)的测试。

    The file has the same format as the disabled.def file listing disabled tests. With this option, disabling can be done on a case by case basis.
    该文件具有与列出已禁用测试的disabled.def文件相同的格式。有了这个选项,可以根据具体情况禁用。

  • --skip-*

    --skip-* options not otherwise recognized by mysql-test-run.pl are passed to the master server.
    mysql-test-run.pl无法识别的选项被传递给主服务器。

  • --sp-protocol

    Pass the --sp-protocol option to mysqltest.
    将——sp-protocol选项传递给mysqltest。

  • --start

    Initialize and start servers with the startup settings for the specified test case. You can use this option to start a server to which you can connect later. For example, after building a source distribution you can start a server and connect to it with the mysql client like this:
    使用指定测试用例的启动设置初始化并启动服务器。您可以使用此选项启动稍后可以连接到的服务器。例如,在构建了一个源发布之后,你可以启动一个服务器,并像这样用mysql客户端连接到它:

    shell> cd mysql-test
    shell> ./mysql-test-run.pl --start alias &
    shell> ../mysql -S ./var/tmp/master.sock -h localhost -u root
    

    If no tests are named on the command line, the server(s) will be started with settings for the first test that would have been run without the --start option.
    如果命令行上没有命名任何测试,则服务器将使用第一个测试的设置启动,该设置将在没有——start选项的情况下运行。

    mysql-test-run.pl will stop once the server has been started, but will terminate if the server dies. If killed, it will also shut down the server.
    Mysql-test-run.pl将在服务器启动后停止,但在服务器死亡时也将终止。如果被杀死,它也会关闭服务器。

  • --start-and-exit

    This is similar to --start, but mysql-test-run.pl terminates once the server has been started, leaving just the server process running.
    这类似于——start,但是mysql-test-run.pl在服务器启动后终止,只留下服务器进程在运行。

  • --start-dirty

    This is similar to --start, but will skip the database initialization phase and assume that database files are already available. Usually this means you must have run another test first.
    这类似于——start,但将跳过数据库初始化阶段,并假设数据库文件已经可用。通常这意味着您必须先运行另一个测试。

  • --start-from=test_name

    mysql-test-run.pl sorts the list of names of the test cases to be run, and then begins with test_name.
    mysql-test-run.pl对要运行的测试用例的名称列表进行排序,然后以test_name开头。

  • --strace-client

    Create strace output for mysqltest. Will produce default strace output as mysqltest.strace. Note that this will be overwritten for each new test case, so it's most useful for running only one test.
    创建mysqltest的strace输出。将生成默认的strace输出为mysqltest.strace。请注意,对于每个新的测试用例,这将被覆盖,所以只运行一个测试是最有用的。

    The strace-client option is only supported on Linux.
    strace-client选项仅在Linux上支持。

  • --strace-server

    Create strace output for the server. Will produce default strace output as mysqld.1.strace. Note that this will be overwritten each time the server is restarted, so it's most useful for running a single test, or if you want trace from the first test that fails.
    为服务器创建strace输出。将生成默认的strace输出为mysqld.1.strace。请注意,每次服务器重新启动时,这将被覆盖,因此对于运行单个测试,或者希望跟踪第一个失败的测试,这是最有用的。

    The strace-server option is available on Linux only.
    strace-server选项仅在Linux上可用。

  • --stress=stress options

    Start a server, but instead of running a test, run mysql-stress-test.pl with the supplied arguments. Arguments needed to communicate with the server will be automatically provided, the rest should be given as arguments to this option. Command line options for mysql-stress-test.pl should be separeted by a comma.
    启动服务器,但不是运行测试,而是使用提供的参数运行mysql-stress .pl。与服务器通信所需的参数将自动提供,其余应作为该选项的参数。mysql-stress-test.pl的命令行选项应该用逗号分隔。

  • --suite(s)={suite_name|suite_list|suite_set}

    Run a suite or a comma separated list of suites or those suites which fall under the specified suite set. If the option is not specified explicitly, MTR assumes that it needs to use the default suite set for the test run.
    运行一个套件或以逗号分隔的套件列表,或属于指定套件集的那些套件。如果没有显式指定该选项,MTR将假设它需要为测试运行使用默认套件集。

    The suite set's MTR can use are case insensitive and take the below values:
    套件集的MTR可以使用不区分大小写,并取以下值:

    default     - To run the default list of suites.
    all         - To scan the mysql directory and run all available suites.
    non-default - To scan the mysql directory for available suites and
                  collect only the non-default suites.
    

    The suite set 'all' is used implicitly if neither a suite nor a suite list is specified and
    如果既没有指定套件也没有指定套件列表,则隐式使用套件集“all”
    (i) There are tests given on the MTR command line or
    对MTR命令行或进行了测试
    (ii) Any of the following options are used: –do-suite, –do-test, –do-test-list.
    可以使用以下选项:-do-suite、-do-test、-do-test -list。

    Note that suite sets 'all' and 'non-default' do not include ndb test suites in case ndb cluster is not enabled.
    注意套件集'all'和'non-default'在ndb集群未启用的情况下不包含ndb测试套件。

    If a suite set is specified in the suite list, MTR does not treat it as a suite set and considers it as the name of a suite to be run.
    如果在套件列表中指定了套件集,MTR不会将其视为套件集,而是将其视为要运行的套件的名称。

  • --suite-timeout=minutes

    Specify the maximum test suite runtime in minutes.
    指定以分钟为单位的最大测试套件运行时。

  • --summary-report=file_name

    Generate a plain text version of the test summary only and write it to the file named as the option argument. The file is suitable for sending by email.
    只生成测试摘要的纯文本版本,并将其写入名为option参数的文件中。这个文件适合通过电子邮件发送。

  • --test-progress[={0|1}]

    Print the percentage of tests completed. This option is enabled by default. The argument to --test-progress is optional. To disable it, set the value to 0.
    打印已完成测试的百分比。这个选项默认是启用的。——test-progress的参数是可选的。若要禁用,请将该值设置为0。

    For example, consider a test suite sample_test_suite containing 3 tests.
    例如,考虑一个包含3个测试的测试套件sample_test_suite。

    ./mysql-test-run.pl --suite=sample_test_suite [--test-progress]
    

    Running the suite with --test-progress option enabled will print the percentage of tests completed.
    运行启用了——test-progress选项的套件将打印测试完成的百分比。

    [ 33%] sample_test_suite.1st                           [ pass ]      1
    [ 66%] sample_test_suite.2nd                           [ pass ]      1
    [100%] sample_test_suite.3rd                           [ pass ]      1
    
  • --testcase-timeout=minutes

    Specify the maximum test case runtime in minutes.
    指定以分钟为单位的最大测试用例运行时。

    Note

    • When a test case is run with valgrind option enabled, the test case timeout value becomes 10 times the specified value. For example, running a test case with timeout value 1 minute and valgrind enabled will increase the timeout value to 10 minutes.
      当启用valgrind选项运行测试用例时,测试用例超时值变为指定值的10倍。例如,运行一个超时值为1分钟且启用valgrind的测试用例,将使超时值增加到10分钟。
  • --timediff

    Adds to each test report for a test case, the total time in seconds and milliseconds passed since the preceding test ended. This option can only be used together with --timestamp, and has no effect without it.
    为一个测试用例添加到每个测试报告中,自前一个测试结束后以秒和毫秒为单位的总时间。这个选项只能与——timestamp一起使用,没有它就没有效果。

  • --timer

    Cause mysqltest to generate a timing file. The default file is named ./var/log/timer.
    导致mysqltest生成一个计时文件。默认文件名为。/var/log/timer。

  • --timestamp

    Prints a timestamp before the test case name in each test report line, showing when the test ended.
    在每个测试报告行中,在测试用例名称之前打印一个时间戳,显示测试何时结束。

  • --tmpdir=path

    The directory where temporary file are stored. The default location is ./var/tmp. The environment variable MYSQL_TMP_DIR will be set to the path for this directory, whether it has the default value or has been set explicitly. This may be referred to in tests.
    存放临时文件的目录。默认位置是./var/tmp。环境变量MYSQL_TMP_DIR将被设置为该目录的路径,无论它具有默认值还是已显式设置。这可能会在测试中提到。

  • --unit-tests

    Force running of unit tests, overriding default behavior or setting of the MTR_UNIT_TESTS variable.
    强制运行单元测试,覆盖MTR_UNIT_TESTS变量的默认行为或设置。

  • --unit-tests-report

    Extend the unit test run by also outputting the log from the test run, independently of whether it succeeded or not. This option implies --unit-tests so it is not necessary to specify both.
    通过输出测试运行的日志来扩展单元测试运行,而不管测试是否成功。这个选项意味着——单元测试,所以没有必要同时指定这两个。

  • --user=user_name

    The MySQL user name to use when connecting to the server.
    连接到服务器时使用的MySQL用户名。

  • --user-args

    Drops all non-essential command line arguments to the mysqld server, except those supplied with --mysqld arguemnts, if any. Only works in combination with --start, --start-and-exit or --start-dirty, and only if no test name is given.
    删除所有非必要的命令行参数到mysqld服务器,除了那些附带——mysqld参数的参数(如果有的话)。仅在与——start、——start-and-exit或——start-dirty组合使用时有效,且仅在没有给出测试名的情况下有效。

  • --valgrind

    Run mysqltest and mysqld with valgrind. This and the following --valgrind options require that the executables have been build with valgrind support.
    运行mysqltest和mysqld与valgrind。这个和下面的valgrind选项要求使用valgrind支持构建可执行文件。

    When the server is run with valgrind, an extra pass over the server log file(s) will be performed after all tests are run, and any report with problems that have been reported at server shutdown will be extracted and printed. The most common warnings are memory leaks. With each report will also be listed all tests that were run since previous server restart; one of these is likely to have caused the problem.
    当服务器使用valgrind运行时,将在所有测试运行后执行一次额外的服务器日志文件传递,并且将提取并打印在服务器关闭时报告的任何问题报告。最常见的警告是内存泄漏。每个报告还将列出自上一次服务器重新启动以来运行的所有测试;问题可能是由其中一个引起的。

    A final "pseudo" test named valgrind_report is added to the list of tests when the server is run in valgrind. This test is reported as failed if any such shutdown warnings were produced by valgrind. Pass or failure of this test is also added to the total test count reported.
    当服务器在valgrind中运行时,最后一个名为valgrind_report的“伪”测试被添加到测试列表中。如果valgrind产生任何此类关闭警告,则将此测试报告为失败。此测试的通过或失败也会添加到报告的总测试计数中。

    Note

    • When a test case is run with valgrind option enabled, the test case timeout value becomes 10 times the specified value. For example, running a test case with timeout value 1 minute and valgrind enabled will increase the timeout value to 10 minutes.
      当启用valgrind选项运行测试用例时,测试用例超时值变为指定值的10倍。例如,运行一个超时值为1分钟且启用valgrind的测试用例,将使超时值增加到10分钟。
  • --valgrind-clients

    Run all clients started by .test files with valgrind. This option requires valgrind 3.9 or later.
    使用valgrind运行所有由.test文件启动的客户端。该选项需要valgrind 3.9或更高版本。

  • --valgrind-mysqld

    Run the mysqld server with valgrind.
    使用valgrind运行mysqld服务器。

  • --valgrind-mysqltest

    Run mysqltest with valgrind.
    使用valgrind运行mysqltest。

  • --valgrind-option=str

    Extra options to pass to valgrind.
    额外选择通过valgrind。

  • --valgrind-path=path

    Specify the path name to the valgrind executable.
    指定valgrind可执行文件的路径名。

  • --vardir=path

    Specify the path where files generated during the test run are stored. The default location is ./var. The environment variable MYSQLTEST_VARDIR will be set to the path for this directory, whether it has the default value or has been set explicitly. This may be referred to in tests.
    指定存储测试运行期间生成的文件的路径。默认位置是./var。环境变量MYSQLTEST_VARDIR将被设置为该目录的路径,无论它具有默认值还是已显式设置。这可能会在测试中提到。

  • --verbose

    Give more verbose output regarding test execution. Note that the output generated within each test case is not affected.

  • --verbose-restart

    Write when and why servers are restarted between test cases.
    给出关于测试执行的更详细的输出。注意,在每个测试用例中生成的输出不会受到影响。

  • --view-protocol

    Pass the --view-protocol option to mysqltest.
    将——view-protocol选项传递给mysqltest。

  • --vs-config=config_val

    Specify the configuration used to build MySQL (for example, –vs-config=debug –vs-config=release). This option is for Windows only.
    指定用于构建MySQL的配置(例如,-vs-config =debug -vs-config =release)。此选项仅适用于Windows。

  • --wait-all

    If --start or --start-dirty is used, wait for all servers to exit before termination. Otherise, it will terminate if one (of several) servers is restarted.
    如果使用了——start或——start-dirty,则在终止前等待所有服务器退出。否则,如果重启一个(多个)服务器,它将终止。

  • --warnings

    Search the server log for errors or warning after each test and report any suspicious ones; if any are found, the test will be marked as failed. This is the default behavior, it may be turned off with --nowarnings.
    在每次测试后搜索服务器日志查找错误或警告,并报告任何可疑的错误;如果找到了,测试将被标记为失败。这是默认行为,可以通过——nowarnings关闭。

  • --with-ndbcluster-only, --with-ndb-only

    Run only ndb tests. If no suites are explicitly given, this option also skip all non ndb suites without checking individual test names.
    只运行ndb测试。如果没有显式给出套件,该选项也会跳过所有非ndb套件,而不检查单个测试名称。

  • --xml-report=file_name

    Generate an xml file containing result of the test run and write it to the file named as the option argument. It includes suite-wise and overall statistics like the number of tests run, number of failures, number of disabled and skipped tests along with information about each individual test according to its outcome.
    生成一个包含测试运行结果的xml文件,并将其写入名为option参数的文件。它包括适合的总体统计信息,如运行的测试数量、失败数量、禁用和跳过的测试数量,以及根据结果有关每个测试的信息。

    The xml report's structure can be found below :
    xml报告的结构如下:

    
      
         
         
              ... 
         
      
    
    

Note

  • The hostname resolves to 127.0.0.1 and not to the actual IP address.
    主机名解析为127.0.0.1,而不是实际的IP地址。

你可能感兴趣的:(mtr mysql-test-run.pl — Run MySQL Test Suite)