1MYSQLTEST(1) MySQL Database System MYSQLTEST(1)
2
3
4
6 mysqltest - program to run test cases
7 mysqltest_embedded - program to run embedded test cases
8
10 mysqltest [options] [db_name]
11
12 mysqltest_embedded [options] [db_name]
13
15 The mysqltest program runs a test case against a MySQL server and
16 optionally compares the output with a result file. This program reads
17 input written in a special test language. Typically, you invoke
18 mysqltest via mysql-test-run.pl rather than invoking it directly.
19
20 mysqltest_embedded is similar but is built with support for the
21 libmysqld embedded server.
22
23 Features of mysqltest:
24
25 · Can send SQL statements to MySQL servers for execution
26
27 · Can execute external shell commands
28
29 · Can test whether the result from an SQL statement or shell command
30 is as expected
31
32 · Can connect to one or more standalone mysqld servers and switch
33 between connections
34
35 · Can connect to an embedded server (libmysqld), if MySQL is compiled
36 with support for libmysqld. (In this case, the executable is named
37 mysqltest_embedded rather than mysqltest.)
38
39 By default, mysqltest reads the test case on the standard input. To run
40 mysqltest this way, you normally invoke it like this:
41
42 shell> mysqltest [options] [db_name] < test_file
43
44 You can also name the test case file with a --test-file=file_name
45 option.
46
47 The exit value from mysqltest is 0 for success, 1 for failure, and 62
48 if it skips the test case (for example, if after checking some
49 preconditions it decides not to run the test).
50
51 mysqltest supports the following options:
52
53 · --help, -?
54
55 Display a help message and exit.
56
57 · --basedir=dir_name, -b dir_name
58
59 The base directory for tests.
60
61 · --character-sets-dir=path
62
63 The directory where character sets are installed.
64
65 · --compress, -C
66
67 Compress all information sent between the client and the server if
68 both support compression.
69
70 · --cursor-protocol
71
72 Use cursors for prepared statements.
73
74 · --database=db_name, -D db_name
75
76 The default database to use.
77
78 · --debug[=debug_options], -#[debug_options]
79
80 Write a debugging log if MySQL is built with debugging support. The
81 default debug_options value is ´d:t:S:i:O,/tmp/mysqltest.trace´.
82
83 · --debug-check
84
85 Print some debugging information when the program exits.
86
87 · --debug-info
88
89 Print debugging information and memory and CPU usage statistics
90 when the program exits.
91
92 · --host=host_name, -h host_name
93
94 Connect to the MySQL server on the given host.
95
96 · --include=file_name, -i file_name
97
98 Include the contents of the given file before processing the
99 contents of the test file. The included file should have the same
100 format as other mysqltest test files. This option has the same
101 effect as putting a --source file_name command as the first line of
102 the test file.
103
104 · --logdir=dir_name
105
106 The directory to use for log files.
107
108 · --mark-progress
109
110 Write the line number and elapsed time to test_file.progress.
111
112 · --max-connect-retries=num
113
114 The maximum number of connection attempts when connecting to
115 server.
116
117 · --max-connections=num
118
119 The maximum number of simultaneous server connections per client
120 (that is, per test). If not set, the maximum is 128. Minimum
121 allowed limit is 8, maximum is 5120.
122
123 This option is available from MySQL 5.1.45.
124
125 · --no-defaults
126
127 Do not read default options from any option files. If used, this
128 must be the first option.
129
130 · --password[=password], -p[password]
131
132 The password to use when connecting to the server. If you use the
133 short option form (-p), you cannot have a space between the option
134 and the password. If you omit the password value following the
135 --password or -p option on the command line, you are prompted for
136 one.
137
138 · --port=port_num, -P port_num
139
140 The TCP/IP port number to use for the connection.
141
142 · --ps-protocol
143
144 Use the prepared-statement protocol for communication.
145
146 · --quiet
147
148 Suppress all normal output. This is a synonym for --silent.
149
150 · --record, -r
151
152 Record the output that results from running the test file into the
153 file named by the --result-file option, if that option is given. It
154 is an error to use this option without also using --result-file.
155
156 · --result-file=file_name, -R file_name
157
158 This option specifies the file for test case expected results.
159 --result-file, together with --record, determines how mysqltest
160 treats the test actual and expected results for a test case:
161
162 · If the test produces no results, mysqltest exits with an error
163 message to that effect, unless --result-file is given and the
164 named file is an empty file.
165
166 · Otherwise, if --result-file is not given, mysqltest sends test
167 results to the standard output.
168
169 · With --result-file but not --record, mysqltest reads the
170 expected results from the given file and compares them with the
171 actual results. If the results do not match, mysqltest writes a
172 .reject file in the same directory as the result file, outputs
173 a diff of the two files, and exits with an error.
174
175 · With both --result-file and --record, mysqltest updates the
176 given file by writing the actual test results to it.
177
178 · --server-arg=value, -A value
179
180 Pass the argument as an argument to the embedded server. For
181 example, --server-arg=--tmpdir=/tmp or --server-arg=--core. Up to
182 64 arguments can be given.
183
184 · --server-file=file_name, -F file_name
185
186 Read arguments for the embedded server from the given file. The
187 file should contain one argument per line.
188
189 · --silent, -s
190
191 Suppress all normal output.
192
193 · --skip-safemalloc
194
195 Do not use memory allocation checking.
196
197 · --sleep=num, -T num
198
199 Cause all sleep commands in the test case file to sleep num
200 seconds. This option does not affect real_sleep commands.
201
202 As of MySQL 5.0.23, an option value of 0 can be used, which
203 effectively disables sleep commands in the test case.
204
205 · --socket=path, -S path
206
207 The socket file to use when connecting to localhost (which is the
208 default host).
209
210 · --sp-protocol
211
212 Execute DML statements within a stored procedure. For every DML
213 statement, mysqltest creates and invokes a stored procedure that
214 executes the statement rather than executing the statement
215 directly.
216
217 · --tail-lines=nn
218
219 Specify how many lines of the result to include in the output if
220 the test fails because an SQL statement fails. The default is 0,
221 meaning no lines of result printed.
222
223 · --test-file=file_name, -x file_name
224
225 Read test input from this file. The default is to read from the
226 standard input.
227
228 · --timer-file=file_name, -m file_name
229
230 If given, the number of millisecond spent running the test will be
231 written to this file. This is used by mysql-test-run.pl for its
232 reporting.
233
234 · --tmpdir=dir_name, -t dir_name
235
236 The temporary directory where socket files are created.
237
238 · --user=user_name, -u user_name
239
240 The MySQL user name to use when connecting to the server.
241
242 · --verbose, -v
243
244 Verbose mode. Print out more information about what the program
245 does.
246
247 · --version, -V
248
249 Display version information and exit.
250
251 · --view-protocol
252
253 Every SELECT statement is wrapped inside a view. This option was
254 added in MySQL 5.0.19.
255
257 Copyright © 2007, 2010, Oracle and/or its affiliates
258
259 This documentation is free software; you can redistribute it and/or
260 modify it only under the terms of the GNU General Public License as
261 published by the Free Software Foundation; version 2 of the License.
262
263 This documentation is distributed in the hope that it will be useful,
264 but WITHOUT ANY WARRANTY; without even the implied warranty of
265 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
266 General Public License for more details.
267
268 You should have received a copy of the GNU General Public License along
269 with the program; if not, write to the Free Software Foundation, Inc.,
270 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
271 http://www.gnu.org/licenses/.
272
273
275 For more information, please refer to the MySQL Reference Manual, which
276 may already be installed locally and which is also available online at
277 http://dev.mysql.com/doc/.
278
280 Sun Microsystems, Inc. (http://www.mysql.com/).
281
282
283
284MySQL 03/31/2010 MYSQLTEST(1)