summaryrefslogtreecommitdiff
path: root/regress/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2014-08-29 21:57:18 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2014-08-29 21:57:18 +0000
commit172a934ee0cabf0988299802782896aa4af036dc (patch)
tree41f7cdf84763c1131b60f0b30d73f3eeb780bc2a /regress/usr.sbin
parent74d09608521a86cbc9e0687f061eb5fcdf02fe50 (diff)
Make the syslogd regression tests more reliable. Other processes
on the system may create log entries during the test run that show up in the log file. Ignore those additional lines.
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r--regress/usr.sbin/syslogd/args-maxhostlen.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-maxloghostlen.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-maxportlen.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-invalid.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp4-host6.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp4-only6.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp4.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp6-host4.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp6-only4.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-proto-udp6.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-udp4.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-udp6.pl2
-rw-r--r--regress/usr.sbin/syslogd/funcs.pl20
14 files changed, 31 insertions, 15 deletions
diff --git a/regress/usr.sbin/syslogd/args-maxhostlen.pl b/regress/usr.sbin/syslogd/args-maxhostlen.pl
index 3603e7800c6..5bd3efe00fd 100644
--- a/regress/usr.sbin/syslogd/args-maxhostlen.pl
+++ b/regress/usr.sbin/syslogd/args-maxhostlen.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@'.('X'x256).':514',
loggrep => {
- qr/syslogd: host too long "\@X+/ => 2, # XXX 2?
+ qr/syslogd: host too long "\@X+/ => 2,
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-maxloghostlen.pl b/regress/usr.sbin/syslogd/args-maxloghostlen.pl
index b628967fcef..0c9a1d66c1a 100644
--- a/regress/usr.sbin/syslogd/args-maxloghostlen.pl
+++ b/regress/usr.sbin/syslogd/args-maxloghostlen.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@'.('X'x300),
loggrep => {
- qr/syslogd: loghost too long "\@X+/ => 2, # XXX 2?
+ qr/syslogd: loghost too long "\@X+/ => 2,
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-maxportlen.pl b/regress/usr.sbin/syslogd/args-maxportlen.pl
index 9d0cce60695..89028f40aa9 100644
--- a/regress/usr.sbin/syslogd/args-maxportlen.pl
+++ b/regress/usr.sbin/syslogd/args-maxportlen.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@127.0.0.1:'.('X'x32),
loggrep => {
- qr/syslogd: port too long "\@127.0.0.1:X+/ => 2, # XXX 2?
+ qr/syslogd: port too long "\@127.0.0.1:X+/ => 2,
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-proto-invalid.pl b/regress/usr.sbin/syslogd/args-proto-invalid.pl
index 9394660aa22..f6408e317fc 100644
--- a/regress/usr.sbin/syslogd/args-proto-invalid.pl
+++ b/regress/usr.sbin/syslogd/args-proto-invalid.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@invalid://127.0.0.1',
loggrep => {
- qr/syslogd: bad protocol "\@invalid:\/\/127.0.0.1"/ => 2, # XXX 2?
+ qr/syslogd: bad protocol "\@invalid:\/\/127.0.0.1"/ => 2,
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-proto-udp.pl b/regress/usr.sbin/syslogd/args-proto-udp.pl
index 3ff58d9af32..0b4d71530f7 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp.pl
@@ -12,7 +12,7 @@ our %args = (
syslogd => {
loghost => '@udp://127.0.0.1:$connectport',
loggrep => {
- qr/Logging to FORW \@udp:\/\/127.0.0.1:\d+/ => 5,
+ qr/Logging to FORW \@udp:\/\/127.0.0.1:\d+/ => '>=5',
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl
index e741fbd43b8..cf16cd66f24 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp4-host6.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@udp4://[::1]',
loggrep => {
- qr/syslogd: bad hostname "\@udp4:\/\/\[::1\]"/ => 2, # XXX 2?
+ qr/syslogd: bad hostname "\@udp4:\/\/\[::1\]"/ => 2,
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl b/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl
index 15235527117..908f5b2c5db 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp4-only6.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@udp4://127.0.0.1',
loggrep => {
- qr/syslogd: no udp4 "\@udp4:\/\/127.0.0.1/ => 2, # XXX 2?
+ qr/syslogd: no udp4 "\@udp4:\/\/127.0.0.1/ => 2,
get_log() => 1,
},
options => ["-6"],
diff --git a/regress/usr.sbin/syslogd/args-proto-udp4.pl b/regress/usr.sbin/syslogd/args-proto-udp4.pl
index 52a72e3062a..2c44dd6e460 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp4.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp4.pl
@@ -12,7 +12,7 @@ our %args = (
syslogd => {
loghost => '@udp4://127.0.0.1:$connectport',
loggrep => {
- qr/Logging to FORW \@udp4:\/\/127.0.0.1:\d+/ => 5,
+ qr/Logging to FORW \@udp4:\/\/127.0.0.1:\d+/ => '>=5',
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl
index 4fadf1af834..669b95c240a 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp6-host4.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@udp6://127.0.0.1',
loggrep => {
- qr/syslogd: bad hostname "\@udp6:\/\/127.0.0.1"/ => 2, # XXX 2?
+ qr/syslogd: bad hostname "\@udp6:\/\/127.0.0.1"/ => 2,
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl b/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl
index 630807d4020..a0a0a2e686d 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp6-only4.pl
@@ -11,7 +11,7 @@ our %args = (
syslogd => {
loghost => '@udp6://[::1]',
loggrep => {
- qr/syslogd: no udp6 "\@udp6:\/\/\[::1\]/ => 2, # XXX 2?
+ qr/syslogd: no udp6 "\@udp6:\/\/\[::1\]/ => 2,
get_log() => 1,
},
options => ["-4"],
diff --git a/regress/usr.sbin/syslogd/args-proto-udp6.pl b/regress/usr.sbin/syslogd/args-proto-udp6.pl
index 6d609dd4521..40080a45573 100644
--- a/regress/usr.sbin/syslogd/args-proto-udp6.pl
+++ b/regress/usr.sbin/syslogd/args-proto-udp6.pl
@@ -12,7 +12,7 @@ our %args = (
syslogd => {
loghost => '@udp6://[::1]:$connectport',
loggrep => {
- qr/Logging to FORW \@udp6:\/\/\[::1\]:\d+/ => 5,
+ qr/Logging to FORW \@udp6:\/\/\[::1\]:\d+/ => '>=5',
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-server-udp4.pl b/regress/usr.sbin/syslogd/args-server-udp4.pl
index d43b2cd1cba..26f063dfcb4 100644
--- a/regress/usr.sbin/syslogd/args-server-udp4.pl
+++ b/regress/usr.sbin/syslogd/args-server-udp4.pl
@@ -12,7 +12,7 @@ our %args = (
syslogd => {
loghost => '@127.0.0.1:$connectport',
loggrep => {
- qr/Logging to FORW \@127.0.0.1:\d+/ => 5,
+ qr/Logging to FORW \@127.0.0.1:\d+/ => '>=5',
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/args-server-udp6.pl b/regress/usr.sbin/syslogd/args-server-udp6.pl
index db393091b41..cb5922347de 100644
--- a/regress/usr.sbin/syslogd/args-server-udp6.pl
+++ b/regress/usr.sbin/syslogd/args-server-udp6.pl
@@ -12,7 +12,7 @@ our %args = (
syslogd => {
loghost => '@[::1]:$connectport',
loggrep => {
- qr/Logging to FORW \@\[::1\]:\d+/ => 5,
+ qr/Logging to FORW \@\[::1\]:\d+/ => '>=5',
get_log() => 1,
},
},
diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl
index c7030d12d1c..55d3bfcd6b9 100644
--- a/regress/usr.sbin/syslogd/funcs.pl
+++ b/regress/usr.sbin/syslogd/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.2 2014/08/25 17:55:27 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.3 2014/08/29 21:57:17 bluhm Exp $
# Copyright (c) 2010-2014 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -86,6 +86,22 @@ sub check_logs {
check_kdump($c, $s, %args);
}
+sub compare($$) {
+ local $_ = $_[1];
+ if (/^\d+/) {
+ return $_[0] == $_;
+ } elsif (/^==(\d+)/) {
+ return $_[0] == $1;
+ } elsif (/^!=(\d+)/) {
+ return $_[0] != $1;
+ } elsif (/^>=(\d+)/) {
+ return $_[0] >= $1;
+ } elsif (/^<=(\d+)/) {
+ return $_[0] <= $1;
+ }
+ die "bad compare operator: $_";
+}
+
sub check_pattern {
my ($name, $proc, $pattern, $func) = @_;
@@ -94,7 +110,7 @@ sub check_pattern {
if (ref($pat) eq 'HASH') {
while (my($re, $num) = each %$pat) {
my @matches = $func->($proc, $re);
- @matches == $num
+ compare(@matches, $num)
or die "$name matches '@matches': ",
"'$re' => $num";
}