~drizzle-trunk/drizzle/development

2128.1.1 by patrick crews
Added initial docs for dbqp.py
1
**********************************
2198.5.2 by patrick crews
Added docs for randgen
2
dbqp
2128.1.1 by patrick crews
Added initial docs for dbqp.py
3
**********************************
4
5
Synopsis
6
========
2198.5.2 by patrick crews
Added docs for randgen
7
Drizzle testing tool
2128.1.1 by patrick crews
Added initial docs for dbqp.py
8
9
**./dbqp** [ *OPTIONS* ] [ TESTCASE ]
10
11
Description
12
===========
13
14
:program:`dbqp.py` is BETA software.  It is intended to provide a standardized
15
platform to facilitate Drizzle testing.  
16
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
17
The default mode is 'dtr' and is used to execute tests from the Drizzle 
2128.1.1 by patrick crews
Added initial docs for dbqp.py
18
test suite.  These tests are included with Drizzle distributions and 
19
provide a way for users to verify that the system will operate according
20
to expectations.
21
22
The dtr tests use a diff-based paradigm, meaning that the test runner executes
23
a test and then compares the results received with pre-recorded expected 
24
results.  In the event of a test failure, the program will provide output
25
highlighting the differences found between expected and actual results; this
26
can be useful for troubleshooting and in bug reports.
27
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
28
The program is also integrated with the random query generator testing tool
29
and a 'rangden' mode is available - it will execute randgen tests when
30
provided a path to a randgen installation.  Tests are organized similar to dtr
31
tests, but are .cnf file based.
32
33
A 'cleanup' mode is also available as a convenience - it will simply shutdown
34
any servers that may have been started via start-and-exit.
35
2128.1.1 by patrick crews
Added initial docs for dbqp.py
36
While most users are concerned with ensuring general functionality, the 
37
program also allows a user to quickly spin up a server for ad-hoc testing
38
and to run the test-suite against an already running Drizzle server.
39
40
Running tests
41
=========================
42
43
There are several different ways to run tests using :program:`dbqp.py`.
44
45
It should be noted that unless :option:`--force` is used, the program will
46
stop execution upon encountering the first failing test. 
47
:option:`--force` is recommended if you are running several tests - it will
48
allow you to view all successes and failures in one run.
49
50
Running individual tests
51
------------------------
52
If one only wants to run a few, specific tests, they may do so this way::
53
54
    ./dbqp.py [OPTIONS] test1 [test2 ... testN]
55
56
Running all tests within a suite
57
--------------------------------
58
Many of the tests supplied with Drizzle are organized into suites.  
59
60
The tests within drizzle/tests/t are considered the 'main' suite.  
61
Other suites are located in either drizzle/tests/suite or within the various
62
directories in drizzle/plugin.  Tests for a specific plugin should live in 
63
the plugin's directory - drizzle/plugin/example_plugin/tests
64
65
To run the tests in a specific suite::
66
67
    ./dbqp.py [OPTIONS] --suite=SUITENAME
68
69
Running specific tests within a suite
70
--------------------------------------
71
To run a specific set of tests within a suite::
72
73
    ./dbqp.py [OPTIONS] --suite=SUITENAME TEST1 [TEST2..TESTN]
74
75
Calling tests using <suitename>.<testname> currently does not work.
76
One must specify the test suite via the :option:`--suite` option.
77
78
79
Running all available tests
80
---------------------------
81
Currently, the quickest way to execute all tests in all suites is
82
to use 'make test-dbqp' from the drizzle root.
83
84
Otherwise, one should simply name all suites::
85
86
    ./dbqp.py [OPTIONS] --suite=SUITE1, SUITE2, ...SUITEN
87
88
Interpreting test results
89
=========================
90
The output of the test runner is quite simple.  Every test should pass.
91
In the event of a test failure, please take the time to file a bug here:
92
*https://bugs.launchpad.net/drizzle*
93
94
During a run, the program will provide the user with:
95
  * test name (suite + name)
96
  * test status (pass/fail/skipped)
97
  * time spent executing each test
98
99
At the end of a run, the program will provide the user with a listing of:
100
  * how many tests were run
101
  * counts and percentages of total exectuted for all test statuses
102
  * a listing of failing, skipped, or disabled tests
103
  * total time spent executing the tests
104
105
Example output::
106
107
    <snip>
108
    30 Jan 2011 16:26:31 : main.small_tmp_table                                    [ pass ]           38
109
    30 Jan 2011 16:26:31 : main.snowman                                            [ pass ]           42
110
    30 Jan 2011 16:26:31 : main.statement_boundaries                               [ pass ]           47
111
    30 Jan 2011 16:26:31 : main.status                                             [ pass ]           51
112
    30 Jan 2011 16:26:31 : main.strict                                             [ pass ]          138
113
    30 Jan 2011 16:26:43 : main.subselect                                          [ fail ]        12361
114
    30 Jan 2011 16:26:43 : --- drizzle/tests/r/subselect.result	2011-01-30 16:23:54.975776148 -0500
115
    30 Jan 2011 16:26:43 : +++ drizzle/tests/r/subselect.reject	2011-01-30 16:26:43.835519303 -0500
116
    30 Jan 2011 16:26:43 : @@ -5,7 +5,7 @@
117
    30 Jan 2011 16:26:43 : 2
118
    30 Jan 2011 16:26:43 : explain extended select (select 2);
119
    30 Jan 2011 16:26:43 : id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
120
    30 Jan 2011 16:26:43 : -9	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
121
    30 Jan 2011 16:26:43 : +1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
122
    <snip>
123
    30 Jan 2011 16:30:20 : ================================================================================
124
    30 Jan 2011 16:30:20 INFO: Test execution complete in 314 seconds
125
    30 Jan 2011 16:30:20 INFO: Summary report:
126
    30 Jan 2011 16:30:20 INFO: Executed 552/552 test cases, 100.00 percent
127
    30 Jan 2011 16:30:20 INFO: STATUS: FAIL, 1/552 test cases, 0.18 percent executed
128
    30 Jan 2011 16:30:20 INFO: STATUS: PASS, 551/552 test cases, 99.82 percent executed
129
    30 Jan 2011 16:30:20 INFO: FAIL tests: main.subselect
130
    30 Jan 2011 16:30:20 INFO: Spent 308 / 314 seconds on: TEST(s)
131
    30 Jan 2011 16:30:20 INFO: Test execution complete
132
    30 Jan 2011 16:30:20 INFO: Stopping all running servers...
133
134
    
135
Additional uses
136
===============
137
Starting a server for manual testing
138
------------------------------------
139
140
:program:`dbqp.py` allows a user to get a Drizzle server up and running
141
quickly.  This can be useful for fast ad-hoc testing.
142
143
To do so call::
144
145
    ./dbqp.py --start-and-exit [*OPTIONS*]
146
147
This will start a Drizzle server that you can connect to and query
148
149
Starting a server against a pre-populated DATADIR
150
--------------------------------------------------
151
152
Using :option:`--start-dirty` prevents :program:`dbqp.py` from attempting
153
to initialize (clean) the datadir.  This can be useful if you want to use
154
an already-populated datadir for testing.
155
156
NOTE: This feature is still being tested, use caution with your data!!!
157
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
158
Randgen mode / Executing randgen tests
159
---------------------------------------
160
161
Using :option:`--mode` =randgen and :option:`--randgen-path` =/path/to/randgen
162
will cause the randgen tests to execute.  This are simple .cnf file-based
163
tests that define various randgen command lines that are useful in testing
164
the server.  Test organization is similar to the dtr tests.  Tests live in 
165
suites, the default suite is 'main' and they all live in
166
drizzle/tests/randgen_tests::
167
168
	./dbqp.py --mode=randgen --randgen-path=/path/to/randgen
169
170
A user may specify suites and individual tests to run, just as with dtr-based
171
testing.  Test output is the same as well::
172
173
    ./dbqp --mode=randgen --randgen-path=/home/username/repos/randgen
174
    Setting --no-secure-file-priv=True for randgen mode...
175
    <snip>
176
    23 Feb 2011 11:42:43 INFO: Using testing mode: randgen
177
    <snip>
178
    23 Feb 2011 11:44:58 : ================================================================================
179
    23 Feb 2011 11:44:58 : TEST NAME                                               [ RESULT ]    TIME (ms)
180
    23 Feb 2011 11:44:58 : ================================================================================
181
    23 Feb 2011 11:44:58 : main.optimizer_subquery                                 [ pass ]       134153
182
    23 Feb 2011 11:45:03 : main.outer_join                                         [ pass ]         5136
183
    23 Feb 2011 11:45:06 : main.simple                                             [ pass ]         2246
184
    23 Feb 2011 11:45:06 : ================================================================================
185
    23 Feb 2011 11:45:06 INFO: Test execution complete in 142 seconds
186
    23 Feb 2011 11:45:06 INFO: Summary report:
187
    23 Feb 2011 11:45:06 INFO: Executed 3/3 test cases, 100.00 percent
188
    23 Feb 2011 11:45:06 INFO: STATUS: PASS, 3/3 test cases, 100.00 percent executed
189
    23 Feb 2011 11:45:06 INFO: Spent 141 / 142 seconds on: TEST(s)
190
    23 Feb 2011 11:45:06 INFO: Test execution complete
191
    23 Feb 2011 11:45:06 INFO: Stopping all running servers...
192
193
Cleanup mode
194
-------------
195
A cleanup mode is provided for user convenience.  This simply shuts down
196
any servers whose pid files are detected in the dbqp workdir.  It is mainly
197
intended as a quick cleanup for post-testing with :option:`--start-and-exit`::
198
199
	./dbqp.py --mode=cleanup
200
201
    Setting --start-dirty=True for cleanup mode...
202
    23 Feb 2011 11:35:59 INFO: Using Drizzle source tree:
203
    23 Feb 2011 11:35:59 INFO: basedir: drizzle
204
    23 Feb 2011 11:35:59 INFO: clientbindir: drizzle/client
205
    23 Feb 2011 11:35:59 INFO: testdir: drizzle/tests
206
    23 Feb 2011 11:35:59 INFO: server_version: 2011.02.2188
207
    23 Feb 2011 11:35:59 INFO: server_compile_os: unknown-linux-gnu
208
    23 Feb 2011 11:35:59 INFO: server_platform: x86_64
209
    23 Feb 2011 11:35:59 INFO: server_comment: (Source distribution (dbqp_randgen))
210
    23 Feb 2011 11:35:59 INFO: Using --start-dirty, not attempting to touch directories
211
    23 Feb 2011 11:35:59 INFO: Using default-storage-engine: innodb
212
    23 Feb 2011 11:35:59 INFO: Using testing mode: cleanup
213
    23 Feb 2011 11:35:59 INFO: Killing pid 10484 from drizzle/tests/workdir/testbot0/server0/var/run/server0.pid
214
    23 Feb 2011 11:35:59 INFO: Stopping all running servers...
215
2128.1.1 by patrick crews
Added initial docs for dbqp.py
216
Program architecture
217
====================
218
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
219
:program:`dbqp.py`'s 'dtr' mode uses a simple diff-based mechanism for testing.
220
This is the default mode and where the majority of Drizzle testing occurs.  
2128.1.1 by patrick crews
Added initial docs for dbqp.py
221
It will execute the statements contained in a test and compare the results 
222
to pre-recorded expected results.  In the event of a test failure, you
223
will be presented with a diff::
224
225
    main.exp1                                                    [ fail ]
226
    --- drizzle/tests/r/exp1.result	2010-11-02 02:10:25.107013998 +0300
227
    +++ drizzle/tests/r/exp1.reject	2010-11-02 02:10:32.017013999 +0300
228
    @@ -5,4 +5,5 @@
229
    a
230
    1
231
    2
232
    +3
233
    DROP TABLE t1;
234
235
A test case consists of a .test and a .result file.  The .test file includes
236
the various statements to be executed for a test.  The .result file lists
237
the expected results for a given test file.  These files live in tests/t 
238
and tests/r, respectively.  This structure is the same for all test suites.
239
240
dbqp.py options
241
===================
242
243
The :program:`dbqp.py` tool has several available options:
244
245
./dbqp.py [ OPTIONS ] [ TESTCASE ]
246
247
248
Options
249
-------
2194.5.5 by Andrew Hutchings
Fix options indexing
250
251
.. program:: dbqp.py
252
2337.1.15 by patrick crews
Code cleanup / reorganization
253
.. option::  version
254
255
   show program's version number and exit
256
2128.1.1 by patrick crews
Added initial docs for dbqp.py
257
.. option:: -h, --help
258
 
259
   show this help message and exit
260
2337.1.15 by patrick crews
Code cleanup / reorganization
261
Configuration controls - allows you to specify a file with a number of options already specified
262
------------------------------------------------------------------------------------------------
263
264
.. option:: --sys_config_file=SYSCONFIGFILEPATH
265
           
266
   The file that specifies system configuration specs for
267
   dbqp to execute tests (not yet implemented)
268
2128.1.1 by patrick crews
Added initial docs for dbqp.py
269
Options for the test-runner itself
270
----------------------------------
2194.5.5 by Andrew Hutchings
Fix options indexing
271
272
.. program:: dbqp.py
273
274
.. option:: --force
2128.1.1 by patrick crews
Added initial docs for dbqp.py
275
276
    Set this to continue test execution beyond the first failed test
277
278
.. option:: --start-and-exit
279
280
   Spin up the server(s) for the first specified test then exit 
281
   (will leave servers running)
282
283
.. option:: --verbose
284
285
   Produces extensive output about test-runner state.  
286
   Distinct from --debug
287
288
.. option:: --debug
289
290
   Provide internal-level debugging output.  
291
   Distinct from --verbose
292
293
.. option:: --mode=MODE
294
295
   Testing mode.  
296
   We only support dtr...for now >;) 
297
   [dtr]
298
299
.. option:: --record
300
301
   Record a testcase result 
302
   (if the testing mode supports it) 
303
   [False]
304
305
.. option:: --fast
306
307
   Don't try to cleanup from earlier runs 
308
   (currently just a placeholder) [False]
309
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
310
311
312
2128.1.1 by patrick crews
Added initial docs for dbqp.py
313
Options for controlling which tests are executed
314
------------------------------------------------
2194.5.5 by Andrew Hutchings
Fix options indexing
315
316
.. program:: dbqp.py
317
2128.1.1 by patrick crews
Added initial docs for dbqp.py
318
.. option:: --suite=SUITELIST
319
320
   The name of the suite containing tests we want. 
321
   Can accept comma-separated list (with no spaces). 
322
   Additional --suite args are appended to existing list 
323
   [autosearch]
324
325
.. option:: --suitepath=SUITEPATHS 
326
327
   The path containing the suite(s) you wish to execute. 
328
   Use on --suitepath for each suite you want to use.
329
330
.. option:: --do-test=DOTEST
331
332
   input can either be a prefix or a regex. 
333
   Will only execute tests that match the provided pattern
334
335
.. option:: --skip-test=SKIPTEST
336
337
   input can either be a prefix or a regex.  
338
   Will exclude tests that match the provided pattern
339
340
.. option:: --reorder
341
342
   sort the testcases so that they are executed optimally
343
   for the given mode [False]
344
2167.4.3 by patrick crews
Updated docs
345
.. option:: --repeat=REPEAT     
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
346
2167.4.3 by patrick crews
Updated docs
347
    Run each test case the specified number of times.  For
348
    a given sequence, the first test will be run n times,
349
    then the second, etc [1]
350
2128.1.1 by patrick crews
Added initial docs for dbqp.py
351
Options for defining the code that will be under test
352
-----------------------------------------------------
353
2194.5.5 by Andrew Hutchings
Fix options indexing
354
.. program:: dbqp.py
355
2128.1.1 by patrick crews
Added initial docs for dbqp.py
356
.. option:: --basedir=BASEDIR   
357
358
   Pass this argument to signal to the test-runner 
359
   that this is an in-tree test (not required).  
360
   We automatically set a number of variables 
361
   relative to the argument (client-bindir, 
362
   serverdir, testdir) [../]
363
2337.1.15 by patrick crews
Code cleanup / reorganization
364
.. option:: --default_server_type=DEFAULTSERVERTYPE
365
           
366
   Defines what we consider to be the default server
367
   type.  We assume a server is default type unless
368
   specified otherwise. [drizzle]
369
2128.1.1 by patrick crews
Added initial docs for dbqp.py
370
.. option:: --serverdir=SERVERPATH
371
372
   Path to the server executable.  [auto-search]
373
374
.. option:: --client-bindir=CLIENTBINDIR
375
376
   Path to the directory containing client program
377
   binaries for use in testing [auto-search]
378
379
.. option:: --default-storage-engine=DEFAULTENGINE
380
                        
381
   Start drizzled using the specified engine [innodb]
382
383
Options for defining the testing environment
384
--------------------------------------------
2194.5.5 by Andrew Hutchings
Fix options indexing
385
386
.. program:: dbqp.py
387
2128.1.1 by patrick crews
Added initial docs for dbqp.py
388
.. option:: --testdir=TESTDIR   
389
390
    Path to the test dir, containing additional files for
391
    test execution. [pwd]
392
393
.. option:: --workdir=WORKDIR   
394
395
   Path to the directory test-run will use to store
396
   generated files and directories.
397
   [basedir/tests/dbqp_work]
398
399
.. option:: --top-srcdir=TOPSRCDIR
400
401
   build option [basedir_default]
402
403
.. option:: --top-builddir=TOPBUILDDIR
404
405
   build option [basedir_default]
406
407
.. option:: --no-shm            
408
409
   By default, we symlink workdir to a location in shm.
410
   Use this flag to not symlink [False]
411
2337.1.15 by patrick crews
Code cleanup / reorganization
412
.. option:: --libeatmydata      
413
  
414
   We use libeatmydata (if available) to disable fsyncs
415
   and speed up test execution.  Implies --no-shm
416
   
417
.. option:: --libeatmydata-path=LIBEATMYDATAPATH
418
            
419
   Path to the libeatmydata install you want to use
420
   [/usr/local/lib/libeatmydata.so]
421
2128.1.1 by patrick crews
Added initial docs for dbqp.py
422
.. option:: --start-dirty       
423
424
   Don't try to clean up working directories before test
425
   execution [False]
426
427
.. option:: --no-secure-file-priv
428
                        
429
   Turn off the use of --secure-file-priv=vardir for
430
   started servers
431
2337.1.15 by patrick crews
Code cleanup / reorganization
432
.. option:: --randgen-path=RANDGENPATH
433
434
    The path to a randgen installation that can be used to
435
    execute randgen-based tests
436
2158.2.2 by patrick crews
Updates to docs
437
Options to pass options on to the server
438
-----------------------------------------
2194.5.5 by Andrew Hutchings
Fix options indexing
439
440
.. program:: dbqp.py
441
2158.2.2 by patrick crews
Updates to docs
442
.. option:: --drizzled=DRIZZLEDOPTIONS
443
           
444
    Pass additional options to the server.  Will be passed
445
    to all servers for all tests (mostly for --start-and-
446
    exit)
447
448
2128.1.1 by patrick crews
Added initial docs for dbqp.py
449
Options for defining the tools we use for code analysis (valgrind, gprof, gcov, etc)
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
450
------------------------------------------------------------------------------------
2194.5.5 by Andrew Hutchings
Fix options indexing
451
452
.. program:: dbqp.py
453
2128.1.1 by patrick crews
Added initial docs for dbqp.py
454
.. option:: --valgrind          
455
456
   Run drizzletest and drizzled executables using
457
   valgrind with default options [False]
458
459
.. option:: --valgrind-option=VALGRINDARGLIST
460
                       
461
   Pass an option to valgrind (overrides/removes default
462
   valgrind options)
463
464
Options for controlling the use of debuggers with test execution
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
465
----------------------------------------------------------------
2194.5.5 by Andrew Hutchings
Fix options indexing
466
467
.. program:: dbqp.py
468
2128.1.2 by patrick crews
minor fix of docs
469
.. option:: --gdb
2128.1.1 by patrick crews
Added initial docs for dbqp.py
470
471
    Start the drizzled server(s) in gdb
2158.2.2 by patrick crews
Updates to docs
472
473
.. option:: --manual-gdb
474
475
    Allows you to start the drizzled server(s) in gdb
476
    manually (in another window, etc
477
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
478
Options to call additional utilities such as datagen
479
------------------------------------------------------
2194.5.7 by Andrew Hutchings
Merged trunk into branch (fix conflict)
480
481
.. program:: dbqp.py
482
2194.2.1 by patrick crews
Integrated randgen with dbqp. We now have mode=randgen and a set of randgen test suites (very basic now). Output = same as dtr : ) We also have mode=cleanup to kill any servers we have started. Docs updates too. Gendata utility allows us to populate test servers
483
.. option:: --gendata=GENDATAFILE
484
            
485
    Call the randgen's gendata utility to use the
486
    specified configuration file.  This will populate the
487
    server prior to any test execution
488