File: env019script.tcl

package info (click to toggle)
db5.3 5.3.28%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 158,500 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,264; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,077; javascript: 1,998; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (50 lines) | stat: -rw-r--r-- 1,484 bytes parent folder | download | duplicates (9)
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
# See the file LICENSE for redistribution information.
#
# Copyright (c) 2010, 2013 Oracle and/or its affiliates.  All rights reserved.
#
# $Id$
#
# For use with env019, a test of stat values returned by 
# different processes accessing the same env.

source ./include.tcl
source $test_path/test.tcl

set usage "env019script flag value"

# Verify usage
if { $argc != 2 } {
	puts stderr "FAIL:[timestamp] Usage: $usage"
	puts $argc
	exit
}

# Initialize arguments
set flag [ lindex $argv 0 ]
set value [ lindex $argv 1 ]

# Join the env, trying to set the flag values
set e [eval {berkdb_env -home $testdir} $flag $value]
error_check_good env_open [is_valid_env $e] TRUE

# Get the settings for the env.  This second process should
# not be able to override the settings created when the env
# was originally opened.
set gbytes [stat_field $e mpool_stat "Cache size (gbytes)"]
set bytes [stat_field $e mpool_stat "Cache size (bytes)"]
set ncache [stat_field $e mpool_stat "Number of caches"]

#puts "gbytes is $gbytes"
#puts "bytes is $bytes"
#puts "ncache is $ncache"

# Store the values so the first process can inspect them. 
set db [berkdb_open -create -env $e -btree values.db]
error_check_good put_gbytes [eval {$db put} "gbytes" $gbytes] 0
error_check_good put_bytes [eval {$db put} "bytes" $bytes] 0
error_check_good put_ncache [eval {$db put} "ncache" $ncache] 0
error_check_good db_close [$db close] 0

# Close environment system
error_check_good env_close [$e close] 0
exit