summaryrefslogtreecommitdiff
path: root/bdb/test/test077.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'bdb/test/test077.tcl')
-rw-r--r--bdb/test/test077.tcl37
1 files changed, 31 insertions, 6 deletions
diff --git a/bdb/test/test077.tcl b/bdb/test/test077.tcl
index 47248a309b8..99cf432af20 100644
--- a/bdb/test/test077.tcl
+++ b/bdb/test/test077.tcl
@@ -1,11 +1,12 @@
# See the file LICENSE for redistribution information.
#
-# Copyright (c) 2000
+# Copyright (c) 2000-2002
# Sleepycat Software. All rights reserved.
#
-# $Id: test077.tcl,v 1.4 2000/08/25 14:21:58 sue Exp $
+# $Id: test077.tcl,v 1.10 2002/05/24 15:24:57 sue Exp $
#
-# DB Test 77: Test of DB_GET_RECNO [#1206].
+# TEST test077
+# TEST Test of DB_GET_RECNO [#1206].
proc test077 { method { nkeys 1000 } { pagesize 512 } { tnum 77 } args } {
source ./include.tcl
global alphabet
@@ -22,6 +23,7 @@ proc test077 { method { nkeys 1000 } { pagesize 512 } { tnum 77 } args } {
set data $alphabet
+ set txnenv 0
set eindex [lsearch -exact $args "-env"]
if { $eindex == -1 } {
set testfile $testdir/test0$tnum.db
@@ -30,23 +32,43 @@ proc test077 { method { nkeys 1000 } { pagesize 512 } { tnum 77 } args } {
set testfile test0$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]
}
cleanup $testdir $env
- set db [eval {berkdb_open -create -truncate -mode 0644\
+ set db [eval {berkdb_open -create -mode 0644\
-pagesize $pagesize} $omethod $args {$testfile}]
error_check_good db_open [is_valid_db $db] TRUE
puts "\tTest0$tnum.a: Populating database."
+ set txn ""
for { set i 1 } { $i <= $nkeys } { incr i } {
set key [format %5d $i]
- error_check_good db_put($key) [$db put $key $data] 0
+ if { $txnenv == 1 } {
+ set t [$env txn]
+ error_check_good txn [is_valid_txn $t $env] TRUE
+ set txn "-txn $t"
+ }
+ set ret [eval {$db put} $txn {$key $data}]
+ error_check_good db_put($key) $ret 0
+ if { $txnenv == 1 } {
+ error_check_good txn [$t commit] 0
+ }
}
puts "\tTest0$tnum.b: Verifying record numbers."
- set dbc [$db cursor]
+ 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 dbc_open [is_valid_cursor $dbc $db] TRUE
set i 1
@@ -64,5 +86,8 @@ proc test077 { method { nkeys 1000 } { pagesize 512 } { tnum 77 } 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
}