1# The syslogd listens on 127.0.0.1 TCP socket. 2# The client writes a message into a 127.0.0.1 TCP socket in multiple chunks. 3# The syslogd writes it into a file and through a pipe. 4# The syslogd passes it via UDP to the loghost. 5# The server receives the message on its UDP socket. 6# Find the message in file, pipe, syslogd, server log. 7# Check that the file log contains the complete message. 8 9use strict; 10use warnings; 11use Socket; 12 13my $msglen = length(get_testlog()); 14my $framelen = $msglen + 1; 15 16our %args = ( 17 client => { 18 connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1", 19 port => 514 }, 20 func => sub { 21 my $self = shift; 22 local $| = 1; 23 my $n = 0; 24 foreach (get_testlog() =~ /.{1,5}/g) { 25 $n += length; 26 print; 27 print STDERR "<<< $_\n"; 28 ${$self->{syslogd}}->loggrep("tcp logger .* buffer $n bytes", 5) 29 or die ref($self), " syslogd did not buffer $n bytes"; 30 } 31 $n++; 32 print "\n"; 33 ${$self->{syslogd}}->loggrep("tcp logger .* use $n bytes", 5) 34 or die ref($self), " syslogd did not use $n bytes"; 35 write_shutdown($self); 36 }, 37 loggrep => {}, 38 }, 39 syslogd => { 40 options => ["-T", "127.0.0.1:514"], 41 loggrep => { 42 qr/tcp logger .* buffer \d+ bytes/ => int(($msglen+4)/5), 43 qr/tcp logger .* non transparent framing, use $framelen bytes/ => 1, 44 get_testgrep() => 1, 45 }, 46 }, 47); 48 491; 50