1# The syslogd listens on 127.0.0.1 TCP socket. 2# The client writes octet counting and non transpatent framing in 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 client, file, pipe, syslogd, server log. 7# Check that the file log contains all the messages. 8 9use strict; 10use warnings; 11use Socket; 12 13our %args = ( 14 client => { 15 connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1", 16 port => 514 }, 17 func => sub { 18 my $self = shift; 19 local $| = 1; 20 print "2 ab"; 21 ${$self->{syslogd}}->loggrep("octet counting 2", 5, 1) 22 or die ref($self), " syslogd did not 1 octet counting"; 23 print "2 c"; 24 ${$self->{syslogd}}->loggrep("octet counting 2", 5, 2) 25 or die ref($self), " syslogd did not 2 octet counting"; 26 print "def\n"; 27 ${$self->{syslogd}}->loggrep("non transparent framing", 5, 1) 28 or die ref($self), " syslogd did not 1 non transparent framing"; 29 print "g"; 30 ${$self->{syslogd}}->loggrep("non transparent framing", 5, 2) 31 or die ref($self), " syslogd did not 2 non transparent framing"; 32 print "h\nij\n2 kl"; 33 ${$self->{syslogd}}->loggrep("octet counting 2", 5, 4) 34 or die ref($self), " syslogd did not 4 octet counting"; 35 write_log($self); 36 }, 37 }, 38 syslogd => { 39 options => ["-T", "127.0.0.1:514"], 40 loggrep => { 41 qr/tcp logger .* octet counting 2, use 2 bytes/ => 3, 42 qr/tcp logger .* octet counting 2, incomplete frame, /. 43 qr/buffer 3 bytes/ => 1, 44 qr/tcp logger .* non transparent framing, use 3 bytes/ => 3, 45 qr/tcp logger .* non transparent framing, incomplete frame, /. 46 qr/buffer 1 bytes/ => 1, 47 qr/tcp logger .* use 0 bytes/ => 0, 48 qr/tcp logger .* unknown method/ => 0, 49 } 50 }, 51 file => { 52 loggrep => { 53 qr/localhost ab$/ => 1, 54 qr/localhost cd$/ => 1, 55 qr/localhost ef$/ => 1, 56 qr/localhost gh$/ => 1, 57 qr/localhost ij$/ => 1, 58 qr/localhost kl$/ => 1, 59 get_testgrep() => 1, 60 }, 61 }, 62); 63 641; 65