summaryrefslogtreecommitdiff
path: root/regress/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2012-11-02 17:47:05 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2012-11-02 17:47:05 +0000
commitfe79546b4d469cf6a29de75d0d28af7e47b293e4 (patch)
treeec1f3b0bba91e798d3a5fa384dd90bf32c2dc7e1 /regress/usr.sbin
parent82444cfbcadfc2c2276b74535b6b448a9dfd06a7 (diff)
Allow to specify how often a pattern has to show up in the relayd
log file during a test.
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r--regress/usr.sbin/relayd/args-http-chunked.pl2
-rw-r--r--regress/usr.sbin/relayd/relayd.pl18
2 files changed, 14 insertions, 6 deletions
diff --git a/regress/usr.sbin/relayd/args-http-chunked.pl b/regress/usr.sbin/relayd/args-http-chunked.pl
index 5bb2f56be9c..839de14032a 100644
--- a/regress/usr.sbin/relayd/args-http-chunked.pl
+++ b/regress/usr.sbin/relayd/args-http-chunked.pl
@@ -14,7 +14,7 @@ our %args = (
"request header log foo",
"response header log Transfer-Encoding",
],
- loggrep => "log 'Transfer-Encoding: chunked'",
+ loggrep => { "log 'Transfer-Encoding: chunked'" => 2 },
},
server => {
func => \&http_server,
diff --git a/regress/usr.sbin/relayd/relayd.pl b/regress/usr.sbin/relayd/relayd.pl
index d458204838c..bae9ab54b2a 100644
--- a/regress/usr.sbin/relayd/relayd.pl
+++ b/regress/usr.sbin/relayd/relayd.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
-# $OpenBSD: relayd.pl,v 1.4 2011/09/04 12:19:44 bluhm Exp $
+# $OpenBSD: relayd.pl,v 1.5 2012/11/02 17:47:04 bluhm Exp $
-# Copyright (c) 2010,2011 Alexander Bluhm <bluhm@openbsd.org>
+# Copyright (c) 2010-2012 Alexander Bluhm <bluhm@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -80,8 +80,16 @@ foreach ([ client => $c ], [ relayd => $r ], [ server => $s ]) {
my $pattern = $args{$name}{loggrep} or next;
$pattern = [ $pattern ] unless ref($pattern) eq 'ARRAY';
foreach my $pat (@$pattern) {
- $proc->loggrep($pat)
- or die "$name log missing pattern: $pat";
+ if (ref($pat) eq 'HASH') {
+ while (my($re, $num) = each %$pat) {
+ my @matches = $proc->loggrep($re);
+ @matches == $num or
+ die "$name matches @matches: $re => $num";
+ }
+ } else {
+ $proc->loggrep($pat)
+ or die "$name log missing pattern: $pat";
+ }
}
}
@@ -97,7 +105,7 @@ my @slen = $s->loggrep(qr/^LEN: /) or die "no server len"
or die "client: $clen[0]", "len $args{len} expected";
!defined($args{len}) || !$slen[0] || $slen[0] eq "LEN: $args{len}\n"
or die "server: $slen[0]", "len $args{len} expected";
-foreach my $len (@{$args{lengths} || []}) {
+foreach my $len (map { ref eq 'ARRAY' ? @$_ : $_ } @{$args{lengths} || []}) {
my $clen = shift @clen;
$clen eq "LEN: $len\n"
or die "client: $clen", "len $len expected";