1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1999-2001
4
# Sleepycat Software. All rights reserved.
6
# $Id: env008.tcl,v 11.3 2001/01/25 18:23:04 bostic Exp $
8
# Test of env and subdirs.
19
file mkdir $testdir/$subdir $testdir/$subdir1
20
set testfile $subdir/env.db
22
puts "Env008: Test of environments and subdirectories."
24
# Try opening without Create flag should error
25
puts "\tEnv008.a: Create env and db."
26
set env [berkdb env -create -mode 0644 -home $testdir -txn]
27
error_check_good env [is_valid_env $env] TRUE
29
puts "\tEnv008.b: Remove db in subdir."
30
env008_db $env $testfile
31
error_check_good dbremove:$testfile \
32
[berkdb dbremove -env $env $testfile] 0
35
# Rather than remaking the db every time for the renames
36
# just move around the new file name to another new file
39
puts "\tEnv008.c: Rename db in subdir."
40
env008_db $env $testfile
41
set newfile $subdir/new.db
42
error_check_good dbrename:$testfile/.. \
43
[berkdb dbrename -env $env $testfile $newfile] 0
46
puts "\tEnv008.d: Rename db to parent dir."
47
set newfile $subdir/../new.db
48
error_check_good dbrename:$testfile/.. \
49
[berkdb dbrename -env $env $testfile $newfile] 0
52
puts "\tEnv008.e: Rename db to child dir."
53
set newfile $subdir/env.db
54
error_check_good dbrename:$testfile/.. \
55
[berkdb dbrename -env $env $testfile $newfile] 0
58
puts "\tEnv008.f: Rename db to another dir."
59
set newfile $subdir1/env.db
60
error_check_good dbrename:$testfile/.. \
61
[berkdb dbrename -env $env $testfile $newfile] 0
63
error_check_good envclose [$env close] 0
64
puts "\tEnv008 complete."
67
proc env008_db { env testfile } {
68
set db [berkdb_open -env $env -create -btree $testfile]
69
error_check_good dbopen [is_valid_db $db] TRUE
70
set ret [$db put key data]
71
error_check_good dbput $ret 0
72
error_check_good dbclose [$db close] 0