File: txn004.tcl

package info (click to toggle)
evolution-data-server 1.6.3-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 59,384 kB
  • ctags: 43,218
  • sloc: ansic: 319,315; tcl: 30,499; xml: 19,166; sh: 18,776; perl: 11,529; cpp: 8,259; java: 7,653; makefile: 6,448; awk: 1,338; yacc: 1,103; sed: 772; cs: 505; lex: 134; asm: 14
file content (62 lines) | stat: -rw-r--r-- 1,531 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# See the file LICENSE for redistribution information.
#
# Copyright (c) 1996-2002
#	Sleepycat Software.  All rights reserved.
#
# $Id: txn004.tcl,v 1.1.1.1 2003/11/20 22:14:02 toshok Exp $
#

# TEST	txn004
# TEST	Test of wraparound txnids (txn001)
proc txn004 { } {
	source ./include.tcl
	global txn_curid
	global txn_maxid

	set orig_curid $txn_curid
	set orig_maxid $txn_maxid
	puts "\tTxn004.1: wraparound txnids"
	set txn_curid [expr $txn_maxid - 2]
	txn001 "04.1"
	puts "\tTxn004.2: closer wraparound txnids"
	set txn_curid [expr $txn_maxid - 3]
	set txn_maxid [expr $txn_maxid - 2]
	txn001 "04.2"

	puts "\tTxn004.3: test wraparound txnids"
	txn_idwrap_check $testdir
	set txn_curid $orig_curid
	set txn_maxid $orig_maxid
	return
}

proc txn_idwrap_check { testdir } {
	global txn_curid
	global txn_maxid

	env_cleanup $testdir

	# Open/create the txn region
	set e [berkdb_env -create -txn -home $testdir]
	error_check_good env_open [is_substr $e env] 1

	set txn1 [$e txn]
	error_check_good txn1 [is_valid_txn $txn1 $e] TRUE
	error_check_good txn_id_set \
	    [$e txn_id_set [expr $txn_maxid - 1] $txn_maxid] 0

	set txn2 [$e txn]
	error_check_good txn2 [is_valid_txn $txn2 $e] TRUE

	# txn3 will require a wraparound txnid
	# XXX How can we test it has a wrapped id?
	set txn3 [$e txn]
	error_check_good wrap_txn3 [is_valid_txn $txn3 $e] TRUE

	error_check_good free_txn1 [$txn1 commit] 0
	error_check_good free_txn2 [$txn2 commit] 0
	error_check_good free_txn3 [$txn3 commit] 0

	error_check_good close [$e close] 0
}