1# The TCP server closes 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 close. 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 close", 5) 18 or die ref($self), " no connection close 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_testgrep() => 1, 27 qr/syslogd\[\d+\]: loghost .* connection close/ => 1, 28 }, 29 }, 30 server => { 31 listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" }, 32 func => sub { 33 my $self = shift; 34 shutdown(\*STDOUT, 1) 35 or die ref($self), " shutdown write failed: $!"; 36 ${$self->{syslogd}}->loggrep("loghost .* connection close", 5) 37 or die ref($self), " no connection close in syslogd.log"; 38 }, 39 loggrep => {}, 40 }, 41 file => { 42 loggrep => { 43 qr/syslogd\[\d+\]: loghost .* connection close/ => 1, 44 }, 45 }, 46); 47 481; 49