summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandre <andre@openbsd.org>2014-05-12 21:30:42 +0000
committerandre <andre@openbsd.org>2014-05-12 21:30:42 +0000
commitfd61583156a8150c58a8eef7b12d0aa89f43c655 (patch)
treee648a2fc7cc0a9deabba251f9b600f85028eebf7
parentRemove useless dev_bsize variable and use DEV_BSIZE as needed. Divide (diff)
downloadwireguard-openbsd-fd61583156a8150c58a8eef7b12d0aa89f43c655.tar.xz
wireguard-openbsd-fd61583156a8150c58a8eef7b12d0aa89f43c655.zip
Refactors "dummyrun" flag as "dryrun" with an approach similar to the one used
for client/server processes checks through $self->{down} state control variable, while here, do not instantiate a client when noclient is defined, reflecting server object instantiation behaviour. ok bluhm
-rw-r--r--regress/usr.sbin/relayd/Proc.pm4
-rw-r--r--regress/usr.sbin/relayd/Relayd.pm12
-rw-r--r--regress/usr.sbin/relayd/args-http-change-path.pl2
-rw-r--r--regress/usr.sbin/relayd/args-http-mark-marked.pl2
-rw-r--r--regress/usr.sbin/relayd/relayd.pl6
5 files changed, 13 insertions, 13 deletions
diff --git a/regress/usr.sbin/relayd/Proc.pm b/regress/usr.sbin/relayd/Proc.pm
index bb6ce22a6f5..d4e23869876 100644
--- a/regress/usr.sbin/relayd/Proc.pm
+++ b/regress/usr.sbin/relayd/Proc.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Proc.pm,v 1.6 2014/05/09 11:49:26 andre Exp $
+# $OpenBSD: Proc.pm,v 1.7 2014/05/12 21:30:42 andre Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -138,7 +138,7 @@ sub loggrep {
do {
my($kid, $status, $code) = $self->wait(WNOHANG);
- if ($kid > 0 && $status != 0 && not $self->{dummyrun}) {
+ if ($kid > 0 && $status != 0 && !$self->{dryrun}) {
# 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 3ee96445eb4..d446912ab22 100644
--- a/regress/usr.sbin/relayd/Relayd.pm
+++ b/regress/usr.sbin/relayd/Relayd.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Relayd.pm,v 1.8 2014/05/09 11:49:26 andre Exp $
+# $OpenBSD: Relayd.pm,v 1.9 2014/05/12 21:30:42 andre Exp $
# Copyright (c) 2010-2012 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -27,7 +27,7 @@ sub new {
my %args = @_;
$args{logfile} ||= "relayd.log";
$args{up} ||= "Started";
- $args{down} ||= "parent terminating";
+ $args{down} ||= $args{dryrun} ? "no actions" : "parent terminating";
$args{func} = sub { Carp::confess "$class func may not be called" };
$args{conffile} ||= "relayd.conf";
$args{forward}
@@ -96,10 +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" unless $dummyrun;
+ my $regex = $self->{dryrun} || "relay_launch: ";
+ my $lsock = $self->loggrep(qr/$regex/, $timeout)
+ or croak ref($self), " no $regex in $self->{logfile} ".
+ "after $timeout seconds";
return $self;
}
diff --git a/regress/usr.sbin/relayd/args-http-change-path.pl b/regress/usr.sbin/relayd/args-http-change-path.pl
index 780eda6261b..8b1d882620c 100644
--- a/regress/usr.sbin/relayd/args-http-change-path.pl
+++ b/regress/usr.sbin/relayd/args-http-change-path.pl
@@ -13,7 +13,7 @@ our %args = (
loggrep => {
qr/relayd.conf\:.*action only supported for headers/ => 1
},
- dummyrun => 1,
+ dryrun => "relayd.conf",
},
server => {
noserver => 1,
diff --git a/regress/usr.sbin/relayd/args-http-mark-marked.pl b/regress/usr.sbin/relayd/args-http-mark-marked.pl
index 6720dd791da..971e776f71a 100644
--- a/regress/usr.sbin/relayd/args-http-mark-marked.pl
+++ b/regress/usr.sbin/relayd/args-http-mark-marked.pl
@@ -11,7 +11,7 @@ our %args = (
'request path mark "*" with 99 marked 55',
],
loggrep => { "either mark or marked" => 1 },
- dummyrun => 1,
+ dryrun => "relayd.conf",
},
server => {
noserver => 1,
diff --git a/regress/usr.sbin/relayd/relayd.pl b/regress/usr.sbin/relayd/relayd.pl
index 8231ce8d84e..de1874b89d8 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.9 2014/05/09 11:49:26 andre Exp $
+# $OpenBSD: relayd.pl,v 1.10 2014/05/12 21:30:42 andre Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -63,7 +63,7 @@ my $c = Client->new(
connectaddr => "127.0.0.1",
connectport => $rport,
%{$args{client}},
-);
+) unless $args{client}{noclient};
$s->run unless $args{server}{noserver};
$r->run;
@@ -74,6 +74,6 @@ $s->up unless $args{server}{noserver};
$c->down unless $args{client}{noclient};
$s->down unless $args{server}{noserver};
$r->kill_child;
-$r->down unless $args{relayd}{dummyrun};
+$r->down;
check_logs($c, $r, $s, %args);