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 using 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 · --plugin-dir=path
131
132 The directory in which to look for plugins. It may be necessary to
133 specify this option if the default_auth argument is used for the
134 connect() command to specify an authentication plugin but mysqltest
135 does not find it. This option was added in MySQL 5.5.7.
136
137 · --password[=password], -p[password]
138
139 The password to use when connecting to the server. If you use the
140 short option form (-p), you cannot have a space between the option
141 and the password. If you omit the password value following the
142 --password or -p option on the command line, you are prompted for
143 one.
144
145 · --port=port_num, -P port_num
146
147 The TCP/IP port number to use for the connection.
148
149 · --protocol={TCP|SOCKET|PIPE|MEMORY}
150
151 Choose the protocol for communication with the server. SOCKET is
152 default.
153
154 The --protocol option is available from MySQL 5.1.51. It is ignored
155 if running with the embedded server.
156
157 · --ps-protocol
158
159 Use the prepared-statement protocol for communication.
160
161 · --quiet
162
163 Suppress all normal output. This is a synonym for --silent.
164
165 · --record, -r
166
167 Record the output that results from running the test file into the
168 file named by the --result-file option, if that option is given. It
169 is an error to use this option without also using --result-file.
170
171 · --result-file=file_name, -R file_name
172
173 This option specifies the file for test case expected results.
174 --result-file, together with --record, determines how mysqltest
175 treats the test actual and expected results for a test case:
176
177 · If the test produces no results, mysqltest exits with an error
178 message to that effect, unless --result-file is given and the
179 named file is an empty file.
180
181 · Otherwise, if --result-file is not given, mysqltest sends test
182 results to the standard output.
183
184 · With --result-file but not --record, mysqltest reads the
185 expected results from the given file and compares them with the
186 actual results. If the results do not match, mysqltest writes a
187 .reject file in the same directory as the result file, outputs
188 a diff of the two files, and exits with an error.
189
190 · With both --result-file and --record, mysqltest updates the
191 given file by writing the actual test results to it.
192
193 · --server-arg=value, -A value
194
195 Pass the argument as an argument to the embedded server. For
196 example, --server-arg=--tmpdir=/tmp or --server-arg=--core. Up to
197 64 arguments can be given.
198
199 · --server-file=file_name, -F file_name
200
201 Read arguments for the embedded server from the given file. The
202 file should contain one argument per line.
203
204 · --silent, -s
205
206 Suppress all normal output.
207
208 · --skip-safemalloc
209
210 Do not use memory allocation checking.
211
212 · --sleep=num, -T num
213
214 Cause all sleep commands in the test case file to sleep num
215 seconds. This option does not affect real_sleep commands.
216
217 As of MySQL 5.0.23, an option value of 0 can be used, which
218 effectively disables sleep commands in the test case.
219
220 · --socket=path, -S path
221
222 The socket file to use when connecting to localhost (which is the
223 default host).
224
225 · --sp-protocol
226
227 Execute DML statements within a stored procedure. For every DML
228 statement, mysqltest creates and invokes a stored procedure that
229 executes the statement rather than executing the statement
230 directly.
231
232 · --tail-lines=nn
233
234 Specify how many lines of the result to include in the output if
235 the test fails because an SQL statement fails. The default is 0,
236 meaning no lines of result printed.
237
238 · --test-file=file_name, -x file_name
239
240 Read test input from this file. The default is to read from the
241 standard input.
242
243 · --timer-file=file_name, -m file_name
244
245 If given, the number of millisecond spent running the test will be
246 written to this file. This is used by mysql-test-run.pl for its
247 reporting.
248
249 · --tmpdir=dir_name, -t dir_name
250
251 The temporary directory where socket files are created.
252
253 · --user=user_name, -u user_name
254
255 The MySQL user name to use when connecting to the server.
256
257 · --verbose, -v
258
259 Verbose mode. Print out more information about what the program
260 does.
261
262 · --version, -V
263
264 Display version information and exit.
265
266 · --view-protocol
267
268 Every SELECT statement is wrapped inside a view. This option was
269 added in MySQL 5.0.19.
270
272 Copyright © 2007, 2011, Oracle and/or its affiliates. All rights
273 reserved.
274
275 This documentation is free software; you can redistribute it and/or
276 modify it only under the terms of the GNU General Public License as
277 published by the Free Software Foundation; version 2 of the License.
278
279 This documentation is distributed in the hope that it will be useful,
280 but WITHOUT ANY WARRANTY; without even the implied warranty of
281 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
282 General Public License for more details.
283
284 You should have received a copy of the GNU General Public License along
285 with the program; if not, write to the Free Software Foundation, Inc.,
286 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
287 http://www.gnu.org/licenses/.
288
289
291 For more information, please refer to the MySQL Reference Manual, which
292 may already be installed locally and which is also available online at
293 http://dev.mysql.com/doc/.
294
296 Oracle Corporation (http://dev.mysql.com/).
297
298
299
300MySQL 10/19/2011 MYSQLTEST(1)