diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-07-16 16:34:50 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-07-16 16:34:50 +0000 |
commit | 6575491efa05726f0bb0780fff58a71369b905e3 (patch) | |
tree | a2c1b828a8d8c9845f30319e687fa2e280b318cd /regress | |
parent | 4b27f6129efe0ba1e54373ec1d436938e51ec0ae (diff) |
Test that syslogd does not append white spaces to messages. Per
default the test pattern is stricter now. Also do some test cleanup
Diffstat (limited to 'regress')
89 files changed, 218 insertions, 174 deletions
diff --git a/regress/usr.sbin/syslogd/args-block-duplicate.pl b/regress/usr.sbin/syslogd/args-block-duplicate.pl index b8f8a364ee3..66778dce7f5 100644 --- a/regress/usr.sbin/syslogd/args-block-duplicate.pl +++ b/regress/usr.sbin/syslogd/args-block-duplicate.pl @@ -12,7 +12,7 @@ use Cwd; use Sys::Hostname; my $objdir = getcwd(); -(my $hostname = hostname()) =~ s/\..*//; +(my $host = hostname()) =~ s/\..*//; our %args = ( syslogd => { @@ -28,7 +28,7 @@ our %args = ( *.* $objdir/file-2.log *.* $objdir/file-4.log *.* $objdir/file-5.log -+$hostname ++$host *.* $objdir/file-2.log *.* $objdir/file-3.log *.* $objdir/file-5.log @@ -37,13 +37,13 @@ EOF }, # exactly the files in the last block get the log message multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 1 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-block-host-quick.pl b/regress/usr.sbin/syslogd/args-block-host-quick.pl index bcbd3aae617..eb1c5745d38 100644 --- a/regress/usr.sbin/syslogd/args-block-host-quick.pl +++ b/regress/usr.sbin/syslogd/args-block-host-quick.pl @@ -12,14 +12,14 @@ use Cwd; use Sys::Hostname; my $objdir = getcwd(); -(my $hostname = hostname()) =~ s/\..*//; +(my $host = hostname()) =~ s/\..*//; our %args = ( syslogd => { conf => <<"EOF", +nonexist *.* $objdir/file-0.log -++$hostname +++$host *.* $objdir/file-1.log *.* $objdir/file-2.log +* @@ -27,10 +27,10 @@ our %args = ( EOF }, multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-block-host.pl b/regress/usr.sbin/syslogd/args-block-host.pl index 8082ea37254..58311aa4629 100644 --- a/regress/usr.sbin/syslogd/args-block-host.pl +++ b/regress/usr.sbin/syslogd/args-block-host.pl @@ -12,14 +12,14 @@ use Cwd; use Sys::Hostname; my $objdir = getcwd(); -(my $hostname = hostname()) =~ s/\..*//; +(my $host = hostname()) =~ s/\..*//; our %args = ( syslogd => { conf => <<"EOF", +nonexist *.* $objdir/file-0.log -+$hostname ++$host *.* $objdir/file-1.log *.* $objdir/file-2.log +* @@ -27,10 +27,10 @@ our %args = ( EOF }, multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 1 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl b/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl index d8edff60bd6..12b63567dda 100644 --- a/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl +++ b/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl @@ -12,7 +12,7 @@ use Cwd; use Sys::Hostname; my $objdir = getcwd(); -(my $hostname = hostname()) =~ s/\..*//; +(my $host = hostname()) =~ s/\..*//; our %args = ( syslogd => { @@ -22,7 +22,7 @@ our %args = ( *.* $objdir/file-0.log !!syslogd-regress *.* $objdir/file-1.log -+$hostname ++$host *.* $objdir/file-2.log *.* $objdir/file-3.log !* @@ -31,11 +31,11 @@ our %args = ( EOF }, multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-block-prog-host.pl b/regress/usr.sbin/syslogd/args-block-prog-host.pl index e3176e4427c..8a27efa453a 100644 --- a/regress/usr.sbin/syslogd/args-block-prog-host.pl +++ b/regress/usr.sbin/syslogd/args-block-prog-host.pl @@ -12,7 +12,7 @@ use Cwd; use Sys::Hostname; my $objdir = getcwd(); -(my $hostname = hostname()) =~ s/\..*//; +(my $host = hostname()) =~ s/\..*//; our %args = ( syslogd => { @@ -22,7 +22,7 @@ our %args = ( *.* $objdir/file-0.log !syslogd-regress *.* $objdir/file-1.log -+$hostname ++$host *.* $objdir/file-2.log !nonexist *.* $objdir/file-3.log @@ -35,13 +35,13 @@ our %args = ( EOF }, multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-block-prog-quick.pl b/regress/usr.sbin/syslogd/args-block-prog-quick.pl index bf11c31b6ab..a3e48c0393e 100644 --- a/regress/usr.sbin/syslogd/args-block-prog-quick.pl +++ b/regress/usr.sbin/syslogd/args-block-prog-quick.pl @@ -25,10 +25,10 @@ our %args = ( EOF }, multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 0 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-block-prog.pl b/regress/usr.sbin/syslogd/args-block-prog.pl index b944625cac1..a2cff7d1b7a 100644 --- a/regress/usr.sbin/syslogd/args-block-prog.pl +++ b/regress/usr.sbin/syslogd/args-block-prog.pl @@ -25,10 +25,10 @@ our %args = ( EOF }, multifile => [ - { loggrep => { get_testlog() => 0 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 1 } }, - { loggrep => { get_testlog() => 1 } }, + { loggrep => { get_testgrep() => 0 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 1 } }, + { loggrep => { get_testgrep() => 1 } }, ], ); diff --git a/regress/usr.sbin/syslogd/args-client-bind-only4.pl b/regress/usr.sbin/syslogd/args-client-bind-only4.pl index 5dd0cb3bd6d..b56b18be572 100644 --- a/regress/usr.sbin/syslogd/args-client-bind-only4.pl +++ b/regress/usr.sbin/syslogd/args-client-bind-only4.pl @@ -28,7 +28,7 @@ our %args = ( listen => { domain => AF_INET, addr => "127.0.0.1" }, }, file => { - loggrep => qr/ 127.0.0.1 /. get_testlog(), + loggrep => qr/ 127.0.0.1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind-only6.pl b/regress/usr.sbin/syslogd/args-client-bind-only6.pl index 26c5ea7b4c5..8d0795cff2f 100644 --- a/regress/usr.sbin/syslogd/args-client-bind-only6.pl +++ b/regress/usr.sbin/syslogd/args-client-bind-only6.pl @@ -28,7 +28,7 @@ our %args = ( listen => { domain => AF_INET6, addr => "::1" }, }, file => { - loggrep => qr/ ::1 /. get_testlog(), + loggrep => qr/ ::1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind-port.pl b/regress/usr.sbin/syslogd/args-client-bind-port.pl index f18f5a06750..7a7f8d65edb 100644 --- a/regress/usr.sbin/syslogd/args-client-bind-port.pl +++ b/regress/usr.sbin/syslogd/args-client-bind-port.pl @@ -18,7 +18,7 @@ our %args = ( connect => { domain => AF_UNSPEC, addr => "localhost", port => $port }, loggrep => { qr/connect sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogd => { @@ -30,7 +30,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind.pl b/regress/usr.sbin/syslogd/args-client-bind.pl index 414cd896839..e34db23874c 100644 --- a/regress/usr.sbin/syslogd/args-client-bind.pl +++ b/regress/usr.sbin/syslogd/args-client-bind.pl @@ -15,7 +15,7 @@ our %args = ( connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 }, loggrep => { qr/connect sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogd => { @@ -27,7 +27,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind4-port.pl b/regress/usr.sbin/syslogd/args-client-bind4-port.pl index 406a3c26ba6..02c44ded558 100644 --- a/regress/usr.sbin/syslogd/args-client-bind4-port.pl +++ b/regress/usr.sbin/syslogd/args-client-bind4-port.pl @@ -26,7 +26,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind4.pl b/regress/usr.sbin/syslogd/args-client-bind4.pl index 15521a7f11f..5a283170ec0 100644 --- a/regress/usr.sbin/syslogd/args-client-bind4.pl +++ b/regress/usr.sbin/syslogd/args-client-bind4.pl @@ -23,7 +23,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind6-port.pl b/regress/usr.sbin/syslogd/args-client-bind6-port.pl index ac9372a96a8..fbbcdacf95a 100644 --- a/regress/usr.sbin/syslogd/args-client-bind6-port.pl +++ b/regress/usr.sbin/syslogd/args-client-bind6-port.pl @@ -26,7 +26,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-bind6.pl b/regress/usr.sbin/syslogd/args-client-bind6.pl index c19ae30b35f..95ad08c1713 100644 --- a/regress/usr.sbin/syslogd/args-client-bind6.pl +++ b/regress/usr.sbin/syslogd/args-client-bind6.pl @@ -23,7 +23,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-native.pl b/regress/usr.sbin/syslogd/args-client-native.pl index 4fbdf6e581a..86ad61db621 100644 --- a/regress/usr.sbin/syslogd/args-client-native.pl +++ b/regress/usr.sbin/syslogd/args-client-native.pl @@ -9,14 +9,14 @@ use strict; use warnings; use Sys::Hostname; -(my $host = hostname()) =~ s/\..*//; # short name +(my $host = hostname()) =~ s/\..*//; our %args = ( client => { logsock => { type => "native" }, }, file => { - loggrep => qr/ $host syslogd-regress\[\d+\]: /. get_testlog(), + loggrep => qr/ $host syslogd-regress\[\d+\]: /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp-multichunks.pl b/regress/usr.sbin/syslogd/args-client-tcp-multichunks.pl index ee7359b5bee..837f0655c9a 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp-multichunks.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp-multichunks.pl @@ -37,7 +37,7 @@ our %args = ( qr/tcp logger .* buffer \d+ bytes/ => int((length(get_testlog())+4)/5), qr/tcp logger .* complete line/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp-nodns.pl b/regress/usr.sbin/syslogd/args-client-tcp-nodns.pl index 2dc7d29c351..7c9fa7d8309 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp-nodns.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp-nodns.pl @@ -17,7 +17,7 @@ our %args = ( options => ["-n", "-T", "127.0.0.1:514"], }, file => { - loggrep => qr/ 127.0.0.1 syslogd-regress\[\d+\]: /. get_testlog(), + loggrep => qr/ 127.0.0.1 syslogd-regress\[\d+\]: /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp.pl b/regress/usr.sbin/syslogd/args-client-tcp.pl index dd4e88b24e8..5e4ea942f88 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp.pl @@ -22,7 +22,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost syslogd-regress\[\d+\]: /. get_testlog(), + loggrep => qr/ localhost syslogd-regress\[\d+\]: /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp4-nodns.pl b/regress/usr.sbin/syslogd/args-client-tcp4-nodns.pl index 7631c92553c..c08670bb162 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp4-nodns.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp4-nodns.pl @@ -19,7 +19,7 @@ our %args = ( options => ["-n", "-T", "127.0.0.1:514"], }, file => { - loggrep => qr/ 127.0.0.1 /. get_testlog(), + loggrep => qr/ 127.0.0.1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp4.pl b/regress/usr.sbin/syslogd/args-client-tcp4.pl index 9b75fe11978..e8feb279f12 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp4.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp4.pl @@ -15,7 +15,7 @@ our %args = ( port => 514 }, loggrep => { qr/connect sock: 127.0.0.1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogd => { @@ -27,7 +27,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp6-nodns.pl b/regress/usr.sbin/syslogd/args-client-tcp6-nodns.pl index a30a0453214..630178fe58e 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp6-nodns.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp6-nodns.pl @@ -19,7 +19,7 @@ our %args = ( options => ["-n", "-T", "[::1]:514"], }, file => { - loggrep => qr/ ::1 /. get_testlog(), + loggrep => qr/ ::1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-tcp6.pl b/regress/usr.sbin/syslogd/args-client-tcp6.pl index 215e3be5a74..37d90bf2314 100644 --- a/regress/usr.sbin/syslogd/args-client-tcp6.pl +++ b/regress/usr.sbin/syslogd/args-client-tcp6.pl @@ -15,7 +15,7 @@ our %args = ( port => 514 }, loggrep => { qr/connect sock: ::1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogd => { @@ -27,7 +27,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-udp-nodns.pl b/regress/usr.sbin/syslogd/args-client-udp-nodns.pl index f7edc7ca80a..092444baa66 100644 --- a/regress/usr.sbin/syslogd/args-client-udp-nodns.pl +++ b/regress/usr.sbin/syslogd/args-client-udp-nodns.pl @@ -14,9 +14,17 @@ our %args = ( }, syslogd => { options => ["-un"], + loggrep => get_testlog(), + }, + server => { + loggrep => get_testlog(), + }, + pipe => { + loggrep => get_testlog(), }, file => { - loggrep => qr/ 127.0.0.1 syslogd-regress\[\d+\]: /. get_testlog(), + # Sys::Syslog UDP is broken, it appends a \n\0. + loggrep => qr/ 127.0.0.1 syslogd-regress\[\d+\]: /.get_testlog().qr/ $/, }, ); diff --git a/regress/usr.sbin/syslogd/args-client-udp.pl b/regress/usr.sbin/syslogd/args-client-udp.pl index 3d33187ac63..faa7f52625d 100644 --- a/regress/usr.sbin/syslogd/args-client-udp.pl +++ b/regress/usr.sbin/syslogd/args-client-udp.pl @@ -18,9 +18,17 @@ our %args = ( qr/^root .* internet/ => 0, qr/^_syslogd .* internet/ => 2, }, + loggrep => get_testlog(), + }, + server => { + loggrep => get_testlog(), + }, + pipe => { + loggrep => get_testlog(), }, file => { - loggrep => qr/ localhost syslogd-regress\[\d+\]: /. get_testlog(), + # Sys::Syslog UDP is broken, it appends a \n\0. + loggrep => qr/ localhost syslogd-regress\[\d+\]: /.get_testlog().qr/ $/, }, ); diff --git a/regress/usr.sbin/syslogd/args-client-udp4-nodns.pl b/regress/usr.sbin/syslogd/args-client-udp4-nodns.pl index 24aba63e881..4637b650f17 100644 --- a/regress/usr.sbin/syslogd/args-client-udp4-nodns.pl +++ b/regress/usr.sbin/syslogd/args-client-udp4-nodns.pl @@ -17,7 +17,7 @@ our %args = ( options => ["-un"], }, file => { - loggrep => qr/ 127.0.0.1 /. get_testlog(), + loggrep => qr/ 127.0.0.1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-udp4.pl b/regress/usr.sbin/syslogd/args-client-udp4.pl index 8c19b8b63ad..167fd0d1f09 100644 --- a/regress/usr.sbin/syslogd/args-client-udp4.pl +++ b/regress/usr.sbin/syslogd/args-client-udp4.pl @@ -21,7 +21,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-udp6-nodns.pl b/regress/usr.sbin/syslogd/args-client-udp6-nodns.pl index 27fd3f97f99..8e6de0d14e1 100644 --- a/regress/usr.sbin/syslogd/args-client-udp6-nodns.pl +++ b/regress/usr.sbin/syslogd/args-client-udp6-nodns.pl @@ -17,7 +17,7 @@ our %args = ( options => ["-un"], }, file => { - loggrep => qr/ ::1 /. get_testlog(), + loggrep => qr/ ::1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-udp6.pl b/regress/usr.sbin/syslogd/args-client-udp6.pl index f13072a2398..7476b9f295f 100644 --- a/regress/usr.sbin/syslogd/args-client-udp6.pl +++ b/regress/usr.sbin/syslogd/args-client-udp6.pl @@ -21,7 +21,7 @@ our %args = ( }, }, file => { - loggrep => qr/ localhost /. get_testlog(), + loggrep => qr/ localhost /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-client-unix.pl b/regress/usr.sbin/syslogd/args-client-unix.pl index 142b59ccb5a..8327112965f 100644 --- a/regress/usr.sbin/syslogd/args-client-unix.pl +++ b/regress/usr.sbin/syslogd/args-client-unix.pl @@ -9,14 +9,24 @@ use strict; use warnings; use Sys::Hostname; -(my $host = hostname()) =~ s/\..*//; # short name +(my $host = hostname()) =~ s/\..*//; our %args = ( client => { logsock => { type => "unix" }, }, + syslogd => { + loggrep => get_testlog(), + }, + server => { + loggrep => get_testlog(), + }, + pipe => { + loggrep => get_testlog(), + }, file => { - loggrep => qr/ $host syslogd-regress\[\d+\]: /. get_testlog(), + # Sys::Syslog unix is broken, it appends a \n\0. + loggrep => qr/ $host syslogd-regress\[\d+\]: /.get_testlog().qr/ $/, }, ); diff --git a/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl index e55c5eadecf..8b54844351b 100644 --- a/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl +++ b/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl @@ -47,7 +47,7 @@ our %args = ( get_firstlog() => 1, get_secondlog() => 1, get_thirdlog() => 0, - get_testlog() => 0, + get_testgrep() => 0, qr/syslogd: start/ => 1, get_charlog() => '>=10', }, @@ -60,7 +60,7 @@ our %args = ( get_firstlog() => 1, get_secondlog() => 1, get_thirdlog() => 1, - get_testlog() => 0, + get_testgrep() => 0, qr/syslogd: start/ => 1, get_charlog() => 300, qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1, diff --git a/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl b/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl index d4b2f29b72a..b711ab921b6 100644 --- a/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl +++ b/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl @@ -48,7 +48,7 @@ our %args = ( get_firstlog() => 1, get_secondlog() => 1, get_thirdlog() => 0, - get_testlog() => 0, + get_testgrep() => 0, qr/syslogd: start/ => 1, get_charlog() => '>=10', }, @@ -61,7 +61,7 @@ our %args = ( get_firstlog() => 1, get_secondlog() => 1, get_thirdlog() => 1, - get_testlog() => 0, + get_testgrep() => 0, qr/syslogd: start/ => 1, get_charlog() => 300, qr/syslogd: dropped 2[0-9][0-9] messages to remote loghost/ => 1, diff --git a/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl b/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl index c5bdfc971dd..1d48ffa97a4 100644 --- a/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl +++ b/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl @@ -27,7 +27,7 @@ our %args = ( }, }, multifile => [ - (map { { loggrep => get_testlog() } } 0..15), + (map { { loggrep => get_testgrep() } } 0..15), (map { { loggrep => { qr/./s => 0 } } } 16..19), ], ); diff --git a/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl b/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl index 239954c42a1..aa019fc1c3c 100644 --- a/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl +++ b/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl @@ -52,7 +52,7 @@ our %args = ( }, }, multifile => [ - (map { { loggrep => get_testlog() } } 0..16), + (map { { loggrep => get_testgrep() } } 0..16), (map { { loggrep => { qr/./s => 0 } } } 17..19), ], ); diff --git a/regress/usr.sbin/syslogd/args-localhost.pl b/regress/usr.sbin/syslogd/args-localhost.pl index 3bd2a4e6732..a3d1f47f8be 100644 --- a/regress/usr.sbin/syslogd/args-localhost.pl +++ b/regress/usr.sbin/syslogd/args-localhost.pl @@ -13,21 +13,21 @@ our %args = ( connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 }, loggrep => { qr/connect sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogd => { loghost => '@localhost:$connectport', options => ["-u"], loggrep => { - qr/ from localhost, msg /.get_testlog() => 1, + qr/ from localhost, msg /.get_testgrep() => 1, }, }, server => { listen => { domain => AF_UNSPEC, addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-maxhostlen.pl b/regress/usr.sbin/syslogd/args-maxhostlen.pl index d742f545dde..3808dd1ecf5 100644 --- a/regress/usr.sbin/syslogd/args-maxhostlen.pl +++ b/regress/usr.sbin/syslogd/args-maxhostlen.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@'.('X'x256).':514', loggrep => { qr/syslogd: host too long "\@X+/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-maxloghostlen.pl b/regress/usr.sbin/syslogd/args-maxloghostlen.pl index 88ed1302b07..f38b45d7a22 100644 --- a/regress/usr.sbin/syslogd/args-maxloghostlen.pl +++ b/regress/usr.sbin/syslogd/args-maxloghostlen.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@'.('X'x300), loggrep => { qr/syslogd: loghost too long "\@X+/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-maxportlen.pl b/regress/usr.sbin/syslogd/args-maxportlen.pl index d3f53a17732..27e25a5f696 100644 --- a/regress/usr.sbin/syslogd/args-maxportlen.pl +++ b/regress/usr.sbin/syslogd/args-maxportlen.pl @@ -13,7 +13,7 @@ our %args = ( loghost => '@127.0.0.1:'.('X'x32), loggrep => { qr/syslogd: port too long "\@127.0.0.1:X+/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-maxtcp.pl b/regress/usr.sbin/syslogd/args-maxtcp.pl index 36dfb5f5d32..15ca28144d9 100644 --- a/regress/usr.sbin/syslogd/args-maxtcp.pl +++ b/regress/usr.sbin/syslogd/args-maxtcp.pl @@ -47,10 +47,8 @@ our %args = ( ) or die "tcp socket 1 connect again failed: $!"; # write messages over all connections for (my $i = 0; $i < MAXTCP; $i++) { - my $msg = get_testlog(). " $i tcp socket"; my $fh = $s[$i]; - print $fh "$msg\n"; - print STDERR "<<< $msg\n"; + write_tcp($self, $fh, $i); } ${$self->{syslogd}}->loggrep("tcp logger .* complete line", 5, MAXTCP) or die ref($self), @@ -72,7 +70,9 @@ our %args = ( }, file => { loggrep => { - qr/ localhost /.get_testlog().qr/ \d+ tcp socket/ => MAXTCP, + qr/ localhost .* tcp socket: /.get_testgrep() => MAXTCP, + (map { " $_ tcp socket: ".get_testgrep() => 1 } 0..MAXTCP-1), + MAXTCP." tcp socket: ".get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-maxunix.pl b/regress/usr.sbin/syslogd/args-maxunix.pl index d0d5f3e8879..7690c3c8cd1 100644 --- a/regress/usr.sbin/syslogd/args-maxunix.pl +++ b/regress/usr.sbin/syslogd/args-maxunix.pl @@ -8,18 +8,21 @@ use strict; use warnings; +use Sys::Hostname; use IO::Socket::UNIX; use constant MAXUNIX => 21; +(my $host = hostname()) =~ s/\..*//; + our %args = ( client => { func => sub { my $self = shift; - write_unix($self); + write_unix($self, "/dev/log"); foreach (1..(MAXUNIX-1)) { - write_unix($self, "unix-$_.sock"); + write_unix($self, "unix-$_.sock", $_); } - ${$self->{syslogd}}->loggrep(get_testlog(), 5, MAXUNIX) + ${$self->{syslogd}}->loggrep(get_testgrep(), 5, MAXUNIX) or die ref($self), " syslogd did not receive complete line"; write_shutdown($self); }, @@ -32,10 +35,10 @@ our %args = ( }, file => { loggrep => { - get_testlog()." /dev/log unix socket" => 1, - (map { (get_testlog()." unix-$_.sock unix socket" => 1) } - (1..(MAXUNIX-1))), - get_testlog()." unix-".MAXUNIX.".sock unix socket" => 0, + qr/ $host .* unix socket: /.get_testgrep() => MAXUNIX, + "/dev/log unix socket" => 1, + (map { " $_ unix socket: ".get_testgrep() => 1 } 1..MAXUNIX-1), + MAXUNIX." unix socket: ".get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-memory-clear.pl b/regress/usr.sbin/syslogd/args-memory-clear.pl index 7975d06aef9..b20075a21ff 100644 --- a/regress/usr.sbin/syslogd/args-memory-clear.pl +++ b/regress/usr.sbin/syslogd/args-memory-clear.pl @@ -15,7 +15,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 2, qr/ctlcmd 3/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => [ { @@ -23,7 +23,7 @@ our %args = ( loggrep => qr/Log cleared/, }, { options => ["memory"], - loggrep => { get_testlog() => 0 }, + loggrep => { get_testgrep() => 0 }, } ], ); diff --git a/regress/usr.sbin/syslogd/args-memory-flags.pl b/regress/usr.sbin/syslogd/args-memory-flags.pl index 3c05a11137c..df88fbf3168 100644 --- a/regress/usr.sbin/syslogd/args-memory-flags.pl +++ b/regress/usr.sbin/syslogd/args-memory-flags.pl @@ -15,7 +15,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 1, qr/ctlcmd 5/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => { diff --git a/regress/usr.sbin/syslogd/args-memory-list.pl b/regress/usr.sbin/syslogd/args-memory-list.pl index 12697d60728..036d417c293 100644 --- a/regress/usr.sbin/syslogd/args-memory-list.pl +++ b/regress/usr.sbin/syslogd/args-memory-list.pl @@ -14,7 +14,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 1, qr/ctlcmd 4/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => { diff --git a/regress/usr.sbin/syslogd/args-memory-overflow-flags.pl b/regress/usr.sbin/syslogd/args-memory-overflow-flags.pl index 627a1e2f309..a0aad026275 100644 --- a/regress/usr.sbin/syslogd/args-memory-overflow-flags.pl +++ b/regress/usr.sbin/syslogd/args-memory-overflow-flags.pl @@ -22,7 +22,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 1, qr/ctlcmd 5/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => { diff --git a/regress/usr.sbin/syslogd/args-memory-read-clear.pl b/regress/usr.sbin/syslogd/args-memory-read-clear.pl index 31b0029e604..cd86447b925 100644 --- a/regress/usr.sbin/syslogd/args-memory-read-clear.pl +++ b/regress/usr.sbin/syslogd/args-memory-read-clear.pl @@ -15,7 +15,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 2, qr/ctlcmd 2/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => [ { @@ -23,7 +23,7 @@ our %args = ( down => get_downlog(), }, { options => ["memory"], - loggrep => { get_testlog() => 0 }, + loggrep => { get_testgrep() => 0 }, } ], ); diff --git a/regress/usr.sbin/syslogd/args-memory-read-cont.pl b/regress/usr.sbin/syslogd/args-memory-read-cont.pl index 1e1ccdaab13..50fc94639fd 100644 --- a/regress/usr.sbin/syslogd/args-memory-read-cont.pl +++ b/regress/usr.sbin/syslogd/args-memory-read-cont.pl @@ -15,7 +15,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 2, qr/ctlcmd 6/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => [ { diff --git a/regress/usr.sbin/syslogd/args-memory-read.pl b/regress/usr.sbin/syslogd/args-memory-read.pl index 6d65480592b..9f209dfb414 100644 --- a/regress/usr.sbin/syslogd/args-memory-read.pl +++ b/regress/usr.sbin/syslogd/args-memory-read.pl @@ -15,7 +15,7 @@ our %args = ( loggrep => { qr/Accepting control connection/ => 2, qr/ctlcmd 1/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, syslogc => [ { diff --git a/regress/usr.sbin/syslogd/args-only4.pl b/regress/usr.sbin/syslogd/args-only4.pl index 0b07cf963de..8fb39ab9d6c 100644 --- a/regress/usr.sbin/syslogd/args-only4.pl +++ b/regress/usr.sbin/syslogd/args-only4.pl @@ -26,7 +26,7 @@ our %args = ( listen => { domain => AF_INET, addr => "127.0.0.1" }, }, file => { - loggrep => qr/ 127.0.0.1 /. get_testlog(), + loggrep => qr/ 127.0.0.1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-only6.pl b/regress/usr.sbin/syslogd/args-only6.pl index 831ff493012..831f8225b8e 100644 --- a/regress/usr.sbin/syslogd/args-only6.pl +++ b/regress/usr.sbin/syslogd/args-only6.pl @@ -26,7 +26,7 @@ our %args = ( listen => { domain => AF_INET6, addr => "::1" }, }, file => { - loggrep => qr/ ::1 /. get_testlog(), + loggrep => qr/ ::1 /. get_testgrep(), }, ); diff --git a/regress/usr.sbin/syslogd/args-prog.pl b/regress/usr.sbin/syslogd/args-prog.pl index f44ae616751..fc020c338f3 100644 --- a/regress/usr.sbin/syslogd/args-prog.pl +++ b/regress/usr.sbin/syslogd/args-prog.pl @@ -35,9 +35,9 @@ our %args = ( EOF }, check => sub { - check_file("foo", { get_testlog() => 0, qr/syslogd: start/ => 1 }); - check_file("bar", { get_testlog() => 1, qr/syslogd: start/ => 0 }); - check_file("foobar", { get_testlog() => 0, qr/syslogd: start/ => 1 }); + check_file("foo", { get_testgrep() => 0, qr/syslogd: start/ => 1 }); + check_file("bar", { get_testgrep() => 1, qr/syslogd: start/ => 0 }); + check_file("foobar", { get_testgrep() => 0, qr/syslogd: start/ => 1 }); }, ); diff --git a/regress/usr.sbin/syslogd/args-proto-invalid.pl b/regress/usr.sbin/syslogd/args-proto-invalid.pl index fdb6172e221..fa251015305 100644 --- a/regress/usr.sbin/syslogd/args-proto-invalid.pl +++ b/regress/usr.sbin/syslogd/args-proto-invalid.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@invalid://127.0.0.1', loggrep => { qr/syslogd: bad protocol "\@invalid:\/\/127.0.0.1"/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-proto-udp.pl b/regress/usr.sbin/syslogd/args-proto-udp.pl index 01b58f1dd99..4767cdfa32c 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@udp://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWUDP \@udp:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl index 9ce70c77e43..fdeef239ac2 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@udp4://[::1]', loggrep => { qr/syslogd: bad hostname "\@udp4:\/\/\[::1\]"/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl index c092de98834..fcdb6eed016 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@udp4://127.0.0.1', loggrep => { qr/syslogd: no udp4 "\@udp4:\/\/127.0.0.1/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, options => ["-6"], }, diff --git a/regress/usr.sbin/syslogd/args-proto-udp4.pl b/regress/usr.sbin/syslogd/args-proto-udp4.pl index 66953a847b1..e690b5f2e5f 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp4.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp4.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@udp4://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWUDP \@udp4:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl index 390097261e7..7ffa91f76ba 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@udp6://127.0.0.1', loggrep => { qr/syslogd: bad hostname "\@udp6:\/\/127.0.0.1"/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl index 1977824f6b1..25bdeed2d86 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl @@ -12,7 +12,7 @@ our %args = ( loghost => '@udp6://[::1]', loggrep => { qr/syslogd: no udp6 "\@udp6:\/\/\[::1\]/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, options => ["-4"], }, diff --git a/regress/usr.sbin/syslogd/args-proto-udp6.pl b/regress/usr.sbin/syslogd/args-proto-udp6.pl index 8b39c1598e6..951dae4fae8 100644 --- a/regress/usr.sbin/syslogd/args-proto-udp6.pl +++ b/regress/usr.sbin/syslogd/args-proto-udp6.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@udp6://[::1]:$connectport', loggrep => { qr/Logging to FORWUDP \@udp6:\/\/\[::1\]:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { diff --git a/regress/usr.sbin/syslogd/args-rsyslog-tcp.pl b/regress/usr.sbin/syslogd/args-rsyslog-tcp.pl index 2257f99dda5..571c59fe774 100644 --- a/regress/usr.sbin/syslogd/args-rsyslog-tcp.pl +++ b/regress/usr.sbin/syslogd/args-rsyslog-tcp.pl @@ -17,7 +17,7 @@ our %args = ( rsyslogd => { listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" }, loggrep => { - get_testlog() => 1, + get_testlog().qr/'$/ => 1, qr/Error/ => 0, }, }, diff --git a/regress/usr.sbin/syslogd/args-rsyslog-tls.pl b/regress/usr.sbin/syslogd/args-rsyslog-tls.pl index b396167270c..6226b658dee 100644 --- a/regress/usr.sbin/syslogd/args-rsyslog-tls.pl +++ b/regress/usr.sbin/syslogd/args-rsyslog-tls.pl @@ -17,7 +17,7 @@ our %args = ( rsyslogd => { listen => { domain => AF_INET, proto => "tls", addr => "127.0.0.1" }, loggrep => { - get_testlog() => 1, + get_testlog().qr/'$/ => 1, qr/Error/ => 0, }, }, diff --git a/regress/usr.sbin/syslogd/args-rsyslog-udp.pl b/regress/usr.sbin/syslogd/args-rsyslog-udp.pl index be5e0f66d0d..bfe23c900a5 100644 --- a/regress/usr.sbin/syslogd/args-rsyslog-udp.pl +++ b/regress/usr.sbin/syslogd/args-rsyslog-udp.pl @@ -13,7 +13,7 @@ our %args = ( rsyslogd => { listen => { domain => AF_INET, proto => "udp", addr => "127.0.0.1" }, loggrep => { - get_testlog() => 2, + get_testlog().qr/'$/ => 1, qr/Error/ => 0, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tcp-close.pl b/regress/usr.sbin/syslogd/args-server-tcp-close.pl index e02015742a5..0fe137c8cab 100644 --- a/regress/usr.sbin/syslogd/args-server-tcp-close.pl +++ b/regress/usr.sbin/syslogd/args-server-tcp-close.pl @@ -23,7 +23,7 @@ our %args = ( loghost => '@tcp://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTCP \@tcp:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection close/ => 2, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tcp-error.pl b/regress/usr.sbin/syslogd/args-server-tcp-error.pl index 8869bffe0e4..e62e7d5ea4d 100644 --- a/regress/usr.sbin/syslogd/args-server-tcp-error.pl +++ b/regress/usr.sbin/syslogd/args-server-tcp-error.pl @@ -27,7 +27,7 @@ our %args = ( loghost => '@tcp://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTCP \@tcp:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error/ => 2, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl b/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl index 81cd09a4cb8..b1bd834eaa9 100644 --- a/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl +++ b/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl @@ -25,7 +25,7 @@ our %args = ( loghost => '@tcp://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTCP \@tcp:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/did send /.length($sendback).qr/ bytes back/ => 1, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tcp.pl b/regress/usr.sbin/syslogd/args-server-tcp.pl index f270a4f7707..1ed123c11c4 100644 --- a/regress/usr.sbin/syslogd/args-server-tcp.pl +++ b/regress/usr.sbin/syslogd/args-server-tcp.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@tcp://localhost:$connectport', loggrep => { qr/Logging to FORWTCP \@tcp:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-tcp4.pl b/regress/usr.sbin/syslogd/args-server-tcp4.pl index b52e65942ab..b33f8df8bc5 100644 --- a/regress/usr.sbin/syslogd/args-server-tcp4.pl +++ b/regress/usr.sbin/syslogd/args-server-tcp4.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@tcp://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTCP \@tcp:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" }, loggrep => { qr/listen sock: 127.0.0.1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-tcp6.pl b/regress/usr.sbin/syslogd/args-server-tcp6.pl index faa71aa528c..e6c0301b62a 100644 --- a/regress/usr.sbin/syslogd/args-server-tcp6.pl +++ b/regress/usr.sbin/syslogd/args-server-tcp6.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@tcp://[::1]:$connectport', loggrep => { qr/Logging to FORWTCP \@tcp:\/\/\[::1\]:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_INET6, proto => "tcp", addr => "::1" }, loggrep => { qr/listen sock: ::1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-tls-close.pl b/regress/usr.sbin/syslogd/args-server-tls-close.pl index 60bda434b3f..c4fe1a635fa 100644 --- a/regress/usr.sbin/syslogd/args-server-tls-close.pl +++ b/regress/usr.sbin/syslogd/args-server-tls-close.pl @@ -23,7 +23,7 @@ our %args = ( loghost => '@tls://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error/ => '>=2', }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tls-error.pl b/regress/usr.sbin/syslogd/args-server-tls-error.pl index bcb41dedee5..620fe49824a 100644 --- a/regress/usr.sbin/syslogd/args-server-tls-error.pl +++ b/regress/usr.sbin/syslogd/args-server-tls-error.pl @@ -27,7 +27,7 @@ our %args = ( loghost => '@tls://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error/ => 2, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tls-sendback.pl b/regress/usr.sbin/syslogd/args-server-tls-sendback.pl index 58c1ff3d595..671651b5186 100644 --- a/regress/usr.sbin/syslogd/args-server-tls-sendback.pl +++ b/regress/usr.sbin/syslogd/args-server-tls-sendback.pl @@ -25,7 +25,7 @@ our %args = ( loghost => '@tls://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/did send /.length($sendback).qr/ bytes back/ => 1, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tls-tcp.pl b/regress/usr.sbin/syslogd/args-server-tls-tcp.pl index 2c518d07746..f68da60f95b 100644 --- a/regress/usr.sbin/syslogd/args-server-tls-tcp.pl +++ b/regress/usr.sbin/syslogd/args-server-tls-tcp.pl @@ -23,7 +23,7 @@ our %args = ( loghost => '@tls://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error/ => 2, }, }, diff --git a/regress/usr.sbin/syslogd/args-server-tls.pl b/regress/usr.sbin/syslogd/args-server-tls.pl index f11a93b6b92..eadf89ee902 100644 --- a/regress/usr.sbin/syslogd/args-server-tls.pl +++ b/regress/usr.sbin/syslogd/args-server-tls.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@tls://localhost:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-tls4.pl b/regress/usr.sbin/syslogd/args-server-tls4.pl index 9340a1263a6..b6128a8d916 100644 --- a/regress/usr.sbin/syslogd/args-server-tls4.pl +++ b/regress/usr.sbin/syslogd/args-server-tls4.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@tls://127.0.0.1:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_INET, proto => "tls", addr => "127.0.0.1" }, loggrep => { qr/listen sock: 127.0.0.1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-tls6.pl b/regress/usr.sbin/syslogd/args-server-tls6.pl index 93011acb3e3..425c38088e8 100644 --- a/regress/usr.sbin/syslogd/args-server-tls6.pl +++ b/regress/usr.sbin/syslogd/args-server-tls6.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@tls://[::1]:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/\[::1\]:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_INET6, proto => "tls", addr => "::1" }, loggrep => { qr/listen sock: ::1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-udp4.pl b/regress/usr.sbin/syslogd/args-server-udp4.pl index 0abeb837fb8..2bb61480af5 100644 --- a/regress/usr.sbin/syslogd/args-server-udp4.pl +++ b/regress/usr.sbin/syslogd/args-server-udp4.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@127.0.0.1:$connectport', loggrep => { qr/Logging to FORWUDP \@127.0.0.1:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_INET, addr => "127.0.0.1" }, loggrep => { qr/listen sock: 127.0.0.1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-server-udp6.pl b/regress/usr.sbin/syslogd/args-server-udp6.pl index dadfea44e69..34ecfe4e67f 100644 --- a/regress/usr.sbin/syslogd/args-server-udp6.pl +++ b/regress/usr.sbin/syslogd/args-server-udp6.pl @@ -14,14 +14,14 @@ our %args = ( loghost => '@[::1]:$connectport', loggrep => { qr/Logging to FORWUDP \@\[::1\]:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, }, }, server => { listen => { domain => AF_INET6, addr => "::1" }, loggrep => { qr/listen sock: ::1 \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cafile-default.pl b/regress/usr.sbin/syslogd/args-tls-cafile-default.pl index c22d49f2ac5..69ebadb6f17 100644 --- a/regress/usr.sbin/syslogd/args-tls-cafile-default.pl +++ b/regress/usr.sbin/syslogd/args-tls-cafile-default.pl @@ -17,7 +17,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: connect failed: error:.*/. qr/SSL3_GET_SERVER_CERTIFICATE:certificate verify failed/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "default", }, @@ -29,7 +29,7 @@ our %args = ( loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, qr/SSL accept attempt failed because of handshake problems/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cafile-empty.pl b/regress/usr.sbin/syslogd/args-tls-cafile-empty.pl index 04ca863fc3d..6aef1bb3fde 100644 --- a/regress/usr.sbin/syslogd/args-tls-cafile-empty.pl +++ b/regress/usr.sbin/syslogd/args-tls-cafile-empty.pl @@ -17,7 +17,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: /. qr/ssl verify memory setup failure/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "empty", }, @@ -29,7 +29,7 @@ our %args = ( loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, qr/SSL accept attempt failed because of handshake problems/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl b/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl index 6eaac549d6e..f98c915e373 100644 --- a/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl +++ b/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl @@ -17,7 +17,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: connect failed: error:.*/. qr/RSA_padding_check_PKCS1_type_1:block type is not 01/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "fake-ca.crt", }, @@ -29,7 +29,7 @@ our %args = ( loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, qr/SSL accept attempt failed because of handshake problems/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cafile-noexist.pl b/regress/usr.sbin/syslogd/args-tls-cafile-noexist.pl index 86c421fb9ba..3b66abcad4b 100644 --- a/regress/usr.sbin/syslogd/args-tls-cafile-noexist.pl +++ b/regress/usr.sbin/syslogd/args-tls-cafile-noexist.pl @@ -17,7 +17,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: /. qr/ssl verify setup failure/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "noexist", }, @@ -29,7 +29,7 @@ our %args = ( loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, qr/SSL accept attempt failed because of handshake problems/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cafile-toobig.pl b/regress/usr.sbin/syslogd/args-tls-cafile-toobig.pl index 17c33b13621..bec5d01fd88 100644 --- a/regress/usr.sbin/syslogd/args-tls-cafile-toobig.pl +++ b/regress/usr.sbin/syslogd/args-tls-cafile-toobig.pl @@ -17,7 +17,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: /. qr/ssl verify setup failure/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "toobig", }, @@ -29,7 +29,7 @@ our %args = ( loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, qr/SSL accept attempt failed because of handshake problems/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cipher-null.pl b/regress/usr.sbin/syslogd/args-tls-cipher-null.pl index 6ea3ef9dfb1..0561f1b7c5a 100644 --- a/regress/usr.sbin/syslogd/args-tls-cipher-null.pl +++ b/regress/usr.sbin/syslogd/args-tls-cipher-null.pl @@ -16,7 +16,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: connect failed: error.*:/. qr/SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure/ => 2, - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "ca.crt", }, @@ -29,7 +29,7 @@ our %args = ( loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, qr/no shared cipher/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-host-bad.pl b/regress/usr.sbin/syslogd/args-tls-host-bad.pl index 4d76e52bf68..71a1c90af8b 100644 --- a/regress/usr.sbin/syslogd/args-tls-host-bad.pl +++ b/regress/usr.sbin/syslogd/args-tls-host-bad.pl @@ -16,7 +16,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4', qr/syslogd: loghost .* connection error: /. qr/name `127.0.0.1' not present in server/ => '>=1', - get_testlog() => 1, + get_testgrep() => 1, }, cacrt => "ca.crt", }, @@ -24,7 +24,7 @@ our %args = ( listen => { domain => AF_INET, proto => "tls", addr => "127.0.0.1" }, loggrep => { qr/listen sock: 127.0.0.1 \d+/ => 1, - get_testlog() => 0, + get_testgrep() => 0, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-v10-noverify.pl b/regress/usr.sbin/syslogd/args-tls-v10-noverify.pl index efc6625f525..383593606f8 100644 --- a/regress/usr.sbin/syslogd/args-tls-v10-noverify.pl +++ b/regress/usr.sbin/syslogd/args-tls-v10-noverify.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@tls://localhost:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error: connect failed:/ => 0, }, }, @@ -22,7 +22,7 @@ our %args = ( listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, qr/ssl version: TLSv1$/ => 1, }, sslversion => "TLSv1", diff --git a/regress/usr.sbin/syslogd/args-tls-v10-verify.pl b/regress/usr.sbin/syslogd/args-tls-v10-verify.pl index a43d8a87adf..c3feaba3893 100644 --- a/regress/usr.sbin/syslogd/args-tls-v10-verify.pl +++ b/regress/usr.sbin/syslogd/args-tls-v10-verify.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@tls://localhost:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error: connect failed:/ => 0, }, cacrt => "ca.crt", @@ -23,7 +23,7 @@ our %args = ( listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, qr/ssl version: TLSv1$/ => 1, }, sslversion => "TLSv1", diff --git a/regress/usr.sbin/syslogd/args-tls-v12-default.pl b/regress/usr.sbin/syslogd/args-tls-v12-default.pl index 0a596f7c836..5156b0b6be4 100644 --- a/regress/usr.sbin/syslogd/args-tls-v12-default.pl +++ b/regress/usr.sbin/syslogd/args-tls-v12-default.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@tls://localhost:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error: connect failed:/ => 0, }, }, @@ -22,7 +22,7 @@ our %args = ( listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, qr/ssl version: TLSv1_2$/ => 1, }, }, diff --git a/regress/usr.sbin/syslogd/args-tls-v12-ssl23.pl b/regress/usr.sbin/syslogd/args-tls-v12-ssl23.pl index 134d621c3af..a4b17fb7d84 100644 --- a/regress/usr.sbin/syslogd/args-tls-v12-ssl23.pl +++ b/regress/usr.sbin/syslogd/args-tls-v12-ssl23.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@tls://localhost:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error: connect failed:/ => 0, }, }, @@ -22,7 +22,7 @@ our %args = ( listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, qr/ssl version: TLSv1_2$/ => 1, }, sslversion => "SSLv23", diff --git a/regress/usr.sbin/syslogd/args-tls-verify.pl b/regress/usr.sbin/syslogd/args-tls-verify.pl index 4dae90fff65..0bef8c54c0d 100644 --- a/regress/usr.sbin/syslogd/args-tls-verify.pl +++ b/regress/usr.sbin/syslogd/args-tls-verify.pl @@ -14,7 +14,7 @@ our %args = ( loghost => '@tls://localhost:$connectport', loggrep => { qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', - get_testlog() => 1, + get_testgrep() => 1, qr/syslogd: loghost .* connection error: connect failed:/ => 0, }, cacrt => "ca.crt", @@ -23,7 +23,7 @@ our %args = ( listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, loggrep => { qr/listen sock: (127.0.0.1|::1) \d+/ => 1, - get_testlog() => 1, + get_testgrep() => 1, }, }, ); diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl index 41e517541e7..ba84c773953 100644 --- a/regress/usr.sbin/syslogd/funcs.pl +++ b/regress/usr.sbin/syslogd/funcs.pl @@ -1,4 +1,4 @@ -# $OpenBSD: funcs.pl,v 1.21 2015/07/07 18:03:11 bluhm Exp $ +# $OpenBSD: funcs.pl,v 1.22 2015/07/16 16:34:49 bluhm Exp $ # Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org> # @@ -161,16 +161,27 @@ sub write_chars { sub write_unix { my $self = shift; my $path = shift || "/dev/log"; + my $id = shift // $path; my $u = IO::Socket::UNIX->new( Type => SOCK_DGRAM, Peer => $path, ) or die ref($self), " connect to $path unix socket failed: $!"; - my $msg = get_testlog(). " $path unix socket"; + my $msg = "$id unix socket: $testlog"; print $u $msg; print STDERR "<<< $msg\n"; } +sub write_tcp { + my $self = shift; + my $fh = shift || \*STDOUT; + my $id = shift // $fh; + + my $msg = "$id tcp socket: $testlog"; + print $fh "$msg\n"; + print STDERR "<<< $msg\n"; +} + ######################################################################## # Server funcs ######################################################################## @@ -224,6 +235,10 @@ sub get_testlog { return $testlog; } +sub get_testgrep { + return qr/$testlog$/; +} + sub get_firstlog { return $firstlog; } @@ -262,7 +277,7 @@ sub check_logs { check_fstat($c, $r, $s); check_ktrace($c, $r, $s); if (my $file = $s->{"outfile"}) { - my $pattern = $s->{filegrep} || $testlog; + my $pattern = $s->{filegrep} || get_testgrep(); check_pattern(ref $s, $file, $pattern, \&filegrep); } check_multifile(@{$args{multifile} || []}); @@ -309,7 +324,7 @@ sub check_pattern { sub check_log { foreach my $proc (@_) { next unless $proc && !$proc->{nocheck}; - my $pattern = $proc->{loggrep} || $testlog; + my $pattern = $proc->{loggrep} || get_testgrep(); check_pattern(ref $proc, $proc, $pattern, \&loggrep); } } @@ -330,7 +345,7 @@ sub check_out { foreach my $name (qw(file pipe)) { next if $args{$name}{nocheck}; my $file = $r->{"out$name"} or die; - my $pattern = $args{$name}{loggrep} || $testlog; + my $pattern = $args{$name}{loggrep} || get_testgrep(); check_pattern($name, $file, $pattern, \&filegrep); } } |