summaryrefslogtreecommitdiffstats
path: root/src/util/db2
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2002-02-20 01:12:36 +0000
committerKen Raeburn <raeburn@mit.edu>2002-02-20 01:12:36 +0000
commit44300b3d067daacd8df67f86cfc40fe1858d9c7d (patch)
tree49e3a91f967073119a83e42af7eb684da27a85f0 /src/util/db2
parent26770ba46cac3593b03111ccec6dafeaff2bb388 (diff)
downloadkrb5-44300b3d067daacd8df67f86cfc40fe1858d9c7d.tar.gz
krb5-44300b3d067daacd8df67f86cfc40fe1858d9c7d.tar.xz
krb5-44300b3d067daacd8df67f86cfc40fe1858d9c7d.zip
* run.test: Use "/bin/." instead of "/bin" in find commands in case /bin itself
is a symlink. (test8): Check exit status of dbtest program. * dbtest.c (compare): Exit with error indication if comparison of contents indicates a difference. (get): Exit with error indication after printing message if key not found. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14154 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/db2')
-rw-r--r--src/util/db2/test/ChangeLog15
-rw-r--r--src/util/db2/test/dbtest.c7
-rw-r--r--src/util/db2/test/run.test21
3 files changed, 31 insertions, 12 deletions
diff --git a/src/util/db2/test/ChangeLog b/src/util/db2/test/ChangeLog
index 88cfe6efbd..e989275395 100644
--- a/src/util/db2/test/ChangeLog
+++ b/src/util/db2/test/ChangeLog
@@ -1,10 +1,21 @@
+2002-02-19 Ken Raeburn <raeburn@mit.edu>
+
+ * run.test: Use "/bin/." instead of "/bin" in find commands in
+ case /bin itself is a symlink.
+ (test8): Check exit status of dbtest program.
+
+ * dbtest.c (compare): Exit with error indication if comparison of
+ contents indicates a difference.
+ (get): Exit with error indication after printing message if key
+ not found.
+
2002-01-04 Ken Raeburn <raeburn@mit.edu>
* run.test (test8): If test reports an error, exit with error
indication.
- * dbtest.c (compare): Exit with error indication if comparison
- fails.
+ * dbtest.c (compare): Exit with error indication if size
+ comparison fails.
2000-06-26 Ken Raeburn <raeburn@mit.edu>
diff --git a/src/util/db2/test/dbtest.c b/src/util/db2/test/dbtest.c
index b67fd3f1fb..b5adc060a1 100644
--- a/src/util/db2/test/dbtest.c
+++ b/src/util/db2/test/dbtest.c
@@ -358,7 +358,7 @@ compare(db1, db2)
len = MIN(db1->size, db2->size);
for (p1 = db1->data, p2 = db2->data; len--;)
if (*p1++ != *p2++) {
- printf("compare failed at offset %d\n",
+ err("compare failed at offset %d\n",
p1 - (u_char *)db1->data);
break;
}
@@ -382,9 +382,10 @@ get(dbp, kp)
/* NOTREACHED */
case 1:
#define NOSUCHKEY "get failed, no such key\n"
- if (ofd != STDOUT_FILENO)
+ if (ofd != STDOUT_FILENO) {
(void)write(ofd, NOSUCHKEY, sizeof(NOSUCHKEY) - 1);
- else
+ exit(1);
+ } else
(void)fprintf(stderr, "%lu: %.*s: %s",
lineno, (int) MIN(kp->size, 20), (char *) kp->data,
NOSUCHKEY);
diff --git a/src/util/db2/test/run.test b/src/util/db2/test/run.test
index e98ca0749e..af69c504e1 100644
--- a/src/util/db2/test/run.test
+++ b/src/util/db2/test/run.test
@@ -31,6 +31,8 @@ main()
dictsize=`wc -l < $DICT`
+ bindir=/bin/.
+
if [ $# -eq 0 ]; then
for t in 1 2 3 4 5 6 7 8 9 10 11 12 13 20; do
test$t
@@ -141,15 +143,15 @@ test2()
fi
}
-# Insert the programs in /bin with their paths as their keys.
+# Insert the programs in $bindir with their paths as their keys.
test3()
{
echo "Test 3: hash: small key, big data pairs"
rm -f $TMP1
- (find /bin -type f -exec test -r {} \; -print | xargs cat) > $TMP1
+ (find $bindir -type f -exec test -r {} \; -print | xargs cat) > $TMP1
for type in hash; do
rm -f $TMP2 $TMP3
- for i in `find /bin -type f -exec test -r {} \; -print`; do
+ for i in `find $bindir -type f -exec test -r {} \; -print`; do
echo p
echo k$i
echo D$i
@@ -168,7 +170,7 @@ test3()
echo " page size $psize"
for type in btree; do
rm -f $TMP2 $TMP3
- for i in `find /bin -type f -exec test -r {} \; -print`; do
+ for i in `find $bindir -type f -exec test -r {} \; -print`; do
echo p
echo k$i
echo D$i
@@ -185,7 +187,7 @@ test3()
done
echo "Test 3: recno: big data pairs"
rm -f $TMP2 $TMP3
- find /bin -type f -exec test -r {} \; -print |
+ find $bindir -type f -exec test -r {} \; -print |
awk '{
++i;
printf("p\nk%d\nD%s\ng\nk%d\n", i, $0, i);
@@ -415,8 +417,13 @@ test8()
printf("r\nkkey1\nr\nkkey2\n");
}
}' > $TMP1
- $PROG btree $TMP1 || exit 1
-# $PROG hash $TMP1 || exit 1
+ if $PROG btree $TMP1 ; then
+ true
+ else
+ echo "test8: btree tests failed"
+ exit 1
+ fi
+# $PROG hash $TMP1
# No explicit test for success.
}