1# See the file LICENSE for redistribution information. 2# 3# Copyright (c) 1999,2008 Oracle. All rights reserved. 4# 5# $Id: sdb008.tcl,v 12.6 2008/01/08 20:58:53 bostic Exp $ 6# 7# TEST sdb008 8# TEST Tests explicit setting of lorders for subdatabases -- the 9# TEST lorder should be ignored. 10proc sdb008 { method args } { 11 source ./include.tcl 12 13 set args [convert_args $method $args] 14 set omethod [convert_method $method] 15 16 if { [is_queue $method] == 1 } { 17 puts "Subdb008: skipping for method $method" 18 return 19 } 20 set eindex [lsearch -exact $args "-env"] 21 22 # If we are using an env, then testfile should just be the db name. 23 # Otherwise it is the test directory and the name. 24 if { $eindex == -1 } { 25 set testfile1 $testdir/subdb008a.db 26 set testfile2 $testdir/subdb008b.db 27 set env NULL 28 } else { 29 set testfile1 subdb008a.db 30 set testfile2 subdb008b.db 31 incr eindex 32 set env [lindex $args $eindex] 33 set txnenv [is_txnenv $env] 34 if { $txnenv == 1 } { 35 append args " -auto_commit " 36 } 37 set testdir [get_home $env] 38 } 39 cleanup $testdir $env 40 41 puts "Subdb008: $method ($args) subdb tests with different lorders" 42 43 puts "\tSubdb008.a.0: create subdb with system default lorder" 44 set lorder "1234" 45 if { [big_endian] } { 46 set lorder "4321" 47 } 48 set db [eval {berkdb_open -create -mode 0644} \ 49 $args {$omethod $testfile1 "sub1"}] 50 error_check_good subdb [is_valid_db $db] TRUE 51 error_check_good dbclose [$db close] 0 52 53 # Explicitly try to create subdb's of each byte order. In both 54 # cases the subdb should be forced to the byte order of the 55 # parent database. 56 puts "\tSubdb008.a.1: Try to create subdb with -1234 lorder" 57 set db [eval {berkdb_open -create -mode 0644} \ 58 $args {-lorder 1234 $omethod $testfile1 "sub2"}] 59 error_check_good lorder_1234 [eval $db get_lorder] $lorder 60 error_check_good subdb [is_valid_db $db] TRUE 61 error_check_good dbclose [$db close] 0 62 63 puts "\tSubdb008.a.2: Try to create subdb with -4321 lorder" 64 set db [eval {berkdb_open -create -mode 0644} \ 65 $args {-lorder 4321 $omethod $testfile1 "sub3"}] 66 error_check_good lorder_4321 [eval $db get_lorder] $lorder 67 error_check_good subdb [is_valid_db $db] TRUE 68 error_check_good dbclose [$db close] 0 69 70 puts "\tSubdb008.b.0: create subdb with non-default lorder" 71 set reverse_lorder "4321" 72 if { [big_endian] } { 73 set reverse_lorder "1234" 74 } 75 set db [eval {berkdb_open -create -mode 0644} \ 76 {-lorder $reverse_lorder} $args {$omethod $testfile2 "sub1"}] 77 error_check_good subdb [is_valid_db $db] TRUE 78 error_check_good dbclose [$db close] 0 79 80 puts "\tSubdb008.b.1: Try to create subdb with -1234 lorder" 81 set db [eval {berkdb_open -create -mode 0644} \ 82 $args {-lorder 1234 $omethod $testfile2 "sub2"}] 83 error_check_good lorder_1234 [eval $db get_lorder] $reverse_lorder 84 error_check_good subdb [is_valid_db $db] TRUE 85 error_check_good dbclose [$db close] 0 86 87 puts "\tSubdb008.b.2: Try to create subdb with -4321 lorder" 88 set db [eval {berkdb_open -create -mode 0644} \ 89 $args {-lorder 4321 $omethod $testfile2 "sub3"}] 90 error_check_good lorder_4321 [eval $db get_lorder] $reverse_lorder 91 error_check_good subdb [is_valid_db $db] TRUE 92 error_check_good dbclose [$db close] 0 93} 94