diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-10-29 16:42:58 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-10-29 16:42:58 +0000 |
commit | b5ba863adfa19767d3a5fc672189818053564a7b (patch) | |
tree | 92d16081208e0c0deaa79ff2f1468d03ec4c976e /regress/usr.sbin/syslogd/args-prog.pl | |
parent | 4fa554c2bc4d7b89733ee4cdeba40d2a2418a9dc (diff) |
Add a test the checks the syslogd !prog !!prog !* feature.
Diffstat (limited to 'regress/usr.sbin/syslogd/args-prog.pl')
-rw-r--r-- | regress/usr.sbin/syslogd/args-prog.pl | 44 |
1 files changed, 44 insertions, 0 deletions
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; |