summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-04-17 14:27:47 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-04-17 14:27:47 +0000
commita3af7cf8c1bf5fe3de547451e627e7cdd8dd0135 (patch)
tree25eaa897df9d2a8d5574162ba21a458f286aa230
parentf30ce6c2c2d9aa74a864d20cc4fdebb583aa6cba (diff)
Test syslogd(8) "last message repeated" feature and -r option.
-rw-r--r--regress/usr.sbin/syslogd/Client.pm4
-rw-r--r--regress/usr.sbin/syslogd/args-repeat.pl58
2 files changed, 60 insertions, 2 deletions
diff --git a/regress/usr.sbin/syslogd/Client.pm b/regress/usr.sbin/syslogd/Client.pm
index 4be39f79d1f..bcc02b24895 100644
--- a/regress/usr.sbin/syslogd/Client.pm
+++ b/regress/usr.sbin/syslogd/Client.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Client.pm,v 1.9 2017/01/02 16:58:28 bluhm Exp $
+# $OpenBSD: Client.pm,v 1.10 2017/04/17 14:27:46 bluhm Exp $
# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -114,7 +114,7 @@ sub child {
or die ref($self), " setlogsock failed: $!";
}
# we take LOG_UUCP as it is not used nowadays
- openlog("syslogd-regress", "ndelay,perror,pid", LOG_UUCP);
+ openlog("syslogd-regress", "perror,pid", LOG_UUCP);
}
1;
diff --git a/regress/usr.sbin/syslogd/args-repeat.pl b/regress/usr.sbin/syslogd/args-repeat.pl
new file mode 100644
index 00000000000..25cb6f0ab8d
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-repeat.pl
@@ -0,0 +1,58 @@
+# Start syslogd with -r option.
+# The client writes messages repeatedly to Sys::Syslog native method.
+# 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, pipe, console, user, syslogd, server log.
+# Check that message repeated is not in server or pipe log.
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ func => sub {
+ my $self = shift;
+ write_message($self, "foo");
+ write_message($self, "bar");
+ write_message($self, "bar");
+ write_message($self, "bar");
+ write_message($self, "foo");
+ write_message($self, "bar");
+ write_log($self);
+ },
+ },
+ syslogd => {
+ options => ["-r"],
+ },
+ server => {
+ loggrep => {
+ qr/foo/ => 2,
+ qr/bar/ => 4,
+ qr/message repeated/ => 0,
+ },
+ },
+ pipe => {
+ loggrep => {
+ qr/foo/ => 2,
+ qr/bar/ => 4,
+ qr/message repeated/ => 0,
+ },
+ },
+ file => {
+ loggrep => {
+ qr/foo/ => 2,
+ qr/bar/ => 2,
+ qr/message repeated 2 times/ => 1,
+ },
+ },
+ tty => {
+ loggrep => {
+ qr/foo/ => 2,
+ qr/bar/ => 2,
+ qr/message repeated 2 times/ => 1,
+ },
+ },
+);
+
+1;