diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-04-07 15:49:47 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-04-07 15:49:47 +0000 |
commit | ea0b71de156e2d8555cad515281952178dee1883 (patch) | |
tree | c1655059eadc0880d78e11b5a2506527ae1fa323 /regress/usr.sbin | |
parent | 51d7dedef76265e78006562bbb3b4b292d96dcfe (diff) |
Adapt test to new syslogd's local message priority.
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r-- | regress/usr.sbin/syslogd/args-selector-syslog.pl | 30 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-sighup-config.pl | 7 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-sighup.pl | 7 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/funcs.pl | 6 |
4 files changed, 42 insertions, 8 deletions
diff --git a/regress/usr.sbin/syslogd/args-selector-syslog.pl b/regress/usr.sbin/syslogd/args-selector-syslog.pl index e9808ffd13d..303361e78f0 100644 --- a/regress/usr.sbin/syslogd/args-selector-syslog.pl +++ b/regress/usr.sbin/syslogd/args-selector-syslog.pl @@ -11,10 +11,12 @@ use warnings; use Sys::Syslog; my %selector2messages = ( - "syslog.*" => [qw{ start .*accepted .*close exiting.* }], - "syslog.debug" => [qw{ start .*accepted .*close exiting.* }], - "syslog.info" => [qw{ start .*accepted .*close exiting.* }], - "syslog.notice" => [qw{ exiting.* }], + "syslog.*" => + [qw{ start .*accepted .*close .*accepted .*peer exiting.* }], + "syslog.debug" => + [qw{ start .*accepted .*close .*accepted .*peer exiting.* }], + "syslog.info" => [qw{ start .*peer exiting.* }], + "syslog.notice" => [qw{ .*peer exiting.* }], "syslog.warning" => [qw{ exiting.* }], "syslog.err" => [qw{ exiting.* }], "syslog.crit" => [], @@ -25,7 +27,25 @@ my %selector2messages = ( our %args = ( client => { - logsock => { type => "tcp", host => "127.0.0.1", port => 514 }, + connect => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1", + port => 514 }, + redo => 2, + func => sub { + my $self = shift; + $self->{redo}--; + if ($self->{redo}) { + write_message($self, get_testlog()); + IO::Handle::flush(\*STDOUT); + ${$self->{syslogd}}->loggrep(get_testgrep(), 2); + } else { + write_message($self, get_testlog()); + IO::Handle::flush(\*STDOUT); + ${$self->{syslogd}}->loggrep(get_testgrep(), 2); + setsockopt(STDOUT, SOL_SOCKET, SO_LINGER, pack('ii', 1, 0)) + or die "set socket linger failed: $!"; + write_shutdown($self); + } + }, }, syslogd => { options => ["-T", "127.0.0.1:514"], diff --git a/regress/usr.sbin/syslogd/args-sighup-config.pl b/regress/usr.sbin/syslogd/args-sighup-config.pl index 597b1b17574..cdf23e8fb60 100644 --- a/regress/usr.sbin/syslogd/args-sighup-config.pl +++ b/regress/usr.sbin/syslogd/args-sighup-config.pl @@ -44,6 +44,13 @@ our %args = ( })}, loggrep => { get_between2loggrep() }, }, + file => { + loggrep => { + qr/syslogd\[\d+\]: start/ => 2, + qr/syslogd\[\d+\]: restart/ => 0, + qr/syslogd\[\d+\]: exiting/ => 1, + }, + }, ); 1; diff --git a/regress/usr.sbin/syslogd/args-sighup.pl b/regress/usr.sbin/syslogd/args-sighup.pl index 4912af12fc5..ebf2df68d96 100644 --- a/regress/usr.sbin/syslogd/args-sighup.pl +++ b/regress/usr.sbin/syslogd/args-sighup.pl @@ -54,6 +54,13 @@ our %args = ( check_pattern($name, $file, $pattern, \&filegrep); } }, + file => { + loggrep => { + qr/syslogd\[\d+\]: start/ => 0, + qr/syslogd\[\d+\]: restart/ => 1, + qr/syslogd\[\d+\]: exiting/ => 1, + }, + }, ); 1; diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl index e9fd6923526..e296b3ebcb9 100644 --- a/regress/usr.sbin/syslogd/funcs.pl +++ b/regress/usr.sbin/syslogd/funcs.pl @@ -1,4 +1,4 @@ -# $OpenBSD: funcs.pl,v 1.31 2017/04/06 16:56:44 bluhm Exp $ +# $OpenBSD: funcs.pl,v 1.32 2017/04/07 15:49:46 bluhm Exp $ # Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org> # @@ -297,11 +297,11 @@ sub selector2loggrep { foreach my $sel (sort keys %s2m) { my @m = @{$s2m{$sel}}; my %msg; - @msg{@m} = (); + $msg{$_}++ foreach (@m); my %nomsg = %allmsg; delete @nomsg{@m}; push @loggrep, { - (map { qr/: $_$/ => 1 } sort keys %msg), + (map { qr/: $_$/ => $msg{$_} } sort keys %msg), (map { qr/: $_$/ => 0 } sort keys %nomsg), }; } |