From: andre Date: Fri, 9 May 2014 11:49:26 +0000 (+0000) Subject: Adds $relayd->{dummyrun} and $client->{noclient} flags to relayd tests X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=736ef810ab0169cadc599d9bcd260bb3020aeb58;p=openbsd Adds $relayd->{dummyrun} and $client->{noclient} flags to relayd tests framework. These flags can be set from test file which eases performing dry-runs of relayd long enough to do relayd.conf parsing, thus enabling the grammar/parser-only tests. While here, fix and improves args-http-mark.pl to a correct use-case. ok reyk --- diff --git a/regress/usr.sbin/relayd/Proc.pm b/regress/usr.sbin/relayd/Proc.pm index ea1ea6fab08..bb6ce22a6f5 100644 --- a/regress/usr.sbin/relayd/Proc.pm +++ b/regress/usr.sbin/relayd/Proc.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Proc.pm,v 1.5 2013/01/08 21:20:00 bluhm Exp $ +# $OpenBSD: Proc.pm,v 1.6 2014/05/09 11:49:26 andre Exp $ # Copyright (c) 2010-2013 Alexander Bluhm # @@ -138,7 +138,7 @@ sub loggrep { do { my($kid, $status, $code) = $self->wait(WNOHANG); - if ($kid > 0 && $status != 0) { + if ($kid > 0 && $status != 0 && not $self->{dummyrun}) { # child terminated with failure die ref($self), " child status: $status $code"; } diff --git a/regress/usr.sbin/relayd/Relayd.pm b/regress/usr.sbin/relayd/Relayd.pm index d7994df4a41..3ee96445eb4 100644 --- a/regress/usr.sbin/relayd/Relayd.pm +++ b/regress/usr.sbin/relayd/Relayd.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Relayd.pm,v 1.7 2014/05/02 14:10:03 andre Exp $ +# $OpenBSD: Relayd.pm,v 1.8 2014/05/09 11:49:26 andre Exp $ # Copyright (c) 2010-2012 Alexander Bluhm # @@ -96,9 +96,10 @@ sub new { sub up { my $self = Proc::up(shift, @_); my $timeout = shift || 10; + my $dummyrun = $self->{dummyrun} || 0; my $lsock = $self->loggrep(qr/relay_launch: /, $timeout) or croak ref($self), " no relay_launch in $self->{logfile} ". - "after $timeout seconds"; + "after $timeout seconds" unless $dummyrun; return $self; } diff --git a/regress/usr.sbin/relayd/args-http-mark.pl b/regress/usr.sbin/relayd/args-http-mark.pl index a96d8927862..84a6345b01a 100644 --- a/regress/usr.sbin/relayd/args-http-mark.pl +++ b/regress/usr.sbin/relayd/args-http-mark.pl @@ -9,12 +9,13 @@ our %args = ( relayd => { protocol => [ "http", 'request path mark "*" from "/foobar" with 55', - 'request path change "path" to "foobarchangedpath" marked 55', + 'request header append "bar" to "foo" marked 55', ], loggrep => { ", 55,.*done" => 1 }, }, server => { func => \&http_server, + loggrep => { "foo: bar" => 1 }, }, ); diff --git a/regress/usr.sbin/relayd/relayd.pl b/regress/usr.sbin/relayd/relayd.pl index ebf0a583beb..8231ce8d84e 100644 --- a/regress/usr.sbin/relayd/relayd.pl +++ b/regress/usr.sbin/relayd/relayd.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: relayd.pl,v 1.8 2013/02/07 22:56:27 bluhm Exp $ +# $OpenBSD: relayd.pl,v 1.9 2014/05/09 11:49:26 andre Exp $ # Copyright (c) 2010-2013 Alexander Bluhm # @@ -68,12 +68,12 @@ my $c = Client->new( $s->run unless $args{server}{noserver}; $r->run; $r->up; -$c->run->up; +$c->run->up unless $args{client}{noclient}; $s->up unless $args{server}{noserver}; -$c->down; +$c->down unless $args{client}{noclient}; $s->down unless $args{server}{noserver}; $r->kill_child; -$r->down; +$r->down unless $args{relayd}{dummyrun}; check_logs($c, $r, $s, %args);