From: Ken Raeburn Date: Fri, 4 Jan 2002 05:06:11 +0000 (+0000) Subject: Check test results more carefully. X-Git-Tag: krb5-1.3-alpha1~905 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2d8031ac51f94db146061b778268df2c0e21078d;p=krb5.git Check test results more carefully. Fix big-endian-64-bit bug in btree implementation (for sparcv9). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14086 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/db2/ChangeLog b/src/util/db2/ChangeLog index 19950f34d..96ae5562b 100644 --- a/src/util/db2/ChangeLog +++ b/src/util/db2/ChangeLog @@ -1,3 +1,8 @@ +2002-01-03 Ken Raeburn + + * btree/bt_put.c (__bt_put): Correctly handle writing out the key + or data size on a big-endian 64-bit platform. + 2001-10-24 Ezra Peisach * configure.in: Add optional argument to AC_DEFINE to provide diff --git a/src/util/db2/btree/bt_put.c b/src/util/db2/btree/bt_put.c index 80e0e2a9d..f75ca9295 100644 --- a/src/util/db2/btree/bt_put.c +++ b/src/util/db2/btree/bt_put.c @@ -124,24 +124,31 @@ __bt_put(dbp, key, data, flags) dflags = 0; if (key->size + data->size > t->bt_ovflsize) { if (key->size > t->bt_ovflsize) { + u_int32_t yuck_this_is_gross_code; storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR) return (RET_ERROR); tkey.data = kb; tkey.size = NOVFLSIZE; memmove(kb, &pg, sizeof(db_pgno_t)); + yuck_this_is_gross_code = key->size; + if (yuck_this_is_gross_code != key->size) + abort (); memmove(kb + sizeof(db_pgno_t), - &key->size, sizeof(u_int32_t)); + &yuck_this_is_gross_code, sizeof(u_int32_t)); dflags |= P_BIGKEY; key = &tkey; } if (key->size + data->size > t->bt_ovflsize) { + u_int32_t yuck_this_is_gross_code = data->size; if (__ovfl_put(t, data, &pg) == RET_ERROR) return (RET_ERROR); tdata.data = db; tdata.size = NOVFLSIZE; memmove(db, &pg, sizeof(db_pgno_t)); + if (yuck_this_is_gross_code != data->size) + abort (); memmove(db + sizeof(db_pgno_t), - &data->size, sizeof(u_int32_t)); + &yuck_this_is_gross_code, sizeof(u_int32_t)); dflags |= P_BIGDATA; data = &tdata; } diff --git a/src/util/db2/test/ChangeLog b/src/util/db2/test/ChangeLog index 7577da40f..88cfe6efb 100644 --- a/src/util/db2/test/ChangeLog +++ b/src/util/db2/test/ChangeLog @@ -1,3 +1,11 @@ +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. + 2000-06-26 Ken Raeburn * dbtest.c (err): Add format attribute to decl, for typechecking diff --git a/src/util/db2/test/dbtest.c b/src/util/db2/test/dbtest.c index 68d0d53fc..b67fd3f1f 100644 --- a/src/util/db2/test/dbtest.c +++ b/src/util/db2/test/dbtest.c @@ -349,9 +349,11 @@ compare(db1, db2) register size_t len; register u_char *p1, *p2; - if (db1->size != db2->size) + if (db1->size != db2->size) { printf("compare failed: key->data len %lu != data len %lu\n", (u_long) db1->size, (u_long) db2->size); + exit (1); + } len = MIN(db1->size, db2->size); for (p1 = db1->data, p2 = db2->data; len--;) diff --git a/src/util/db2/test/run.test b/src/util/db2/test/run.test index 462a9c2c8..e98ca0749 100644 --- a/src/util/db2/test/run.test +++ b/src/util/db2/test/run.test @@ -399,7 +399,7 @@ test7() # Make sure that overflow pages are reused. test8() { - echo "Test 8: btree, hash: repeated small key, big data pairs" + echo "Test 8: btree: repeated small key, big data pairs" rm -f $TMP1 echo "" | awk 'BEGIN { @@ -415,8 +415,8 @@ test8() printf("r\nkkey1\nr\nkkey2\n"); } }' > $TMP1 - $PROG btree $TMP1 -# $PROG hash $TMP1 + $PROG btree $TMP1 || exit 1 +# $PROG hash $TMP1 || exit 1 # No explicit test for success. }