Commit 40e4cad8 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(simple_expect): If the starts with "<<<", remove it, and don't expect a line

	leader.  This is useful for catching messages from lyskomd that
	are created by libraries that we have no control over, and that
	don't emit the expected line leader.
(set_debug_calls): New proc, extracted from lyskomd_start and
	lyskomd_fail_start.  Expect the new message that is emitted
	when the debug calls are disabled.
(lyskomd_start): New optional argument: pre_lock_messages.  Moved
	code to set_debug_calls().
(lyskomd_fail_start): Ditto.
parent 9d008093
......@@ -290,6 +290,12 @@ proc simple_expect {regex {testname ""} {is_meta ""}} {
} else {
set ll $line_leader
}
if {[string range "$regex" 0 2] == "<<<"} {
set regex "[string range "$regex" 3 end]"
set ll ""
}
set test $testname
if {$test == ""} {
set test "looking for $regex"
......@@ -525,6 +531,34 @@ proc unpack_db {basename} {
}
}
proc set_debug_calls {} {
global debug_calls
global line_leader
global nl
global test
set test "Testing for debug calls"
set debug_calls 2
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 "$test (enabled)"
set debug_calls 1
}
-re "^${line_leader}Debug calls are disabled, as they should be\\.$nl" {
pass "$test (disabled)"
set debug_calls 0
}
timeout {fail "$test (timeout)"}
full_buffer {fail "$test (full_buffer)"}
eof {fail "$test (eof)"; wait}
}
if {$debug_calls == 2} {
fail "$test (no info found)"
set debug_calls 0
}
}
proc lyskomd_start {{aux_item_conf_file ""} \
{extra_config ""} \
{base_config ""} \
......@@ -536,7 +570,8 @@ proc lyskomd_start {{aux_item_conf_file ""} \
{confs 6} \
{texts 1} \
{nogarb 0} \
{db_messages {}}} {
{db_messages {}} \
{pre_lock_messages {}}} {
global spawn_id
global server_id
......@@ -551,7 +586,6 @@ proc lyskomd_start {{aux_item_conf_file ""} \
global aux_item_default_conf_file
global lyskomd_pid
global top_srcdir
global debug_calls
global mem_trace
global MEMTRACE
global line_leader
......@@ -641,7 +675,6 @@ proc lyskomd_start {{aux_item_conf_file ""} \
set test "server started"
set t $timeout
set timeout [expr {2 * $timeout}]
set debug_calls 0
set mem_trace 0
set unattached $attach
expect {
......@@ -668,15 +701,15 @@ proc lyskomd_start {{aux_item_conf_file ""} \
eof {fail "$test (eof)"; wait}
}
set_debug_calls
foreach prelockmsg $pre_lock_messages {
simple_expect "$prelockmsg"
}
set stale 0
set test "Lock created"
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*):($any*).$nl" {
if {$stale == 1} {
fail "$test (more than one stale lock file removed)"
......@@ -736,7 +769,8 @@ proc lyskomd_fail_start {log_messages
{aux_item_conf_file "" }
{extra_config ""}
{base_config ""}
{args ""}} {
{args ""}
{pre_lock_messages {}}} {
global spawn_id
global server_id
global test
......@@ -752,7 +786,6 @@ proc lyskomd_fail_start {log_messages
global lyskomd_pid
global top_srcdir
global MEMTRACE
global debug_calls
obtain_lock
......@@ -810,17 +843,12 @@ proc lyskomd_fail_start {log_messages
eof {fail "$test (eof)"; wait}
}
set debug_calls 0
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
}
-notransfer -re "^${line_leader}."
foreach prelockmsg $pre_lock_messages {
simple_expect "$prelockmsg"
}
set_debug_calls
foreach logmsg $log_messages {
simple_expect "$logmsg"
}
......
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