summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd/funcs.pl
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-07-16 16:34:50 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-07-16 16:34:50 +0000
commit6575491efa05726f0bb0780fff58a71369b905e3 (patch)
treea2c1b828a8d8c9845f30319e687fa2e280b318cd /regress/usr.sbin/syslogd/funcs.pl
parent4b27f6129efe0ba1e54373ec1d436938e51ec0ae (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/usr.sbin/syslogd/funcs.pl')
-rw-r--r--regress/usr.sbin/syslogd/funcs.pl25
1 files changed, 20 insertions, 5 deletions
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);
}
}