Check test results more carefully.
authorKen Raeburn <raeburn@mit.edu>
Fri, 4 Jan 2002 05:06:11 +0000 (05:06 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 4 Jan 2002 05:06:11 +0000 (05:06 +0000)
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

src/util/db2/ChangeLog
src/util/db2/btree/bt_put.c
src/util/db2/test/ChangeLog
src/util/db2/test/dbtest.c
src/util/db2/test/run.test

index 19950f34dc02d5820722bd11cfbddc69a825aff0..96ae5562bab07d9fab152eaf100e5e28b8faa986 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-03  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <epeisach@mit.edu>
 
        * configure.in: Add optional argument to AC_DEFINE to provide
index 80e0e2a9ddb543f7bf5d4faa6214e9d9f888cb9b..f75ca9295cb58453bb80407b654d23caca455dbf 100644 (file)
@@ -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;
                }
index 7577da40f707e09ccb918f8c872b92c948ca0984..88cfe6efbd735a30b4c98645631b79f7a81c751f 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2000-06-26  Ken Raeburn  <raeburn@mit.edu>
 
        * dbtest.c (err): Add format attribute to decl, for typechecking
index 68d0d53fc2b5454fd88d5e81d54bd00f97d00724..b67fd3f1fb21be59c1f5b3ac336342386cb1c0f9 100644 (file)
@@ -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--;)
index 462a9c2c81eb6fc9ee8dcf01c311a432958f6c09..e98ca0749e79508d52575a58966b972181a42ff6 100644 (file)
@@ -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.
 }