summaryrefslogtreecommitdiffstats
path: root/lib/libc/db/test
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-02-27 01:59:15 +0000
committerpst <pst@FreeBSD.org>1996-02-27 01:59:15 +0000
commit2fd01690e924737239e87aee0c117e3369de6c3e (patch)
tree223a02ae7b36628c291a44ca56e521009362cc01 /lib/libc/db/test
parent584fea2f92d8bdbedf4d4b45cff7acd9602ae1ad (diff)
parentc2306789fe98946429af7462a2fd453454034a79 (diff)
downloadFreeBSD-src-2fd01690e924737239e87aee0c117e3369de6c3e.zip
FreeBSD-src-2fd01690e924737239e87aee0c117e3369de6c3e.tar.gz
This commit was generated by cvs2svn to compensate for changes in r14272,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'lib/libc/db/test')
-rw-r--r--lib/libc/db/test/Makefile24
-rw-r--r--lib/libc/db/test/README41
-rw-r--r--lib/libc/db/test/run.test38
3 files changed, 67 insertions, 36 deletions
diff --git a/lib/libc/db/test/Makefile b/lib/libc/db/test/Makefile
index c816432..a5dd08a 100644
--- a/lib/libc/db/test/Makefile
+++ b/lib/libc/db/test/Makefile
@@ -1,17 +1,23 @@
-# @(#)Makefile 8.9 (Berkeley) 2/21/94
+# @(#)Makefile 8.15 (Berkeley) 7/28/94
PROG= dbtest
OBJS= dbtest.o strerror.o
-# Add -DSTATISTICS to CFLAGS to get btree statistical use info.
-# Note, the db library has to be compiled for statistics as well.
-CFLAGS= -D__DBINTERFACE_PRIVATE -DDEBUG -O ${INC}
+# Uncomment the STAT line get hash and btree statistical use info. This
+# also forces ld to load the btree debug functions for use by gdb, which
+# is useful. The db library has to be compiled with -DSTATISTICS as well.
+INC= -I${PORTDIR}/include -I${PORTDIR}
+OORG= -g
+#STAT= -DSTATISTICS
+CFLAGS= -D__DBINTERFACE_PRIVATE -DDEBUG ${STAT} ${OORG} ${INC}
-dbtest: ${OBJS} ${LIB}
- ${CC} -o $@ ${OBJS} ${LIB}
+dbtest: ${OBJS} ${PORTDIR}/libdb.a
+ ${CC} -o $@ ${OBJS} ${PORTDIR}/libdb.a
-strerror.o: ../PORT/clib/strerror.c
- ${CC} -c ../PORT/clib/strerror.c
+strerror.o: ${PORTDIR}/clib/strerror.c
+ ${CC} -c ${PORTDIR}/clib/strerror.c
clean:
- rm -f gmon.out ${OBJS} ${PROG} t1 t2 t3
+ rm -f dbtest.core gmon.out ${OBJS} ${PROG} t1 t2 t3
+
+${OBJS}: Makefile
diff --git a/lib/libc/db/test/README b/lib/libc/db/test/README
index 8631c77..0c0cd13 100644
--- a/lib/libc/db/test/README
+++ b/lib/libc/db/test/README
@@ -1,17 +1,25 @@
-# @(#)README 8.2 (Berkeley) 2/21/94
+# @(#)README 8.8 (Berkeley) 7/31/94
To build this portably, try something like:
- make INC="-I../PORT/MACH/ -I../PORT/MACH/include" LIB=../PORT/MACH/libdb.a
+ make PORTDIR="../PORT/MACH"
where MACH is the machine, i.e. "sunos.4.1.1".
To run the tests, enter "sh run.test". If your system dictionary isn't
in /usr/share/dict/words, edit run.test to reflect the correct place.
+Fairly large files (the command files) are built in this directory during
+the test runs, and even larger files (the database files) are created in
+"/var/tmp". If the latter directory doesn't exist, set the environmental
+variable TMPDIR to a directory where the files can be built.
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-The script file consists of lines with a initial character which is
-the "command" for that line. Legal characters are as follows:
+The script file consists of lines with an initial character which is
+the command for that line, or an initial character indicating a key
+or data entry for a previous command.
+
+Legal command characters are as follows:
c: compare a record
+ must be followed by [kK][dD]; the data value in the database
@@ -20,17 +28,24 @@ c: compare a record
e: echo a string
+ writes out the rest of the line into the output file; if the
last character is not a carriage-return, a newline is appended.
+f: set the flags for the next command
+ + no value zero's the flags
g: do a get command
+ must be followed by [kK]
+ writes out the retrieved data DBT.
+o [r]: dump [reverse]
+ + dump the database out, if 'r' is set, in reverse order.
p: do a put command
+ must be followed by [kK][dD]
r: do a del command
- + must be followed by [kK]
+ + must be followed by [kK] unless R_CURSOR flag set.
+S: sync the database
s: do a seq command
+ + must be followed by [kK] if R_CURSOR flag set.
+ writes out the retrieved data DBT.
-f: set the flags for the next command
- + no value zero's the flags
+
+Legal key/data characters are as follows:
+
D [file]: data file
+ set the current data value to the contents of the file
d [data]:
@@ -39,17 +54,21 @@ K [file]: key file
+ set the current key value to the contents of the file
k [data]:
+ set the current key value to the contents of the line.
-o [r]: dump [reverse]
- + dump the database out, if 'r' is set, in reverse order.
+
+Blank lines, lines with leading white space, and lines with leading
+hash marks (#) are ignored.
Options to dbtest are as follows:
+ -d: Set the DB_LOCK flag.
-f: Use the file argument as the database file.
-i: Use the rest of the argument to set elements in the info
structure. If the type is btree, then "-i cachesize=10240"
will set BTREEINFO.cachesize to 10240.
-o: The rest of the argument is the output file instead of
using stdout.
+ -s: Don't delete the database file before opening it, i.e.
+ use the database file from a previous run.
-Dbtest requires two arguments, the type of access "hash", "recno" or
-"btree", and the script name.
+Dbtest requires two arguments, the type of access "hash", "recno"
+or "btree", and the script name or "-" to indicate stdin.
diff --git a/lib/libc/db/test/run.test b/lib/libc/db/test/run.test
index 5eeaf74..52b74c3 100644
--- a/lib/libc/db/test/run.test
+++ b/lib/libc/db/test/run.test
@@ -1,19 +1,26 @@
#!/bin/sh -
#
-# @(#)run.test 8.7 (Berkeley) 9/16/93
+# @(#)run.test 8.10 (Berkeley) 7/26/94
#
# db regression tests
main()
{
-DICT=/usr/share/dict/words
-#DICT=/usr/dict/words
-PROG=./dbtest
-TMP1=t1
-TMP2=t2
-TMP3=t3
+ PROG=./dbtest
+ TMP1=t1
+ TMP2=t2
+ TMP3=t3
+ if [ -f /usr/share/dict/words ]; then
+ DICT=/usr/share/dict/words
+ elif [ -f /usr/dict/words ]; then
+ DICT=/usr/dict/words
+ else
+ echo 'run.test: no dictionary'
+ exit 1
+ fi
+
if [ $# -eq 0 ]; then
for t in 1 2 3 4 5 6 7 8 9 10 11 12 13 20; do
test$t
@@ -345,7 +352,7 @@ test7()
for (i = 1; i <= 120; ++i)
printf("%05d: input key %d: %s\n", i, i, $0);
printf("%05d: input key %d: %s\n", 120, 120, $0);
- printf("get failed, no such key\n");
+ printf("seq failed, no such key\n");
printf("%05d: input key %d: %s\n", 1, 1, $0);
printf("%05d: input key %d: %s\n", 2, 2, $0);
exit;
@@ -364,10 +371,10 @@ test7()
for (i = 1; i <= 120; ++i)
printf("s\n");
printf("fR_CURSOR\ns\nk120\n");
- printf("r\nk120\n");
+ printf("r\n");
printf("fR_NEXT\ns\n");
printf("fR_CURSOR\ns\nk1\n");
- printf("r\nk1\n");
+ printf("r\n");
printf("fR_FIRST\ns\n");
}' > $TMP2
$PROG -o $TMP3 recno $TMP2
@@ -392,13 +399,11 @@ test8()
if (i % 8 == 0) {
printf("c\nkkey2\nD/bin/csh\n");
printf("c\nkkey1\nD/bin/sh\n");
- printf("e\t%d of 10 (comparison)\r\n", i);
+ printf("e\t%d of 10 (comparison)\n", i);
} else
- printf("e\t%d of 10 \r\n", i);
+ printf("e\t%d of 10 \n", i);
printf("r\nkkey1\nr\nkkey2\n");
}
- printf("e\n");
- printf("eend of test8 run\n");
}' > $TMP1
$PROG btree $TMP1
# $PROG hash $TMP1
@@ -459,7 +464,7 @@ test10()
printf("p\nk%d\nd%s\n", ++i, $0);
}
END {
- printf("fR_CURSOR\nr\nk1\n");
+ printf("fR_CURSOR\nr\n");
printf("eR_CURSOR SHOULD HAVE FAILED\n");
}' > $TMP2
$PROG -o $TMP3 $type $TMP2 > /dev/null 2>&1
@@ -573,7 +578,8 @@ test13()
echo g
echo k$i
done > $TMP2
- $PROG -ilorder=$order -f byte.file -o $TMP3 $type $TMP2
+ $PROG -s \
+ -ilorder=$order -f byte.file -o $TMP3 $type $TMP2
if (cmp -s $TMP1 $TMP3) ; then :
else
echo "test13: $type/$order get failed"
OpenPOWER on IntegriCloud