xref: /freebsd/lib/libc/db/test/README (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
158f0484fSRodney W. Grimes
258f0484fSRodney W. GrimesTo build this portably, try something like:
358f0484fSRodney W. Grimes
4ef5d438eSPaul Traina    make PORTDIR="../PORT/MACH"
558f0484fSRodney W. Grimes
658f0484fSRodney W. Grimeswhere MACH is the machine, i.e. "sunos.4.1.1".
758f0484fSRodney W. Grimes
858f0484fSRodney W. GrimesTo run the tests, enter "sh run.test".  If your system dictionary isn't
958f0484fSRodney W. Grimesin /usr/share/dict/words, edit run.test to reflect the correct place.
1058f0484fSRodney W. Grimes
11ef5d438eSPaul TrainaFairly large files (the command files) are built in this directory during
12ef5d438eSPaul Trainathe test runs, and even larger files (the database files) are created in
13ef5d438eSPaul Traina"/var/tmp".  If the latter directory doesn't exist, set the environmental
14ef5d438eSPaul Trainavariable TMPDIR to a directory where the files can be built.
15ef5d438eSPaul Traina
1658f0484fSRodney W. Grimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
17ef5d438eSPaul TrainaThe script file consists of lines with an initial character which is
18ef5d438eSPaul Trainathe command for that line, or an initial character indicating a key
19ef5d438eSPaul Trainaor data entry for a previous command.
20ef5d438eSPaul Traina
21ef5d438eSPaul TrainaLegal command characters are as follows:
2258f0484fSRodney W. Grimes
2358f0484fSRodney W. Grimesc: compare a record
2458f0484fSRodney W. Grimes	+ must be followed by [kK][dD]; the data value in the database
2558f0484fSRodney W. Grimes	  associated with the specified key is compared to the specified
2658f0484fSRodney W. Grimes	  data value.
2758f0484fSRodney W. Grimese: echo a string
2858f0484fSRodney W. Grimes	+ writes out the rest of the line into the output file; if the
2958f0484fSRodney W. Grimes	  last character is not a carriage-return, a newline is appended.
30ef5d438eSPaul Trainaf: set the flags for the next command
31ef5d438eSPaul Traina	+ no value zero's the flags
3258f0484fSRodney W. Grimesg: do a get command
3358f0484fSRodney W. Grimes	+ must be followed by [kK]
3458f0484fSRodney W. Grimes	+ writes out the retrieved data DBT.
35ef5d438eSPaul Trainao [r]: dump [reverse]
36ef5d438eSPaul Traina	+ dump the database out, if 'r' is set, in reverse order.
3758f0484fSRodney W. Grimesp: do a put command
3858f0484fSRodney W. Grimes	+ must be followed by [kK][dD]
3958f0484fSRodney W. Grimesr: do a del command
40ef5d438eSPaul Traina	+ must be followed by [kK] unless R_CURSOR flag set.
41ef5d438eSPaul TrainaS: sync the database
4258f0484fSRodney W. Grimess: do a seq command
43ef5d438eSPaul Traina	+ must be followed by [kK] if R_CURSOR flag set.
4458f0484fSRodney W. Grimes	+ writes out the retrieved data DBT.
45ef5d438eSPaul Traina
46ef5d438eSPaul TrainaLegal key/data characters are as follows:
47ef5d438eSPaul Traina
4858f0484fSRodney W. GrimesD [file]: data file
4958f0484fSRodney W. Grimes	+ set the current data value to the contents of the file
5058f0484fSRodney W. Grimesd [data]:
5158f0484fSRodney W. Grimes	+ set the current key value to the contents of the line.
5258f0484fSRodney W. GrimesK [file]: key file
5358f0484fSRodney W. Grimes	+ set the current key value to the contents of the file
5458f0484fSRodney W. Grimesk [data]:
5558f0484fSRodney W. Grimes	+ set the current key value to the contents of the line.
56ef5d438eSPaul Traina
57ef5d438eSPaul TrainaBlank lines, lines with leading white space, and lines with leading
58ef5d438eSPaul Trainahash marks (#) are ignored.
5958f0484fSRodney W. Grimes
6058f0484fSRodney W. GrimesOptions to dbtest are as follows:
6158f0484fSRodney W. Grimes
62ef5d438eSPaul Traina	-d: Set the DB_LOCK flag.
6358f0484fSRodney W. Grimes	-f: Use the file argument as the database file.
6458f0484fSRodney W. Grimes	-i: Use the rest of the argument to set elements in the info
6558f0484fSRodney W. Grimes	    structure.  If the type is btree, then "-i cachesize=10240"
6658f0484fSRodney W. Grimes	    will set BTREEINFO.cachesize to 10240.
6758f0484fSRodney W. Grimes	-o: The rest of the argument is the output file instead of
6858f0484fSRodney W. Grimes	    using stdout.
69ef5d438eSPaul Traina	-s: Don't delete the database file before opening it, i.e.
70ef5d438eSPaul Traina	    use the database file from a previous run.
7158f0484fSRodney W. Grimes
72ef5d438eSPaul TrainaDbtest requires two arguments, the type of access "hash", "recno"
73ef5d438eSPaul Trainaor "btree", and the script name or "-" to indicate stdin.
74