From: Ken Raeburn Date: Wed, 20 Feb 2002 01:12:36 +0000 (+0000) Subject: * run.test: Use "/bin/." instead of "/bin" in find commands in case /bin itself X-Git-Tag: krb5-1.3-alpha1~874 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=44300b3d067daacd8df67f86cfc40fe1858d9c7d;p=krb5.git * 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 --- diff --git a/src/util/db2/test/ChangeLog b/src/util/db2/test/ChangeLog index 88cfe6efb..e98927539 100644 --- a/src/util/db2/test/ChangeLog +++ b/src/util/db2/test/ChangeLog @@ -1,10 +1,21 @@ +2002-02-19 Ken Raeburn + + * 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 * 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 diff --git a/src/util/db2/test/dbtest.c b/src/util/db2/test/dbtest.c index b67fd3f1f..b5adc060a 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 e98ca0749..af69c504e 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. }