mysqltest (1) Linux Manual Page
NAME
mysqltest – program to run test cases
mysqltest_embedded – program to run embedded test cases
SYNOPSIS
-
mysqltest [options] [db_name]mysqltest_embedded [options] [db_name]
DESCRIPTION
mysqltest program runs a test case against a MariaDB server and optionally compares the output with a result file. This program reads input written in a special test language. Typically, you invoke mysqltest via mysql-test-run.pl rather than invoking it directly.
mysqltest_embedded is similar but is built with support for the libmysqld embedded server.
Features of mysqltest:
- • Can send SQL statements to MariaDB servers for execution
- • Can execute external shell commands
- • Can test whether the result from an SQL statement or shell command is as expected
- • Can connect to one or more standalone
mysqldservers and switch between connections
- • Can connect to an embedded server (libmysqld), if MariaDB is compiled with support for libmysqld. (In this case, the executable is named
mysqltest_embeddedrather thanmysqltest.)
By default, mysqltest reads the test case on the standard input. To run mysqltest this way, you normally invoke it like this:
-
shell > mysqltest[options][db_name] < test_file
You can also name the test case file with a –test-file=file_name option.
The exit value from mysqltest is 0 for success, 1 for failure, and 62 if it skips the test case (for example, if after checking some preconditions it decides not to run the test).
mysqltest supports the following options:
- •
–help,-?Display a help message and exit.
- •
–basedir=dir_name,-bdir_nameThe base directory for tests.
- •
–character-sets-dir=pathThe directory where character sets are installed.
- •
–compress,-CCompress all information sent between the client and the server if both support compression.
- •
–connect-timeout=numThis can be used to set the MYSQL_OPT_CONNECT_TIMEOUT parameter of mysql_options to change the number of seconds before an unsuccessful connection attempt times out.
- •
–continue-on-errorContinue test even if we got an error. This is mostly useful when testing a storage engine to see what from a test file it can execute, or to find all syntax errors in a newly created big test file.
- •
–cursor-protocolUse cursors for prepared statements.
- •
–database=db_name,-Ddb_nameThe default database to use.
- •
–debug[=debug_options],-#[debug_options]Write a debugging log if MariaDB is built with debugging support. The default debug_options value is ‘d:t:S:i:O,/tmp/mysqltest.trace’.
- •
–debug-checkPrint some debugging information when the program exits.
- •
–debug-infoPrint debugging information and memory and CPU usage statistics when the program exits.
- •
–host=host_name,-hhost_nameConnect to the MariaDB server on the given host.
- •
–logdir=dir_nameThe directory to use for log files.
- •
–mark-progressWrite the line number and elapsed time to test_file.progress.
- •
–max-connect-retries=numThe maximum number of connection attempts when connecting to server.
- •
–max-connections=numThe maximum number of simultaneous server connections per client (that is, per test). If not set, the maximum is 128. Minimum allowed limit is 8, maximum is 5120.
- •
–no-defaultsDo not read default options from any option files. If used, this must be the first option.
- •
–non-blocking-apiUse the non-blocking client API for communication.
- •
–overlay-dir=dir_nameOverlay directory.
- •
–password[=password],-p[password]The password to use when connecting to the server. If you use the short option form (
-p), you cannot have a space between the option and the password. If you omit the password value following the–passwordor-poption on the command line, you are prompted for one.
- •
–plugin-dir=dir_nameDirectory for client-side plugins.
- •
–port=port_num,-Pport_numThe TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306).
- •
–prologue=nameInclude the contents of the given file before processing the contents of the test file. The included file should have the same format as other
mysqltesttest files. This option has the same effect as putting a –source file_name command as the first line of the test file.
- •
–protocol={TCP|SOCKET|PIPE|MEMORY}The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want.
- •
–ps-protocolUse the prepared-statement protocol for communication.
- •
–quietSuppress all normal output. This is a synonym for
–silent.
- •
–record,-rRecord the output that results from running the test file into the file named by the
–result-fileoption, if that option is given. It is an error to use this option without also using–result-file.
- •
–result-file=file_name,-Rfile_nameThis option specifies the file for test case expected results.
–result-file, together with–record, determines howmysqltesttreats the test actual and expected results for a test case:- • If the test produces no results,
mysqltestexits with an error message to that effect, unless–result-fileis given and the named file is an empty file.
- • Otherwise, if
–result-fileis not given,mysqltestsends test results to the standard output.
- • With
–result-filebut not–record,mysqltestreads the expected results from the given file and compares them with the actual results. If the results do not match,mysqltestwrites a .reject file in the same directory as the result file, outputs a diff of the two files, and exits with an error.
- • With both
–result-fileand–record,mysqltestupdates the given file by writing the actual test results to it.
- •
–result-format-version=#Version of the result file format to use.
- •
–server-arg=value,-AvaluePass the argument as an argument to the embedded server. For example,
–server-arg=–tmpdir=/tmpor–server-arg=–core. Up to 64 arguments can be given.
- •
–server-file=file_name,-Ffile_nameRead arguments for the embedded server from the given file. The file should contain one argument per line.
- •
–silent,-sSuppress all normal output.
- •
–sleep=num,-TnumCause all sleep commands in the test case file to sleep num seconds. This option does not affect real_sleep commands.
An option value of 0 can be used, which effectively disables sleep commands in the test case.
- •
–socket=path,-SpathThe socket file to use when connecting to localhost (which is the default host).
- •
–sp-protocolExecute DML statements within a stored procedure. For every DML statement,
mysqltestcreates and invokes a stored procedure that executes the statement rather than executing the statement directly.
- •
–sslEnable SSL for connection (automatically enabled with other flags). Disable with
–skip-ssl.
- •
–ssl-ca=nameCA file in PEM format (check OpenSSL docs, implies
–ssl).
- •
–ssl-capath=nameCA directory (check OpenSSL docs, implies
–ssl).
- •
–ssl-cert=nameX509 cert in PEM format (check OpenSSL docs, implies
–ssl).
- •
–ssl-cipher=nameSSL cipher to use (check OpenSSL docs, implies
–ssl).
- •
–ssl-key=nameX509 key in PEM format (check OpenSSL docs, implies
–ssl).
- •
–ssl-crl=nameCertificate revocation list (check OpenSSL docs, implies
–ssl).
- •
–ssl-crlpath=nameCertificate revocation list path (check OpenSSL docs, implies
–ssl).
- •
–ssl-verify-server-certVerify server’s "Common Name" in its cert against hostname used when connecting. This option is disabled by default.
- •
–suite-dir=dir_nameSuite directory.
- •
–tail-lines=nnSpecify how many lines of the result to include in the output if the test fails because an SQL statement fails. The default is 0, meaning no lines of result printed.
- •
–test-file=file_name,-xfile_nameRead test input from this file. The default is to read from the standard input.
- •
–timer-file=file_name,-mfile_nameIf given, the number of microseconds spent running the test will be written to this file. This is used by
mysql-test-run.plfor its reporting.
- •
–tmpdir=dir_name,-tdir_nameThe temporary directory where socket files are created.
- •
–user=user_name,-uuser_nameThe MariaDB user name to use when connecting to the server.
- •
–verbose,-vVerbose mode. Print out more information about what the program does.
- •
–version,-VDisplay version information and exit.
- •
–view-protocolEvery SELECT statement is wrapped inside a view.
COPYRIGHT
Copyright © 2007, 2010, Oracle and/or its affiliates, 2010-2015 MariaDB Foundation
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
SEE ALSO
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
AUTHOR
MariaDB Foundation (http://www.mariadb.org/).
