proc test060 { method args } {
global errorCode
source ./include.tcl
set args [convert_args $method $args]
set omethod [convert_method $method]
puts "Test060: $method ($args) Test of the DB_EXCL flag to DB->open"
set txnenv 0
set eindex [lsearch -exact $args "-env"]
if { $eindex == -1 } {
set testfile $testdir/test060.db
set env NULL
} else {
set testfile test060.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
puts "\tTest060.a: open and close non-existent file with DB_EXCL"
set db [eval {berkdb_open \
-create -excl -mode 0644} $args {$omethod $testfile}]
error_check_good dbopen:excl [is_valid_db $db] TRUE
error_check_good db_close [$db close] 0
puts "\tTest060.b: open it again with DB_EXCL and make sure it fails"
set errorCode NONE
error_check_good open:excl:catch [catch { \
set db [eval {berkdb_open_noerr \
-create -excl -mode 0644} $args {$omethod $testfile}]
} ret ] 1
error_check_good dbopen:excl [is_substr $errorCode EEXIST] 1
}