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