From 4b8b16b4be4e66511b85e52727b15d272f0994cc Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Mon, 2 Feb 2015 17:40:25 +0000 Subject: Test that long syslog messages are truncated correctly. --- regress/usr.sbin/syslogd/args-length-tcp.pl | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 regress/usr.sbin/syslogd/args-length-tcp.pl (limited to 'regress/usr.sbin/syslogd/args-length-tcp.pl') diff --git a/regress/usr.sbin/syslogd/args-length-tcp.pl b/regress/usr.sbin/syslogd/args-length-tcp.pl new file mode 100644 index 00000000000..b935805678d --- /dev/null +++ b/regress/usr.sbin/syslogd/args-length-tcp.pl @@ -0,0 +1,39 @@ +# The client writes long messages to UDP socket. +# The syslogd writes it into a file and through a pipe. +# The syslogd passes it via TCP to the loghost. +# The server receives the message on its TCP socket. +# Find the message in client, file, pipe, syslogd, server log. +# Check that lines in server have 8192 bytes message length. + +use strict; +use warnings; +use Socket; + +my $msg = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +our %args = ( + client => { + connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 }, + func => \&write_length, + lengths => [ 8190..8193,9000 ], + }, + syslogd => { + loghost => '@tcp://localhost:$connectport', + options => ["-u"], + loggrep => { + $msg => 5, + } + }, + server => { + listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" }, + # >>> <13>Jan 31 00:10:11 0123456789ABC...567 + loggrep => { + $msg => 5, + qr/^>>> .{19} .{8190}$/ => 1, + qr/^>>> .{19} .{8191}$/ => 1, + qr/^>>> .{19} .{8192}$/ => 3, + }, + }, +); + +1; -- cgit v1.2.3