diff options
Diffstat (limited to 'bdb/test/env001.tcl')
-rw-r--r-- | bdb/test/env001.tcl | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/bdb/test/env001.tcl b/bdb/test/env001.tcl index 00837330193..781029f6a5c 100644 --- a/bdb/test/env001.tcl +++ b/bdb/test/env001.tcl @@ -1,11 +1,12 @@ # See the file LICENSE for redistribution information. # -# Copyright (c) 1999, 2000 +# Copyright (c) 1999-2002 # Sleepycat Software. All rights reserved. # -# $Id: env001.tcl,v 11.21 2000/11/09 19:24:08 sue Exp $ +# $Id: env001.tcl,v 11.26 2002/05/08 19:01:43 margo Exp $ # -# Test of env remove interface. +# TEST env001 +# TEST Test of env remove interface (formerly env_remove). proc env001 { } { global errorInfo global errorCode @@ -20,12 +21,12 @@ proc env001 { } { # Try opening without Create flag should error puts "\tEnv001.a: Open without create (should fail)." - catch {set env [berkdb env -home $testdir]} ret + catch {set env [berkdb_env_noerr -home $testdir]} ret error_check_good env:fail [is_substr $ret "no such file"] 1 # Now try opening with create puts "\tEnv001.b: Open with create." - set env [berkdb env -create -mode 0644 -home $testdir] + set env [berkdb_env -create -mode 0644 -home $testdir] error_check_bad env:$testdir $env NULL error_check_good env:$testdir [is_substr $env "env"] 1 @@ -40,7 +41,7 @@ proc env001 { } { puts "\tEnv001.d: Remove on closed environments." if { $is_windows_test != 1 } { puts "\t\tEnv001.d.1: Verify re-open." - set env [berkdb env -home $testdir] + set env [berkdb_env -home $testdir] error_check_bad env:$testdir $env NULL error_check_good env:$testdir [is_substr $env "env"] 1 @@ -56,7 +57,7 @@ proc env001 { } { puts "\tEnv001.e: Remove on open environments." puts "\t\tEnv001.e.1: Env is open by single proc,\ remove no force." - set env [berkdb env -create -mode 0644 -home $testdir] + set env [berkdb_env -create -mode 0644 -home $testdir] error_check_bad env:$testdir $env NULL error_check_good env:$testdir [is_substr $env "env"] 1 set stat [catch {berkdb envremove -home $testdir} ret] @@ -68,7 +69,7 @@ proc env001 { } { "\t\tEnv001.e.2: Env is open by single proc, remove with force." # Now that envremove doesn't do a close, this won't work on Windows. if { $is_windows_test != 1 && $is_hp_test != 1} { - set env [berkdb env -create -mode 0644 -home $testdir] + set env [berkdb_env_noerr -create -mode 0644 -home $testdir] error_check_bad env:$testdir $env NULL error_check_good env:$testdir [is_substr $env "env"] 1 set stat [catch {berkdb envremove -force -home $testdir} ret] @@ -77,19 +78,22 @@ proc env001 { } { # Even though the underlying env is gone, we need to close # the handle. # - catch {$env close} + set stat [catch {$env close} ret] + error_check_bad env:close_after_remove $stat 0 + error_check_good env:close_after_remove \ + [is_substr $ret "recovery"] 1 } puts "\t\tEnv001.e.3: Env is open by 2 procs, remove no force." # should fail - set env [berkdb env -create -mode 0644 -home $testdir] + set env [berkdb_env -create -mode 0644 -home $testdir] error_check_bad env:$testdir $env NULL error_check_good env:$testdir [is_substr $env "env"] 1 set f1 [open |$tclsh_path r+] puts $f1 "source $test_path/test.tcl" - set remote_env [send_cmd $f1 "berkdb env -home $testdir"] + set remote_env [send_cmd $f1 "berkdb_env_noerr -home $testdir"] error_check_good remote:env_open [is_valid_env $remote_env] TRUE # First close our env, but leave remote open error_check_good env:close [$env close] 0 @@ -110,13 +114,13 @@ proc env001 { } { # are open, so we skip this test for Windows. On UNIX, it should # succeed if { $is_windows_test != 1 && $is_hp_test != 1 } { - set env [berkdb env -create -mode 0644 -home $testdir] + set env [berkdb_env_noerr -create -mode 0644 -home $testdir] error_check_bad env:$testdir $env NULL error_check_good env:$testdir [is_substr $env "env"] 1 set f1 [open |$tclsh_path r+] puts $f1 "source $test_path/test.tcl" - set remote_env [send_cmd $f1 "berkdb env -home $testdir"] + set remote_env [send_cmd $f1 "berkdb_env -home $testdir"] error_check_good remote:env_open [is_valid_env $remote_env] TRUE catch {berkdb envremove -force -home $testdir} ret @@ -124,7 +128,10 @@ proc env001 { } { # # We still need to close our handle. # - catch {$env close} ret + set stat [catch {$env close} ret] + error_check_bad env:close_after_error $stat 0 + error_check_good env:close_after_error \ + [is_substr $ret recovery] 1 # Close down remote process set err [catch { close $f1 } result] @@ -137,7 +144,7 @@ proc env001 { } { file mkdir $testdir/NEWDIR } set eflags "-create -home $testdir/NEWDIR -mode 0644" - set env [eval {berkdb env} $eflags] + set env [eval {berkdb_env} $eflags] error_check_bad env:open $env NULL error_check_good env:close [$env close] 0 error_check_good berkdb:envremove \ |