summaryrefslogtreecommitdiff
path: root/bdb/test/test008.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/test008.tcl')
-rw-r--r--bdb/test/test008.tcl80
1 files changed, 71 insertions, 9 deletions
diff --git a/bdb/test/test008.tcl b/bdb/test/test008.tcl
index 34144391ccc..0af97a40110 100644
--- a/bdb/test/test008.tcl
+++ b/bdb/test/test008.tcl
@@ -1,15 +1,23 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 1996, 1997, 1998, 1999, 2000
+# Copyright (c) 1996-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: test008.tcl,v 11.17 2000/10/19 17:35:39 sue Exp $
+# $Id: test008.tcl,v 11.23 2002/05/22 15:42:45 sue Exp $
#
-# DB Test 8 {access method}
-# Take the source files and dbtest executable and enter their names as the
-# key with their contents as data. After all are entered, begin looping
-# through the entries; deleting some pairs and then readding them.
-proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
+# TEST test008
+# TEST Small keys/large data
+# TEST Put/get per key
+# TEST Loop through keys by steps (which change)
+# TEST ... delete each key at step
+# TEST ... add each key back
+# TEST ... change step
+# TEST Confirm that overflow pages are getting reused
+# TEST
+# TEST Take the source files and dbtest executable and enter their names as
+# TEST the key with their contents as data. After all are entered, begin
+# TEST looping through the entries; deleting some pairs and then readding them.
+proc test008 { method {reopen 8} {debug 0} args} {
source ./include.tcl
set tnum test00$reopen
@@ -29,6 +37,7 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
}
# Create the database and open the dictionary
+ set txnenv 0
set eindex [lsearch -exact $args "-env"]
#
# If we are using an env, then testfile should just be the db name.
@@ -40,6 +49,11 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
set testfile $tnum.db
incr eindex
set env [lindex $args $eindex]
+ set txnenv [is_txnenv $env]
+ if { $txnenv == 1 } {
+ append args " -auto_commit "
+ }
+ set testdir [get_home $env]
}
set t1 $testdir/t1
set t2 $testdir/t2
@@ -48,7 +62,7 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
cleanup $testdir $env
- set db [eval {berkdb_open -create -truncate -mode 0644} \
+ set db [eval {berkdb_open -create -mode 0644} \
$args {$omethod $testfile}]
error_check_good dbopen [is_valid_db $db] TRUE
@@ -57,7 +71,7 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
set txn ""
# Here is the loop where we put and get each key/data pair
- set file_list [glob ../*/*.c ./*.o ./*.lo ./*.exe]
+ set file_list [get_file_list]
set count 0
puts "\tTest00$reopen.a: Initial put/get loop"
@@ -65,9 +79,25 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
set names($count) $f
set key $f
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
put_file $db $txn $pflags $f
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
get_file $db $txn $gflags $f $t4
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
error_check_good Test00$reopen:diff($f,$t4) \
[filecmp $f $t4] 0
@@ -88,11 +118,27 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
puts "\tTest00$reopen.b: Delete re-add loop"
foreach i "1 2 4 8 16" {
for {set ndx 0} {$ndx < $count} { incr ndx $i} {
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
set r [eval {$db del} $txn {$names($ndx)}]
error_check_good db_del:$names($ndx) $r 0
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
}
for {set ndx 0} {$ndx < $count} { incr ndx $i} {
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
put_file $db $txn $pflags $names($ndx)
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
}
}
@@ -104,7 +150,15 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
# Now, reopen the file and make sure the key/data pairs look right.
puts "\tTest00$reopen.c: Dump contents forward"
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
dump_bin_file $db $txn $t1 test008.check
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
set oid [open $t2.tmp w]
foreach f $file_list {
@@ -120,7 +174,15 @@ proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} {
# Now, reopen the file and run the last test again in reverse direction.
puts "\tTest00$reopen.d: Dump contents backward"
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
dump_bin_file_direction $db $txn $t1 test008.check "-last" "-prev"
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
filesort $t1 $t3