summaryrefslogtreecommitdiff
path: root/bdb/test/test023.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/test023.tcl')
-rw-r--r--bdb/test/test023.tcl35
1 files changed, 26 insertions, 9 deletions
diff --git a/bdb/test/test023.tcl b/bdb/test/test023.tcl
index c222bdd83c5..c37539a0f55 100644
--- a/bdb/test/test023.tcl
+++ b/bdb/test/test023.tcl
@@ -1,14 +1,16 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 1996, 1997, 1998, 1999, 2000
+# Copyright (c) 1996-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: test023.tcl,v 11.13 2000/08/25 14:21:55 sue Exp $
+# $Id: test023.tcl,v 11.18 2002/05/22 15:42:48 sue Exp $
#
-# Duplicate delete test.
-# Add a key with duplicates (first time on-page, second time off-page)
-# Number the dups.
-# Delete dups and make sure that CURRENT/NEXT/PREV work correctly.
+# TEST test023
+# TEST Duplicate test
+# TEST Exercise deletes and cursor operations within a duplicate set.
+# TEST Add a key with duplicates (first time on-page, second time off-page)
+# TEST Number the dups.
+# TEST Delete dups and make sure that CURRENT/NEXT/PREV work correctly.
proc test023 { method args } {
global alphabet
global dupnum
@@ -26,6 +28,7 @@ proc test023 { method 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.
@@ -37,19 +40,29 @@ proc test023 { method args } {
set testfile test023.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
cleanup $testdir $env
set db [eval {berkdb_open \
- -create -truncate -mode 0644 -dup} $args {$omethod $testfile}]
+ -create -mode 0644 -dup} $args {$omethod $testfile}]
error_check_good dbopen [is_valid_db $db] TRUE
set pflags ""
set gflags ""
set txn ""
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
set dbc [eval {$db cursor} $txn]
- error_check_good db_cursor [is_substr $dbc $db] 1
+ error_check_good db_cursor [is_valid_cursor $dbc $db] TRUE
foreach i { onpage offpage } {
if { $i == "onpage" } {
@@ -159,7 +172,7 @@ proc test023 { method args } {
puts "\tTest023.f: Count keys, overwrite current, count again"
# At this point we should have 17 keys the (initial 20 minus
# 3 deletes)
- set dbc2 [$db cursor]
+ set dbc2 [eval {$db cursor} $txn]
error_check_good db_cursor:2 [is_substr $dbc2 $db] 1
set count_check 0
@@ -178,6 +191,7 @@ proc test023 { method args } {
incr count_check
}
error_check_good numdups $count_check 17
+ error_check_good dbc2_close [$dbc2 close] 0
# Done, delete all the keys for next iteration
set ret [eval {$db del} $txn {$key}]
@@ -190,6 +204,9 @@ proc test023 { method args } {
}
error_check_good dbc_close [$dbc close] 0
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
error_check_good db_close [$db close] 0
}