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