summaryrefslogtreecommitdiff
path: root/regress/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2014-10-29 16:42:58 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2014-10-29 16:42:58 +0000
commitb5ba863adfa19767d3a5fc672189818053564a7b (patch)
tree92d16081208e0c0deaa79ff2f1468d03ec4c976e /regress/usr.sbin
parent4fa554c2bc4d7b89733ee4cdeba40d2a2418a9dc (diff)
Add a test the checks the syslogd !prog !!prog !* feature.
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r--regress/usr.sbin/syslogd/Syslogd.pm3
-rw-r--r--regress/usr.sbin/syslogd/args-prog.pl44
2 files changed, 46 insertions, 1 deletions
diff --git a/regress/usr.sbin/syslogd/Syslogd.pm b/regress/usr.sbin/syslogd/Syslogd.pm
index e3cd027c9b5..28bf627929b 100644
--- a/regress/usr.sbin/syslogd/Syslogd.pm
+++ b/regress/usr.sbin/syslogd/Syslogd.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Syslogd.pm,v 1.5 2014/09/13 23:38:24 bluhm Exp $
+# $OpenBSD: Syslogd.pm,v 1.6 2014/10/29 16:42:57 bluhm Exp $
# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org>
# Copyright (c) 2014 Florian Riehm <mail@friehm.de>
@@ -67,6 +67,7 @@ sub new {
$loghost .= ":$connectport" if $connectport;
}
print $fh "*.*\t$loghost\n";
+ print $fh $self->{conf} if $self->{conf};
close $fh;
return $self->create_out();
diff --git a/regress/usr.sbin/syslogd/args-prog.pl b/regress/usr.sbin/syslogd/args-prog.pl
new file mode 100644
index 00000000000..f44ae616751
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-prog.pl
@@ -0,0 +1,44 @@
+# Test with default values, that is:
+# The client writes a message to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# 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, syslogd, server log.
+# Check messages in special log files selected with !prog !!prog !*.
+
+use strict;
+use warnings;
+use Cwd;
+
+my %log;
+@log{qw(foo bar foobar)} = ();
+foreach my $name (keys %log) {
+ $log{$name} = getcwd()."/$name.log";
+ open(my $fh, '>', $log{$name})
+ or die "Create $log{$name} failed: $!";
+}
+
+sub check_file {
+ my ($name, $pattern) = @_;
+ check_pattern($name, $log{$name}, $pattern, \&filegrep);
+}
+
+our %args = (
+ syslogd => {
+ conf => <<"EOF",
+!syslogd
+*.* $log{foo}
+!!syslogd-regress
+*.* $log{bar}
+!*
+*.* $log{foobar}
+EOF
+ },
+ check => sub {
+ check_file("foo", { get_testlog() => 0, qr/syslogd: start/ => 1 });
+ check_file("bar", { get_testlog() => 1, qr/syslogd: start/ => 0 });
+ check_file("foobar", { get_testlog() => 0, qr/syslogd: start/ => 1 });
+ },
+);
+
+1;