Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/db Fix and re-enable the delete_btree test case
details: https://anonhg.NetBSD.org/src/rev/a03f0f463bd7
branches: trunk
changeset: 760578:a03f0f463bd7
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Jan 08 05:33:34 2011 +0000
description:
Fix and re-enable the delete_btree test case
diffstat:
tests/lib/libc/db/t_db.sh | 52 ++++++++++++++++++++++++++++++----------------
1 files changed, 34 insertions(+), 18 deletions(-)
diffs (94 lines):
diff -r e88f7c962742 -r a03f0f463bd7 tests/lib/libc/db/t_db.sh
--- a/tests/lib/libc/db/t_db.sh Sat Jan 08 05:23:19 2011 +0000
+++ b/tests/lib/libc/db/t_db.sh Sat Jan 08 05:33:34 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_db.sh,v 1.1 2011/01/07 15:05:58 pgoyette Exp $
+# $NetBSD: t_db.sh,v 1.2 2011/01/08 05:33:34 pgoyette Exp $
#
# Copyright (c) 2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -459,24 +459,17 @@
awk '{
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("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;
}' >exp
cat exp |
awk '{
- if (i == 120)
- exit;
printf("p\nk%d\nd%s\n", ++i, $0);
}
END {
printf("fR_NEXT\n");
for (i = 1; i <= 120; ++i)
printf("s\n");
- printf("fR_CURSOR\ns\nk120\n");
+ printf("fR_CURSOR\ns\nkXX\n");
printf("r\n");
printf("fR_NEXT\ns\n");
printf("fR_CURSOR\ns\nk1\n");
@@ -484,12 +477,42 @@
printf("fR_FIRST\ns\n");
}' >in
+ # For btree, the records are ordered by the string representation
+ # of the key value. So sort the expected output file accordingly,
+ # and set the seek_last key to the last expected key value.
+
+ if [ "$type" = "btree" ] ; then
+ sed -e 's/kXX/k99/' < in > tmp
+ mv tmp in
+ sort -d -k4 < exp > tmp
+ mv tmp exp
+ echo $SEVEN_SEVEN |
+ awk '{
+ printf("%05d: input key %d: %s\n", 99, 99, $0);
+ printf("seq failed, no such key\n");
+ printf("%05d: input key %d: %s\n", 1, 1, $0);
+ printf("%05d: input key %d: %s\n", 10, 10, $0);
+ exit;
+ }' >> exp
+ else
+ # For recno, records are ordered by numerical key value. No sort
+ # is needed, but still need to set proper seek_last key value.
+ sed -e 's/kXX/k120/' < in > tmp
+ mv tmp in
+ echo $SEVEN_SEVEN |
+ awk '{
+ printf("%05d: input key %d: %s\n", 120, 120, $0);
+ 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;
+ }' >> exp
+ fi
+
atf_check "$(prog)" -o out $type in
atf_check -o file:exp cat out
}
-# FIXME: should it actually work? the original test apparently
-# was supposed to run such test, but didn't
atf_test_case delete_btree
delete_btree_head()
{
@@ -497,13 +520,6 @@
}
delete_btree_body()
{
-#
-# The delete_btree test was skipped in the original ..../regress test
-# structure, so noone ever noticed that it didn't work! Disable it for
-# now, until we correct the generation of in/out files to reflect the
-# actual collating sequence of key values ("19" comes before "2")
-#
- atf_skip "delete_btreee test case is broken"
h_delete btree
}
Home |
Main Index |
Thread Index |
Old Index