1Rules for the Berkeley DB and Berkeley DB-XML test suites
2
31.  Test Naming
4
5The primary script for running Berkeley DB scripts is named
6'test.tcl'.  The primary script for running DB-XML is named
7'xmltest.tcl'.
8
9Tests are named with a (prefix, test number) combination.  The
10prefix indicates the type of test (lock, log, xml, etc.).  The
11prefix 'test' is used for plain vanilla DB testing.  Test numbers
12are 3 digits long, starting with 001.
13
14Procedures common to a group of tests, or to all tests, are placed
15in files named 'xxxutils.tcl'.  At the moment, we have the following
16utilities files:
17
18testutils.tcl	Utilities common to all DB tests
19reputils.tcl	Utilities for replication testing.
20siutils.tcl	Utilities for secondary index testing.
21xmlutils.tcl 	Utilities for XML testing.
22
232.  Internal test structure
24
25Each line within a test should be no more than 80 characters long.
26
27Each test starts with a section like the following:
28
29# See the file LICENSE for redistribution information.
30#
31# Copyright (c) 1996,2008 Oracle.  All rights reserved.
32#
33# $Id: README,v 12.6 2008/01/08 20:58:53 bostic Exp $
34#
35# TEST	test001
36# TEST	Small keys/data
37# TEST		Put/get per key
38# TEST		Dump file
39# TEST		Close, reopen
40# TEST		Dump file
41# TEST
42# TEST	Use the first 10,000 entries from the dictionary.
43# TEST	Insert each with self as key and data; retrieve each.
44# TEST	After all are entered, retrieve all; compare output to original.
45# TEST	Close file, reopen, do retrieve and re-verify.
46
47First we refer to the license and assert copyright, then comes the CVS
48header string.   The section of lines beginning # TEST is used to
49automatically maintain the TESTS file, a listing of all tests and
50what they do.   Use this section to briefly describe the test's purpose
51and structure.
52
53Next comes the main procedure of the test, which has the same name
54as the tcl file.  The test should be liberally commented, and also
55should use 'puts' to send messages to the output file.
56
57Sections of a test are identified with letters: test001.a, test001.b,
58test001.c.
59
60Here's some typical output:
61
62	puts "Test$tnum: $method ($args) $nentries equal key/data pairs"
63 	puts "\tTest$tnum.a: put/get loop"
64	puts "\tTest$tnum.b: dump file"
65	puts "\tTest$tnum.c: close, open, and dump file"
66	puts "\tTest$tnum.d: close, open, and dump file in reverse direction"
67
68The reporting of the current value of the args is particularly
69useful, allowing us to say at a glance that "testxxx is failing in
70btree" or whatever.  Each line of output must begin with the test name.
71We use this to separate expected informational output from errors.
72
73Ancillary procedures follow the main procedure.   Procedures used
74by more than one test should go into the appropriate XXXutils.tcl
75file.
76
773.  Reporting failures
78
79Failures in tests are reported with a message starting with the
80prefix "FAIL:".  Failures in tests are usually caught with the
81error_check_good and error_check_bad routines to compare an
82actual return value to an expected return value.  These routines
83take care of putting the "FAIL:" prefix on the message.
84
854.  Running tests
86
87Any single test can be run from the tclsh prompt by typing the
88name of the test.  If it's a test from the 'testxxx' group, you
89should also specify the method you'd like to test:
90
91	log001
92	test001 btree
93
94To run one of the 'testxxx' tests for all methods, use the
95run_test procedure:
96
97	run_test test001
98
99Any group of tests (the subsystems lock, log, test, etc.) can be
100run by typing
101
102	r $sub
103
104where sub is the name of the subsystem.
105
106For any of the following methods
107
108run_method
109run_secmethod
110run_secenv
111run_reptest
112run_repmethod
113run_envmethod
114run_recd
115
116you can type
117
118run (suffix method start stop).
119
120For example, to run test010 through test020 in btree using
121run_method:
122
123	run method btree 10 20
124
125Or the same tests in repmethod:
126
127	run repmethod btree 10 20
128
129Notice the missing underbar.
130
131If you omit the start and stop numbers, you'll get all the tests:
132
133	run method btree
134
135run_recd is a special case, in that it runs the recdxxx tests;
136all the others run the testxxx tests.
137
138To run the standard test suite, type run_std at the tclsh prompt.
139To run all the tests, type run_all.
140
141If you are running run_std or run_all, you may use the run_parallel
142interface to speed things up or to test under conditions of high
143system load.  Run_parallel creates a list of all tests in the run,
144reorders the tests randomly, then runs the tests in a number of
145parallel processes.  To run run_std in five processes type
146
147	run_parallel 5 run_std
148