Commit 3e3483fa authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(lyskomd_start): New optional arguments: log_messages, init_db and

	want_stale.  Copy number.txt.  Don't copy the database if
	init_db is 0.  Expect a log message about a removal of a stale
	lock file if want_stale is 1.  Expect log_messages after the
	startup messages but before the garb messages.
(lyskomd_fail_start): Copy number.txt.
parent 846437cb
......@@ -445,7 +445,10 @@ proc lyskomd_start {{aux_item_conf_file ""} \
{extra_config ""} \
{base_config ""} \
{args ""} \
{db_suffix ""}} {
{db_suffix ""}
{log_messages {}}
{init_db 1}
{want_stale 0}} {
global spawn_id
global server_id
......@@ -476,11 +479,14 @@ proc lyskomd_start {{aux_item_conf_file ""} \
# directories...
set f [open "../lyskomd" "r"]
close $f
system "rm -rf db etc"
system "mkdir db etc"
system "cp $top_srcdir/db-crypt/db/lyskomd-data$db_suffix db/lyskomd-data"
system "cp $top_srcdir/db-crypt/db/lyskomd-texts db/"
system "chmod 644 db/lyskomd-data db/lyskomd-texts"
if {$init_db} {
system "rm -rf db etc"
system "mkdir db etc"
system "cp $top_srcdir/db-crypt/db/lyskomd-data$db_suffix db/lyskomd-data"
system "cp $top_srcdir/db-crypt/db/lyskomd-texts db/"
system "cp $top_srcdir/db-crypt/db/number.txt db/"
system "chmod 644 db/lyskomd-data db/lyskomd-texts db/number.txt"
}
set cf [open "config/lyskomd-config" "w"]
puts $cf "Client port: $clientport"
......@@ -539,6 +545,7 @@ proc lyskomd_start {{aux_item_conf_file ""} \
eof {fail "$test (eof)"; wait}
}
set stale 0
set test "Lock created"
expect {
-re "^${line_leader}WARNING: This server was compiled with --with-debug-calls\\.$nl" {
......@@ -547,6 +554,15 @@ proc lyskomd_start {{aux_item_conf_file ""} \
set debug_calls 1
exp_continue
}
-re "^${line_leader}Removed stale lock file left by ($any*):($any*).$nl" {
if {$stale == 1} {
fail "$test (more than one stale lock file removed)"
} elseif {$want_stale == 0} {
fail "$test (lyskomd removed a stale lock file)"
}
set stale 1
exp_continue
}
-re "^${line_leader}Created lock ($any*)$nl" {
pass "$test (lock file $expect_out(1,string)"
}
......@@ -555,6 +571,9 @@ proc lyskomd_start {{aux_item_conf_file ""} \
eof {fail "$test (eof)"; wait}
}
set timeout $t
if {$stale == 0 && $want_stale == 1} {
fail "$test (no stale lock file removed)"
}
unset test
simple_expect "Listening for clients on $clientport."
......@@ -565,6 +584,11 @@ proc lyskomd_start {{aux_item_conf_file ""} \
simple_expect "MSG: init_cache: using datafile."
simple_expect "Database saved on $any*"
simple_expect "Read 6 confs/persons and 1 texts"
foreach logmsg $log_messages {
simple_expect "$logmsg"
}
simple_expect "MSG: garb started."
simple_expect "MSG: garb ready. 0 texts deleted."
......@@ -614,6 +638,7 @@ proc lyskomd_fail_start {log_messages
system "mkdir db etc"
system "cp $top_srcdir/db-crypt/db/lyskomd-data db/"
system "cp $top_srcdir/db-crypt/db/lyskomd-texts db/"
system "cp $top_srcdir/db-crypt/db/number.txt db/"
set cf [open "config/lyskomd-config" "w"]
puts $cf "Client port: $clientport"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment