args-server-tcp-error.pl revision 1.1
1# The TCP server aborts the connection to syslogd. 2# The client writes a message to Sys::Syslog native method. 3# The syslogd writes it into a file and through a pipe. 4# The syslogd passes it via IPv4 TCP to an explicit loghost. 5# The server receives the message on its TCP socket. 6# Find the message in client, pipe, syslogd log. 7# Check that syslogd writes a log message about the server error. 8 9use strict; 10use warnings; 11use Socket; 12 13our %args = ( 14 client => { 15 func => sub { 16 my $self = shift; 17 ${$self->{syslogd}}->loggrep("loghost .* connection error", 2) 18 or die "connection error in syslogd.log"; 19 write_log($self, @_); 20 }, 21 }, 22 syslogd => { 23 loghost => '@tcp://127.0.0.1:$connectport', 24 loggrep => { 25 qr/Logging to FORWTCP \@tcp:\/\/127.0.0.1:\d+/ => '>=4', 26 get_testlog() => 1, 27 qr/syslogd: loghost .* connection error/ => 2, 28 }, 29 }, 30 server => { 31 listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" }, 32 func => sub { 33 my $self = shift; 34 setsockopt(STDOUT, SOL_SOCKET, SO_LINGER, pack('ii', 1, 0)) 35 or die "set socket linger failed: $!"; 36 }, 37 loggrep => {}, 38 }, 39 file => { 40 loggrep => { 41 qr/syslogd: loghost .* connection error: Connection reset by peer/ 42 => 1, 43 }, 44 }, 45); 46 471; 48