MYSQLTEST(1) MySQL Database System MYSQLTEST(1)
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
The mysqltest program runs a test case against a MySQL 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 MySQL servers for execution
Can execute external shell commands
Can test whether the result from a SQL statement or shell command is as expected
Can connect to one or more standalone mysqld servers and switch between connections
Can connect to an embedded server (libmysqld), if MySQL is compiled with support for libmysqld.
(In this case, the executable is named mysqltest_embedded rather than mysqltest.)
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.
mysqltest supports the following options:
--help, -?
Display a help message and exit.
--basedir=dir_name, -b dir_name
The base directory for tests.
--big-test, -B
Define the mysqltest variable $BIG_TEST as 1.
--character-sets-dir=path
The directory where character sets are installed. This option was added in MySQL 4.1.23, 5.0.32, and
5.1.14.
--compress, -C
Compress all information sent between the client and the server if both support compression.
--cursor-protocol
Use cursors for prepared statements (implies --ps-protocol). This option was added in MySQL 5.0.19.
--database=db_name, -D db_name
The default database to use.
--debug[=debug_options], -#[debug_options]
Write a debugging log if MySQL is built with debugging support. The default debug_options value is
'd:t:S:i:O,/tmp/mysqltest.trace'.
--debug-info
Print some debugging information when the program exits. This option was added in MySQL 5.1.14.
--host=host_name, -h host_name
Connect to the MySQL server on the given host.
--include=file_name, -i file_name
Include the contents of the given file before processing the contents of the test file. The included file
should have the same format as other mysqltest test files. This option has the same effect as putting a
--source file_name command as the first line of the test file. This option was added in MySQL 5.1.7.
--logdir=dir_name
The directory to use for log files. This option was added in MySQL 5.1.14.
--mark-progress
Write the line number and elapsed time to test_file.progress. This option was added in MySQL 4.1.23,
5.0.32, and 5.1.12.
--max-connect-retries=num
The maximum number of connection attempts when connecting to server. This option was added in MySQL
4.1.23, 5.0.23, and 5.1.11.
--no-defaults
Do not read default options from any option files.
--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 --password or
-p option on the command line, you are prompted for one.
--port=port_num, -P port_num
The TCP/IP port number to use for the connection.
--ps-protocol
Use the prepared-statement protocol for communication.
--quiet
Suppress all normal output. This is a synonym for --silent.
--record, -r
Record the output that results from running the test file into the file named by the --result-file
option, if that option is given.
--result-file=file_name, -R file_name
This option specifies the file for test case expected results. --result-file, together with --record,
determines how mysqltest treats the test actual and expected results for a test case:
If the test produces no results, mysqltest exits with an error message to that effect.
Otherwise, if --result-file is not given, mysqltest sends test results to the standard output.
With --result-file but not --record, mysqltest reads the expected results from the given file and
compares them with the actual results. If the results do not match, mysqltest writes a .reject file in
the same directory as the result file and exits with an error.
With both --result-file and --record, mysqltest updates the given file by writing the actual test
results to it.
--server-arg=value, -A value
Pass the argument as an argument to the embedded server. For example, --server-arg=--tmpdir=/tmp or
--server-arg=--core. Up to 64 arguments can be given.
--server-file=file_name, -F file_name
Read arguments for the embedded server from the given file. The file should contain one argument per
line.
--silent, -s
Suppress all normal output.
--skip-safemalloc
Do not use memory allocation checking.
--sleep=num, -T num
Cause all sleep commands in the test case file to sleep num seconds. This option does not affect
real_sleep commands.
As of MySQL 5.0.23, an option value of 0 can be used, which effectively disables sleep commands in the
test case.
--socket=path, -S path
The socket file to use when connecting to localhost (which is the default host).
--sp-protocol
Execute DML statements within a stored procedure. For every DML statement, mysqltest creates and invokes
a stored procedure that executes the statement rather than executing the statement directly. This option
was added in MySQL 5.0.19.
--test-file=file_name, -x file_name
Read test input from this file. The default is to read from the standard input.
--timer-file=file_name, -m file_name
The file where the timing in microseconds is written.
--tmpdir=dir_name, -t dir_name
The temporary directory where socket files are put.
--user=user_name, -u user_name
The MySQL username to use when connecting to the server.
--verbose, -v
Verbose mode. Print out more information what the program does.
--version, -V
Display version information and exit.
--view-protocol
Every SELECT statement is wrapped inside a view. This option was added in MySQL 5.0.19.
COPYRIGHT
Copyright 2006-2007 MySQL AB
This documentation is NOT distributed under a GPL license. Use of this documentation is subject to
the following terms: You may create a printed copy of this documentation solely for your own personal
use. Conversion to other formats is allowed as long as the actual content is not altered or edited in
any way. You shall not publish or distribute this documentation in any form or on any media, except
if you distribute the documentation in a manner similar to how MySQL disseminates it (that is,
electronically for download on a Web site with the software) or on a CD-ROM or similar medium,
provided however that the documentation is disseminated together with the software on the same
medium. Any other use, such as any dissemination of printed copies or use of this documentation, in
whole or in part, in another publication, requires the prior written consent from an authorized
representative of MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly
granted above.
Please email <docs@mysql.com> for more information or if you are interested in doing a translation.
SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed
locally and which is also available online at http://dev.mysql.com/doc/
AUTHOR
MySQL AB (http://www.mysql.com/) This software comes with no warranty.
MySQL 06/19/2007 MYSQLTEST(1)
|