Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / test / tcl / log008.tcl
1 # See the file LICENSE for redistribution information.
2 #
3 # Copyright (c) 2005, 2012 Oracle and/or its affiliates.  All rights reserved.
4 #
5 # $Id$
6 #
7 # TEST  log008
8 # TEST  Test what happens if a txn_ckp record falls into a
9 # TEST  different log file than the DBREG_CKP records generated
10 # TEST  by the same checkpoint.
11
12 proc log008 { { nhandles 100 } args } {
13         source ./include.tcl
14         set tnum "008"
15
16         puts "Log$tnum: Checkpoint test with records spanning log files."
17         env_cleanup $testdir
18
19         # Set up env command for use later.
20         set envcmd "berkdb_env -create -txn -home $testdir"
21
22         # Start up a child process which will open a bunch of handles
23         # on a database and write to it, running until it creates a
24         # checkpoint with records spanning two log files.
25         puts "\tLog$tnum.a: Spawning child tclsh."
26         set pid [exec $tclsh_path $test_path/wrap.tcl \
27             log008script.tcl $testdir/log008script.log $nhandles &]
28
29         watch_procs $pid 3
30
31         puts "\tLog$tnum.b: Child is done."
32
33         # Join the env with recovery.  This ought to work.
34         puts "\tLog$tnum.c: Join abandoned child env with recovery."
35         set env [eval $envcmd -recover]
36
37         # Clean up.
38         error_check_good env_close [$env close] 0
39
40         # Check log file for failures.
41         set errstrings [eval findfail $testdir/log008script.log]
42         foreach str $errstrings {
43                 puts "FAIL: error message in log008 log file: $str"
44         }
45 }
46