xref: /freebsd/lib/libc/db/test/README (revision 97759ccc715c4b365432c16d763c50eecfcb1100)
1
2To build this portably, try something like:
3
4    make PORTDIR="../PORT/MACH"
5
6where MACH is the machine, i.e. "sunos.4.1.1".
7
8To run the tests, enter "sh run.test".  If your system dictionary isn't
9in /usr/share/dict/words, edit run.test to reflect the correct place.
10
11Fairly large files (the command files) are built in this directory during
12the test runs, and even larger files (the database files) are created in
13"/var/tmp".  If the latter directory doesn't exist, set the environmental
14variable TMPDIR to a directory where the files can be built.
15
16=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
17The script file consists of lines with an initial character which is
18the command for that line, or an initial character indicating a key
19or data entry for a previous command.
20
21Legal command characters are as follows:
22
23c: compare a record
24	+ must be followed by [kK][dD]; the data value in the database
25	  associated with the specified key is compared to the specified
26	  data value.
27e: echo a string
28	+ writes out the rest of the line into the output file; if the
29	  last character is not a carriage-return, a newline is appended.
30f: set the flags for the next command
31	+ no value zero's the flags
32g: do a get command
33	+ must be followed by [kK]
34	+ writes out the retrieved data DBT.
35o [r]: dump [reverse]
36	+ dump the database out, if 'r' is set, in reverse order.
37p: do a put command
38	+ must be followed by [kK][dD]
39r: do a del command
40	+ must be followed by [kK] unless R_CURSOR flag set.
41S: sync the database
42s: do a seq command
43	+ must be followed by [kK] if R_CURSOR flag set.
44	+ writes out the retrieved data DBT.
45
46Legal key/data characters are as follows:
47
48D [file]: data file
49	+ set the current data value to the contents of the file
50d [data]:
51	+ set the current key value to the contents of the line.
52K [file]: key file
53	+ set the current key value to the contents of the file
54k [data]:
55	+ set the current key value to the contents of the line.
56
57Blank lines, lines with leading white space, and lines with leading
58hash marks (#) are ignored.
59
60Options to dbtest are as follows:
61
62	-d: Set the DB_LOCK flag.
63	-f: Use the file argument as the database file.
64	-i: Use the rest of the argument to set elements in the info
65	    structure.  If the type is btree, then "-i cachesize=10240"
66	    will set BTREEINFO.cachesize to 10240.
67	-o: The rest of the argument is the output file instead of
68	    using stdout.
69	-s: Don't delete the database file before opening it, i.e.
70	    use the database file from a previous run.
71
72Dbtest requires two arguments, the type of access "hash", "recno"
73or "btree", and the script name or "-" to indicate stdin.
74