Commit e87db9fd authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Fixed a race condition in the test.

parent 71afde43
......@@ -126,17 +126,57 @@ expect {
# Start a new lyskomd. Check that it removes the stale lock file.
set new_pid [spawn ../lyskomd -f config/lyskomd-config]
set test "stale lock file removed"
set line_leader "\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\]\[0-9\] \[0-9\]\[0-9\]:\[0-9\]\[0-9\]:\[0-9\]\[0-9\] $new_pid "
set test "lyskomd startup"
expect {
-re "^Where does the trace want to go today. .stderr.$nl" {
pass "Tracing is activated (/dev/null)"
send "/dev/null\n"
exp_continue
}
-re " $new_pid Removed stale lock file left by $any*:$lyskomd_pid\.$nl" {
-re "^${line_leader}... Version $any* \\(process $new_pid\\) started.$nl" {
pass "$test"
}
timeout {fail "$test (timeout)"}
full_buffer {fail "$test (full_buffer)"}
eof {fail "$test (eof)"; wait}
}
set test "stale lock file removed"
expect {
-re "^${line_leader}WARNING: This server was compiled with --with-debug-calls\\.$nl" {
expect -re "^${line_leader}It isn.t safe to use in a production environment.$nl"
pass "debug calls are enabled"
set debug_calls 1
exp_continue
}
-re "^${line_leader}Removed stale lock file left by $any*:$lyskomd_pid\.$nl" {
pass "$test"
}
timeout {fail "$test (timeout)"}
full_buffer {fail "$test (full_buffer)"}
eof {fail "$test (eof)"; wait}
}
set test "New lock created"
expect {
-re "^${line_leader}Created lock ($any*)$nl" {
pass "$test (lock file $expect_out(1,string)"
}
timeout {fail "$test (timeout)"}
full_buffer {fail "$test (full_buffer)"}
eof {fail "$test (eof)"; wait}
}
simple_expect "Listening for clients on $clientport."
simple_expect "Database = [pwd]/db/lyskomd-data"
simple_expect "Backup = [pwd]/db/lyskomd-backup"
simple_expect "2nd Backup = [pwd]/db/lyskomd-backup-prev"
simple_expect "Lock File = [pwd]/db/lyskomd-lock"
simple_expect "MSG: init_cache: using datafile."
simple_expect "Database saved on $any*"
simple_expect "Read 6 confs/persons and 1 texts"
simple_expect "MSG: garb started."
simple_expect "MSG: garb ready. 0 texts deleted."
system "kill -HUP $new_pid"
set bypass 0
......
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