diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-09-13 15:08:43 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-09-13 15:08:43 +0000 |
commit | 98987f76af30740d04e0ad5d8e5dbc92fe97daf1 (patch) | |
tree | e3f3a1f03faab4d8f7c1c1d5a7b275ebf39d2bad | |
parent | c13600346daba81fc36a96b3dfdccdce586aab2f (diff) |
Check that pending "message repeated" is printed at exit and restart.
-rw-r--r-- | regress/usr.sbin/syslogd/args-repeat-sighup.pl | 56 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-repeat-sigterm.pl | 57 |
2 files changed, 113 insertions, 0 deletions
diff --git a/regress/usr.sbin/syslogd/args-repeat-sighup.pl b/regress/usr.sbin/syslogd/args-repeat-sighup.pl new file mode 100644 index 00000000000..0a36df2990e --- /dev/null +++ b/regress/usr.sbin/syslogd/args-repeat-sighup.pl @@ -0,0 +1,56 @@ +# The client writes messages repeatedly to Sys::Syslog native method. +# Restart syslogd with unwritten repeated messages. +# The syslogd writes it into a file and through a pipe and to tty. +# The syslogd passes it via UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, syslogd, server log. +# Check that message repeated was written out before syslogd restarted. + +use strict; +use warnings; + +our %args = ( + client => { + func => sub { + my $self = shift; + write_message($self, "foobar"); + write_message($self, "foobar"); + write_message($self, "foobar"); + ${$self->{syslogd}}->loggrep(qr/ msg .* foobar/, 5, 3) + or die ref($self), " syslogd did not receive 3 foobar log"; + ${$self->{syslogd}}->kill_syslogd('HUP'); + ${$self->{syslogd}}->loggrep(qr/syslogd: restarted/, 8) + or die ref($self), " syslogd did not restart"; + write_log($self); + }, + loggrep => { + get_testgrep() => 1, + qr/foobar/ => 3, + }, + }, + syslogd => { + options => ["-Z"], + loggrep => { + get_testgrep() => 1, + qr/logline: .* msg .* foobar/ => 3, + }, + }, + server => { + loggrep => { + get_testgrep() => 1, + qr/foobar/ => 1, + qr/message repeated 2 times/ => 1, + }, + }, + file => { + loggrep => { + get_testgrep() => 1, + qr/foobar/ => 1, + qr/message repeated 2 times/ => 1, + }, + }, + pipe => { nocheck => 1 }, + tty => { nocheck => 1 }, +); + +1; diff --git a/regress/usr.sbin/syslogd/args-repeat-sigterm.pl b/regress/usr.sbin/syslogd/args-repeat-sigterm.pl new file mode 100644 index 00000000000..ca2025b2a99 --- /dev/null +++ b/regress/usr.sbin/syslogd/args-repeat-sigterm.pl @@ -0,0 +1,57 @@ +# The client writes messages repeatedly to Sys::Syslog native method. +# Terminate syslogd with unwritten repeated messages. +# The syslogd writes it into a file and through a pipe and to tty. +# The syslogd passes it via UDP to the loghost. +# The server receives the message on its UDP socket. +# Find the message in client, file, syslogd, server log. +# Check that message repeated was written out before syslogd exited. + +use strict; +use warnings; + +our %args = ( + client => { + func => sub { + my $self = shift; + write_message($self, get_testlog()); + write_message($self, "foobar"); + write_message($self, "foobar"); + write_message($self, "foobar"); + ${$self->{syslogd}}->loggrep(qr/ msg .* foobar/, 5, 3) + or die ref($self), " syslogd did not receive 3 foobar log"; + ${$self->{syslogd}}->kill_syslogd('TERM'); + ${$self->{syslogd}}->loggrep(qr/syslogd: exited/, 8) + or die ref($self), " syslogd did not exit"; + }, + loggrep => { + get_testgrep() => 1, + qr/foobar/ => 3, + }, + }, + syslogd => { + options => ["-Z"], + loggrep => { + get_testgrep() => 1, + qr/logline: .* msg .* foobar/ => 3, + }, + }, + server => { + down => "exiting on signal 15", + loggrep => { + get_testgrep() => 1, + qr/foobar/ => 1, + qr/message repeated 2 times/ => 1, + }, + }, + file => { + loggrep => { + get_testgrep() => 1, + qr/foobar/ => 1, + qr/message repeated 2 times/ => 1, + }, + }, + pipe => { nocheck => 1 }, + tty => { nocheck => 1 }, +); + +1; |