summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd
diff options
context:
space:
mode:
Diffstat (limited to 'regress/usr.sbin/syslogd')
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-tcp.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-tls.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-sendsyslog-error.pl52
-rw-r--r--regress/usr.sbin/syslogd/args-sync-tcp.pl6
-rw-r--r--regress/usr.sbin/syslogd/syslogd.pl8
5 files changed, 62 insertions, 8 deletions
diff --git a/regress/usr.sbin/syslogd/args-dropped-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-tcp.pl
index aa7e4ce8d20..7ce4536f768 100644
--- a/regress/usr.sbin/syslogd/args-dropped-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-tcp.pl
@@ -22,7 +22,7 @@ our %args = (
write_message($self, get_thirdlog());
${$self->{server}}->loggrep(get_secondlog(), 5)
or die ref($self), " server did not receive second log";
- ${$self->{syslogd}}->loggrep(qr/syslogd: dropped \d+ messages/, 5)
+ ${$self->{syslogd}}->loggrep(qr/syslogd: dropped \d+ messages?/, 5)
or die ref($self), " syslogd did not write dropped message";
})},
},
diff --git a/regress/usr.sbin/syslogd/args-dropped-tls.pl b/regress/usr.sbin/syslogd/args-dropped-tls.pl
index 26f66d0cc17..602f2fed270 100644
--- a/regress/usr.sbin/syslogd/args-dropped-tls.pl
+++ b/regress/usr.sbin/syslogd/args-dropped-tls.pl
@@ -22,7 +22,7 @@ our %args = (
write_message($self, get_thirdlog());
${$self->{server}}->loggrep(get_secondlog(), 5)
or die ref($self), " server did not receive second log";
- ${$self->{syslogd}}->loggrep(qr/syslogd: dropped \d+ messages/, 5)
+ ${$self->{syslogd}}->loggrep(qr/syslogd: dropped \d+ messages?/, 5)
or die ref($self), " syslogd did not write dropped message";
})},
},
diff --git a/regress/usr.sbin/syslogd/args-sendsyslog-error.pl b/regress/usr.sbin/syslogd/args-sendsyslog-error.pl
new file mode 100644
index 00000000000..978b0147489
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-sendsyslog-error.pl
@@ -0,0 +1,52 @@
+# Run client before starting syslogd.
+# The client writes one message before and one after syslogd is started.
+# The kernel writes a sendsyslog(2) error message to the log socket.
+# Start syslogd, it reads the error and the second message from the log socket.
+# Find the kernel error message in file, syslogd, server log.
+# Check that the first message got lost.
+# Create a ktrace dump of the client and check that sendsyslog(2) has failed.
+
+use strict;
+use warnings;
+use Errno ':POSIX';
+
+my $errno = ENOTCONN;
+my $kerngrep = qr/sendsyslog: dropped \d+ messages?, error $errno$/;
+
+our %args = (
+ client => {
+ early => 1,
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ ${$self->{syslogd}}->loggrep(qr/syslogd: started/, 5)
+ or die "syslogd started not in syslogd.log";
+ })},
+ ktrace => {
+ qr/CALL sendsyslog/ => '>=2',
+ qr/RET sendsyslog -1 errno $errno / => '>=1',
+ },
+ },
+ syslogd => {
+ loggrep => {
+ get_firstlog() => 0,
+ $kerngrep => 1,
+ get_testgrep() => 1,
+ },
+ },
+ server => {
+ loggrep => {
+ get_firstlog() => 0,
+ $kerngrep => 1,
+ get_testgrep() => 1,
+ },
+ },
+ file => {
+ loggrep => {
+ get_firstlog() => 0,
+ $kerngrep => 1,
+ get_testgrep() => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-sync-tcp.pl b/regress/usr.sbin/syslogd/args-sync-tcp.pl
index 4754c170ab8..f37147a00d5 100644
--- a/regress/usr.sbin/syslogd/args-sync-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-sync-tcp.pl
@@ -23,9 +23,9 @@ our %args = (
write_lines($self, 300, 2000);
write_message($self, get_thirdlog());
${$self->{server}}->loggrep("Accepted", 5, 2)
- or die ref($self), " server did not receive second log";
- ${$self->{syslogd}}->loggrep(qr/syslogd: dropped \d+ messages/, 5)
- or die ref($self), " syslogd did not log dropped messages";
+ or die ref($self), " server did not accept second connection";
+ ${$self->{syslogd}}->loggrep(qr/syslogd: dropped \d+ messages?/, 5)
+ or die ref($self), " syslogd did not write dropped message";
})},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/syslogd.pl b/regress/usr.sbin/syslogd/syslogd.pl
index e36aead0002..fe1b70b2b76 100644
--- a/regress/usr.sbin/syslogd/syslogd.pl
+++ b/regress/usr.sbin/syslogd/syslogd.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: syslogd.pl,v 1.7 2015/07/07 18:03:11 bluhm Exp $
+# $OpenBSD: syslogd.pl,v 1.8 2015/09/03 18:14:35 bluhm Exp $
# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -100,6 +100,7 @@ $c = Client->new(
) unless $args{client}{noclient};
($rc, $c) = ($c, $rc) if $rc; # chain client -> rsyslogd -> syslogd
+$c->run->up if !$args{client}{noclient} && $c->{early};
$r->run unless $r->{late};
$s->run->up unless $args{server}{noserver};
$r->run if $r->{late};
@@ -117,10 +118,10 @@ foreach (@m) {
$_->kill('STOP');
}
}
-$c->run->up unless $args{client}{noclient};
+$c->run->up if !$args{client}{noclient} && !$c->{early};
$rc->run->up if $args{rsyslogd}{connect};
-$c->down unless $args{client}{noclient};
+$c->down if !$args{client}{noclient} && !$c->{early};
$s->down unless $args{server}{noserver};
foreach (@m) {
if ($_->{stop}) {
@@ -134,6 +135,7 @@ foreach (@m) {
}
$r->kill_child;
$r->down;
+$c->down if !$args{client}{noclient} && $c->{early};
$args{check}->({client => $c, syslogd => $r, server => $s}) if $args{check};
check_logs($c, $r, $s, \@m, %args);