Commit 96db7e40 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New file: Test parsing a broken aux-item file as a result of SIGWINCH.

parent 6e549028
# Test suite for lyskomd.
# Copyright (C) 2003 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
#
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING. If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
# MA 02139, USA.
#
# Please report bugs at http://bugzilla.lysator.liu.se/.
# Test parsing a broken aux-item file as a result of SIGWINCH.
set auxfile "lyskomd.0/aux-items-46.conf"
system "cp $aux_item_default_conf_file $auxfile"
lyskomd_start "$auxfile"
# Log in as admin, and enable.
client_start 5
send "A[holl "five"]\n"
simple_expect "LysKOM" "connected"
send "1000 80 0 { }\n"
simple_expect "=1000"
send "1001 0 5 [holl "gazonk"]\n"
simple_expect "=1001"
send "1002 42 255\n"
simple_expect "=1002"
send "1003 96\n"
simple_expect "=1003 40 { 10104 10103 10102 10101 10100 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 }"
# Create a broken aux-item file. A mistake can happen so easily...
system "cp $srcdir/lyskomd.0/aux-items-bad.conf $auxfile"
system "kill -WINCH $lyskomd_pid"
talk_to lyskomd
# FIXME (bug 1094): the error message from yyerror() isn't sent via
# kom_log, so there is no leading timestamp on this line. So we
# cannot use extracting_expect.
set test "syntax error diagnosed"
expect {
-re "^/$any*/src/server/testsuite/lyskomd\\.0/aux-items-46\\.conf: ($any_num): parse error, unexpected ID$nl" {
set lineno "$expect_out(1,string)"
pass "$test"
}
timeout {fail "$test (timeout)"}
eof {fail "$test (eof)"; wait}
full_buffer {fail "$test (full_buffer)"}
}
unset test
setup_xfail "*-*-*" "Bug 1093"
set test "line numbers are reset"
if {$lineno < 20} {
pass "$test"
} else {
fail "$test (got insangely large line number $lineno)"
}
unset test
simple_expect "Errors reading aux-item definition file"
set dying 0
set test "Doing something predictable when reading bad aux-item file"
expect {
-re "^${line_leader}Signal WINCH received. aux definitions reloaded.$nl" {
pass "$test (server surviving)"
}
-re "^${line_leader}Previous message is fatal\\. Will dump core now\\.$nl" {
pass "$test (server aborting)"
set dying 1
}
}
unset test
set reason 5
setup_xfail "*-*-*" "Bug 1095"
set test "server survives broken aux-item file"
if {$dying} {
set reason "restart_kom"
fail "$test (server dies)"
} else {
pass "$test"
}
unset test
if {$reason == 5} {
send "1002 96\n"
simple_expect "=1002 0 { }"
# Shut down.
send "1041 44 0\n"
simple_expect "=1041"
}
lyskomd_death "" "$reason"
client_death 5
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