2197.2.2
by Andrew Hutchings
Add basic contributing section to docs |
1 |
.. _test-run-label: |
2 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
3 |
**********************************
|
4 |
test-run.pl - Drizzle testing tool
|
|
5 |
**********************************
|
|
6 |
||
7 |
Synopsis
|
|
8 |
========
|
|
9 |
||
10 |
**./test-run** [ *OPTIONS* ] [ TESTCASE ] |
|
11 |
||
12 |
Description
|
|
13 |
===========
|
|
14 |
||
15 |
:program:`test-run.pl` (aka test-run, dtr, mtr) is used to execute tests |
|
16 |
from the Drizzle test suite. These tests are included with Drizzle |
|
17 |
distributions and provide a way for users to verify that the system will |
|
18 |
operate according to expectations. |
|
19 |
||
20 |
The tests use a diff-based paradigm, meaning that the test runner executes |
|
21 |
a test and then compares the results received with pre-recorded expected |
|
22 |
results. In the event of a test failure, the program will provide output |
|
23 |
highlighting the differences found between expected and actual results; this |
|
24 |
can be useful for troubleshooting and in bug reports. |
|
25 |
||
26 |
While most users are concerned with ensuring general functionality, the |
|
27 |
program also allows a user to quickly spin up a server for ad-hoc testing |
|
28 |
and to run the test-suite against an already running Drizzle server. |
|
29 |
||
30 |
Running tests
|
|
31 |
=========================
|
|
32 |
||
33 |
There are several different ways to run tests using :program:`test-run.pl`. |
|
34 |
||
35 |
It should be noted that unless :option:`--force` is used, the program will |
|
36 |
stop execution upon encountering the first failing test. |
|
37 |
:option:`--force` is recommended if you are running several tests - it will |
|
38 |
allow you to view all successes and failures in one run. |
|
39 |
||
40 |
Running individual tests
|
|
41 |
------------------------
|
|
42 |
If one only wants to run a few, specific tests, they may do so this way::
|
|
43 |
||
44 |
./test-run [OPTIONS] test1 [test2 ... testN]
|
|
45 |
||
46 |
Running all tests within a suite
|
|
47 |
--------------------------------
|
|
48 |
Many of the tests supplied with Drizzle are organized into suites. |
|
49 |
||
50 |
The tests within drizzle/tests/t are considered the 'main' suite. |
|
1892.4.2
by patrick crews
Minor improvements / edits to the test-run documentation |
51 |
Other suites are located in either drizzle/tests/suite or within the various |
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
52 |
directories in drizzle/plugin. Tests for a specific plugin should live in |
53 |
the plugin's directory - drizzle/plugin/example_plugin/tests |
|
54 |
||
55 |
To run the tests in a specific suite::
|
|
56 |
||
57 |
./test-run [OPTIONS] --suite=SUITENAME
|
|
58 |
||
1892.4.4
by patrick crews
Additional minor edits to test-run docs |
59 |
Running specific tests within a suite
|
60 |
--------------------------------------
|
|
61 |
To run a specific set of tests within a suite::
|
|
62 |
||
63 |
./test-run [OPTIONS] --suite=SUITENAME TEST1 [TEST2..TESTN]
|
|
64 |
||
65 |
Calling tests using <suitename>.<testname> currently does not work. |
|
66 |
One must specify the test suite via the :option:`--suite` option. |
|
67 |
||
68 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
69 |
Running all available tests
|
70 |
---------------------------
|
|
71 |
Currently, the quickest way to execute all tests in all suites is |
|
72 |
to use 'make test' from the drizzle root. |
|
73 |
||
74 |
Otherwise, one should simply name all suites::
|
|
75 |
||
76 |
./test-run [OPTIONS] --suite=SUITE1, SUITE2, ...SUITEN
|
|
77 |
||
78 |
Interpreting test results
|
|
79 |
=========================
|
|
80 |
The output of the test runner is quite simple. Every test should pass. |
|
1892.4.5
by patrick crews
Added url for reporting bugs in the test-run docs |
81 |
In the event of a test failure, please take the time to file a bug here: |
82 |
*https://bugs.launchpad.net/drizzle*
|
|
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
83 |
|
1892.4.2
by patrick crews
Minor improvements / edits to the test-run documentation |
84 |
During a run, the program will provide the user with: |
85 |
* test name (suite + name) |
|
86 |
* test status (pass/fail/skipped)
|
|
87 |
* time spent executing each test
|
|
88 |
||
89 |
At the end of a run, the program will provide the user with a listing of: |
|
90 |
* how many tests were run |
|
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
91 |
* how many tests failed
|
1892.4.2
by patrick crews
Minor improvements / edits to the test-run documentation |
92 |
* percentage of passing tests
|
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
93 |
* a listing of failing tests
|
94 |
* total time spent executing the tests
|
|
95 |
||
96 |
Example output::
|
|
97 |
||
1892.4.2
by patrick crews
Minor improvements / edits to the test-run documentation |
98 |
<snip>
|
99 |
main.snowman [ pass ] 9
|
|
100 |
main.statement_boundaries [ pass ] 17
|
|
101 |
main.status [ pass ] 12
|
|
102 |
main.strict [ pass ] 50
|
|
103 |
main.subselect [ pass ] 6778
|
|
104 |
main.subselect2 [ pass ] 51
|
|
105 |
main.subselect3 [ fail ]
|
|
106 |
drizzletest: At line 621: query 'select a, (select max(b) from t1) into outfile
|
|
107 |
<snip>
|
|
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
108 |
--------------------------------------------------------------------------------
|
109 |
Stopping All Servers
|
|
110 |
Failed 10/231 tests, 95.67% were successful.
|
|
111 |
||
112 |
The log files in var/log may give you some hint
|
|
113 |
of what went wrong.
|
|
114 |
If you want to report this error, go to:
|
|
115 |
http://bugs.launchpad.net/drizzle |
|
116 |
The servers were restarted 16 times |
|
117 |
Spent 64.364 of 115 seconds executing testcases |
|
118 |
||
119 |
drizzle-test-run in default mode: *** Failing the test(s): main.exp1
|
|
120 |
main.func_str main.loaddata main.null main.outfile main.subselect3 |
|
121 |
main.warnings jp.like_utf8 jp.select_utf8 jp.where_utf8 |
|
122 |
||
123 |
Additional uses
|
|
124 |
===============
|
|
125 |
Starting a server for manual testing
|
|
126 |
------------------------------------
|
|
127 |
||
128 |
:program:`test-run.pl` allows a user to get a Drizzle server up and running |
|
129 |
quickly. This can be useful for fast ad-hoc testing. |
|
130 |
||
131 |
To do so call::
|
|
132 |
||
133 |
./test-run --start-and-exit [*OPTIONS*]
|
|
134 |
||
1892.4.3
by patrick crews
Additional minor edits to test-run docs |
135 |
This will start a Drizzle server that you can connect to and query |
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
136 |
|
137 |
Starting a server against a pre-populated DATADIR
|
|
138 |
--------------------------------------------------
|
|
139 |
||
140 |
Using :option:`--start-dirty` prevents :program:`test-run.pl` from attempting |
|
141 |
to initialize (clean) the datadir. This can be useful if you want to use |
|
142 |
an already-populated datadir for testing. |
|
143 |
||
144 |
Program architecture
|
|
145 |
====================
|
|
146 |
||
147 |
:program:`test-run.pl` uses a simple diff-based mechanism for testing. |
|
148 |
It will execute the statements contained in a test and compare the results |
|
149 |
to pre-recorded expected results. In the event of a test failure, you |
|
1892.4.2
by patrick crews
Minor improvements / edits to the test-run documentation |
150 |
will be presented with a diff::
|
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
151 |
|
152 |
main.exp1 [ fail ]
|
|
153 |
--- drizzle/tests/r/exp1.result 2010-11-02 02:10:25.107013998 +0300
|
|
154 |
+++ drizzle/tests/r/exp1.reject 2010-11-02 02:10:32.017013999 +0300
|
|
155 |
@@ -5,4 +5,5 @@
|
|
156 |
a
|
|
157 |
1
|
|
158 |
2
|
|
159 |
+3
|
|
160 |
DROP TABLE t1;
|
|
161 |
||
162 |
A test case consists of a .test and a .result file. The .test file includes |
|
163 |
the various statements to be executed for a test. The .result file lists |
|
164 |
the expected results for a given test file. These files live in tests/t |
|
165 |
and tests/r, respectively. This structure is the same for all test suites. |
|
166 |
||
167 |
test-run.pl options
|
|
168 |
===================
|
|
169 |
||
170 |
The :program:`test-run.pl` tool has several available options: |
|
171 |
||
172 |
./test-run [ OPTIONS ] [ TESTCASE ] |
|
173 |
||
174 |
Options to control what engine/variation to run
|
|
175 |
-----------------------------------------------
|
|
176 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
177 |
.. program:: test-run |
178 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
179 |
.. option:: --compress |
180 |
||
181 |
Use the compressed protocol between client and server |
|
182 |
||
1892.4.3
by patrick crews
Additional minor edits to test-run docs |
183 |
.. option:: --bench |
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
184 |
|
185 |
Run the benchmark suite |
|
186 |
||
187 |
.. option:: --small-bench |
|
188 |
||
189 |
Run the benchmarks with --small-tests --small-tables |
|
190 |
||
191 |
Options to control directories to use
|
|
192 |
-------------------------------------
|
|
193 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
194 |
.. program:: test-run |
195 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
196 |
.. option:: --benchdir=DIR |
197 |
||
198 |
The directory where the benchmark suite is stored |
|
199 |
(default: ../../mysql-bench) |
|
200 |
||
201 |
.. option:: --tmpdir=DIR |
|
202 |
||
203 |
The directory where temporary files are stored |
|
204 |
(default: ./var/tmp). |
|
205 |
||
206 |
.. option:: --vardir=DIR |
|
207 |
||
208 |
The directory where files generated from the test run |
|
209 |
is stored (default: ./var). Specifying a ramdisk or |
|
210 |
tmpfs will speed up tests. |
|
211 |
||
212 |
.. option:: --mem |
|
213 |
||
214 |
Run testsuite in "memory" using tmpfs or ramdisk |
|
215 |
Attempts to find a suitable location |
|
216 |
using a builtin list of standard locations |
|
217 |
for tmpfs (/dev/shm) |
|
218 |
The option can also be set using environment |
|
2210.1.3
by Andrew Hutchings
Fix envvar |
219 |
variable :envvar:`DTR_MEM` =[DIR] |
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
220 |
|
221 |
Options to control what test suites or cases to run
|
|
222 |
---------------------------------------------------
|
|
223 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
224 |
.. program:: test-run |
225 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
226 |
.. option:: --force |
227 |
||
228 |
Continue to run the suite after failure |
|
229 |
||
230 |
.. option:: --do-test=PREFIX or REGEX |
|
231 |
||
232 |
Run test cases which name are prefixed with PREFIX |
|
233 |
or fulfills REGEX |
|
234 |
||
235 |
.. option:: --skip-test=PREFIX or REGEX |
|
236 |
||
237 |
Skip test cases which name are prefixed with PREFIX |
|
238 |
or fulfills REGEX |
|
239 |
||
240 |
.. option:: --start-from=PREFIX |
|
241 |
||
242 |
Run test cases starting from test prefixed with PREFIX |
|
243 |
suite[s]=NAME1,..,NAMEN Collect tests in suites from the comma separated |
|
244 |
list of suite names. |
|
245 |
The default is: "main,jp" |
|
246 |
||
247 |
.. option:: --skip-rpl |
|
248 |
||
249 |
Skip the replication test cases. |
|
250 |
combination="ARG1 .. ARG2" Specify a set of "drizzled" arguments for one |
|
251 |
combination. |
|
252 |
||
253 |
.. option:: --skip-combination |
|
254 |
||
255 |
Skip any combination options and combinations files |
|
256 |
||
257 |
.. option:: --repeat-test=n |
|
258 |
||
259 |
How many times to repeat each test (default: 1) |
|
260 |
||
261 |
Options that specify ports
|
|
262 |
--------------------------
|
|
263 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
264 |
.. program:: test-run |
265 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
266 |
.. option:: --master_port=PORT |
267 |
||
268 |
Specify the port number used by the first master |
|
269 |
||
270 |
.. option:: --slave_port=PORT |
|
271 |
||
272 |
Specify the port number used by the first slave |
|
273 |
||
274 |
.. option:: --dtr-build-thread=# |
|
275 |
||
276 |
Specify unique collection of ports. Can also be set by |
|
2210.1.3
by Andrew Hutchings
Fix envvar |
277 |
setting the environment variable :envvar:`DTR_BUILD_THREAD`. |
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
278 |
|
279 |
Options for test case authoring
|
|
280 |
-------------------------------
|
|
281 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
282 |
.. program:: test-run |
283 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
284 |
.. option:: --record TESTNAME |
285 |
||
286 |
(Re)genereate the result file for TESTNAME |
|
287 |
||
288 |
.. option:: --check-testcases |
|
289 |
||
290 |
Check testcases for sideeffects |
|
291 |
||
292 |
.. option:: --mark-progress |
|
293 |
||
294 |
Log line number and elapsed time to <testname>.progress |
|
295 |
||
296 |
Options that pass on options
|
|
297 |
----------------------------
|
|
298 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
299 |
.. program:: test-run |
300 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
301 |
.. option:: --drizzled=ARGS |
302 |
||
303 |
Specify additional arguments to "drizzled" |
|
304 |
||
305 |
Options to run test on running server
|
|
306 |
-------------------------------------
|
|
307 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
308 |
.. program:: test-run |
309 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
310 |
.. option:: --extern |
311 |
||
312 |
Use running server for tests |
|
313 |
||
314 |
.. option:: --user=USER |
|
315 |
||
316 |
User for connection to extern server |
|
317 |
||
318 |
Options for debugging the product
|
|
319 |
---------------------------------
|
|
320 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
321 |
.. program:: test-run |
322 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
323 |
.. option:: --client-ddd |
324 |
||
325 |
Start drizzletest client in ddd |
|
326 |
||
327 |
.. option:: --client-debugger=NAME |
|
328 |
||
329 |
Start drizzletest in the selected debugger |
|
330 |
||
331 |
.. option:: --client-gdb |
|
332 |
||
333 |
Start drizzletest client in gdb |
|
334 |
||
335 |
.. option:: --ddd |
|
336 |
||
337 |
Start drizzled in ddd |
|
338 |
||
339 |
.. option:: --debug |
|
340 |
||
341 |
Dump trace output for all servers and client programs |
|
342 |
||
343 |
.. option:: --debugger=NAME |
|
344 |
||
345 |
Start drizzled in the selected debugger |
|
346 |
||
347 |
.. option:: --gdb |
|
348 |
||
349 |
Start the drizzled(s) in gdb |
|
350 |
||
351 |
.. option:: --manual-debug |
|
352 |
||
353 |
Let user manually start drizzled in debugger, before running test(s) |
|
354 |
||
355 |
.. option:: --manual-gdb |
|
356 |
||
357 |
Let user manually start drizzled in gdb, before running test(s) |
|
358 |
||
359 |
.. option:: --manual-ddd |
|
360 |
||
361 |
Let user manually start drizzled in ddd, before running test(s) |
|
362 |
||
363 |
.. option:: --master-binary=PATH |
|
364 |
||
365 |
Specify the master "drizzled" to use |
|
366 |
||
367 |
.. option:: --slave-binary=PATH |
|
368 |
||
369 |
Specify the slave "drizzled" to use |
|
370 |
||
371 |
.. option:: --strace-client |
|
372 |
||
373 |
Create strace output for drizzletest client |
|
374 |
||
375 |
.. option:: --max-save-core |
|
376 |
||
377 |
Limit the number of core files saved (to avoid filling up disks for |
|
378 |
heavily crashing server). Defaults to 5, set to 0 for no limit. |
|
379 |
||
380 |
Options for coverage, profiling etc
|
|
381 |
-----------------------------------
|
|
382 |
||
2165.2.3
by Andrew Hutchings
Add favicon to docs |
383 |
.. todo:: |
384 |
||
385 |
.. option:: --gcov |
|
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
386 |
|
2194.5.5
by Andrew Hutchings
Fix options indexing |
387 |
.. program:: test-run |
388 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
389 |
.. option:: --gprof |
390 |
||
391 |
See online documentation on how to use it. |
|
392 |
||
393 |
.. option:: --valgrind |
|
394 |
||
395 |
Run the *drizzletest* and *drizzled* executables using valgrind with |
|
396 |
default options |
|
397 |
||
398 |
.. option:: --valgrind-all |
|
399 |
||
400 |
Synonym for :option:`--valgrind` |
|
401 |
||
402 |
.. option:: --valgrind-drizzleslap |
|
403 |
||
404 |
Run "drizzleslap" with valgrind. |
|
405 |
||
406 |
.. option:: --valgrind-drizzletest |
|
407 |
||
408 |
Run the *drizzletest* and *drizzle_client_test* executable with valgrind |
|
409 |
||
410 |
.. option:: --valgrind-drizzled |
|
411 |
||
412 |
Run the "drizzled" executable with valgrind |
|
413 |
||
414 |
.. option:: --valgrind-options=ARGS |
|
415 |
||
416 |
Deprecated, use :option:`--valgrind-option` |
|
417 |
||
418 |
.. option:: --valgrind-option=ARGS |
|
419 |
||
420 |
Option to give valgrind, replaces default option(s), |
|
421 |
can be specified more then once |
|
422 |
||
423 |
.. option:: --valgrind-path=[EXE] |
|
424 |
||
425 |
Path to the valgrind executable |
|
426 |
||
427 |
.. option:: --callgrind |
|
428 |
||
429 |
Instruct valgrind to use callgrind |
|
430 |
||
431 |
.. option:: --massif |
|
432 |
||
433 |
Instruct valgrind to use massif |
|
434 |
||
435 |
Misc options
|
|
436 |
------------
|
|
437 |
||
2194.5.5
by Andrew Hutchings
Fix options indexing |
438 |
.. program:: test-run |
439 |
||
1892.4.1
by patrick crews
Added Sphinx docs for test-run.pl |
440 |
.. option:: --comment=STR |
441 |
||
442 |
Write STR to the output |
|
443 |
||
444 |
.. option:: --notimer |
|
445 |
||
446 |
Don't show test case execution time |
|
447 |
||
448 |
.. option:: --script-debug |
|
449 |
||
450 |
Debug this script itself |
|
451 |
||
452 |
.. option:: --verbose |
|
453 |
||
454 |
More verbose output |
|
455 |
||
456 |
.. option:: --start-and-exit |
|
457 |
||
458 |
Only initialize and start the servers, using the |
|
459 |
startup settings for the specified test case (if any) |
|
460 |
||
461 |
.. option:: --start-dirty |
|
462 |
||
463 |
Only start the servers (without initialization) for |
|
464 |
the specified test case (if any) |
|
465 |
||
466 |
.. option:: --fast |
|
467 |
||
468 |
Don't try to clean up from earlier runs |
|
469 |
||
470 |
.. option:: --reorder |
|
471 |
||
472 |
Reorder tests to get fewer server restarts |
|
473 |
||
474 |
.. option:: --help |
|
475 |
||
476 |
Get this help text |
|
477 |
||
478 |
.. option:: --testcase-timeout=MINUTES |
|
479 |
||
480 |
Max test case run time (default 15) |
|
481 |
||
482 |
.. option:: --suite-timeout=MINUTES |
|
483 |
||
484 |
Max test suite run time (default 180) |
|
485 |
||
486 |
.. option:: --warnings | log-warnings |
|
487 |
||
488 |
Pass --log-warnings to drizzled |
|
489 |
||
490 |
.. option:: --sleep=SECONDS |
|
491 |
||
492 |
Passed to drizzletest, will be used as fixed sleep time |
|
493 |
||
494 |