1# See the file LICENSE for redistribution information. 2# 3# Copyright (c) 2005,2008 Oracle. All rights reserved. 4# 5# $Id: plat001.tcl,v 1.8 2008/01/08 20:58:53 bostic Exp $ 6# 7# TEST plat001 8# TEST 9# TEST Test of portability of sequences. 10# TEST 11# TEST Create and dump a database containing sequences. Save the dump. 12# TEST This test is used in conjunction with the upgrade tests, which 13# TEST will compare the saved dump to a locally created dump. 14 15proc plat001 { method {tnum "001"} args } { 16 source ./include.tcl 17 global fixed_len 18 global util_path 19 20 # Fixed_len must be increased from the default to 21 # accommodate fixed-record length methods. 22 set orig_fixed_len $fixed_len 23 set fixed_len 128 24 set args [convert_args $method $args] 25 set omethod [convert_method $method] 26 27 set eindex [lsearch -exact $args "-env"] 28 set txnenv 0 29 if { $eindex == -1 } { 30 set testfile $testdir/plat$tnum.db 31 set testdump $testdir/plat$tnum.dmp 32 set env NULL 33 } else { 34 set testfile plat$tnum.db 35 set testdump plat$tnum.dmp 36 incr eindex 37 set env [lindex $args $eindex] 38 set txnenv [is_txnenv $env] 39 set rpcenv [is_rpcenv $env] 40 if { $txnenv == 1 } { 41 append args " -auto_commit " 42 } 43 set testdir [get_home $env] 44 } 45 46 cleanup $testdir $env 47 48 # Make the key numeric so we can test record-based methods. 49 set key 1 50 51 puts "\tPlat$tnum.a: Create $method db with a sequence." 52 set db [eval {berkdb_open -create -mode 0644} $args $omethod $testfile] 53 error_check_good dbopen [is_valid_db $db] TRUE 54 55 set init 1 56 set min $init 57 set max 1000000000 58 set seq [eval {berkdb sequence} \ 59 -create -init $init -min $min -max $max $db $key] 60 error_check_good is_valid_seq [is_valid_seq $seq] TRUE 61 62 error_check_good seq_close [$seq close] 0 63 error_check_good db_close [$db close] 0 64 65 puts "\tPlat$tnum.b: Dump the db." 66 set stat [catch {eval {exec $util_path/db_dump} -f $testdump \ 67 $testfile} ret] 68 error_check_good sequence_dump $stat 0 69 70 puts "\tPlat$tnum.c: Delete the db." 71 error_check_good db_delete [fileremove $testfile] "" 72 73 set fixed_len $orig_fixed_len 74 return 75} 76