summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-07-20 05:34:17 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-07-20 05:34:17 +0000
commitfeab71403ee3fe800c186f80447c14a6cc93f4ad (patch)
tree7e7905aaa7400bb18442a4315863f8a8d96152df /regress
parent5c957dfbd831fdd1906c1b46766d397f07662e17 (diff)
Allow to use $curdir, $objdir, $host, $hostname in the test config
file. They are substituted automatically, to avoid this in each single test.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.sbin/relayd/Relayd.pm7
-rw-r--r--regress/usr.sbin/syslogd/Syslogd.pm21
-rw-r--r--regress/usr.sbin/syslogd/args-block-duplicate.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-block-host-quick.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-block-host.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-block-prog-host-quick.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-block-prog-host.pl7
-rw-r--r--regress/usr.sbin/syslogd/args-block-prog-quick.pl5
-rw-r--r--regress/usr.sbin/syslogd/args-block-prog.pl5
-rw-r--r--regress/usr.sbin/syslogd/args-fdexhaustion-config.pl5
-rw-r--r--regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl5
-rw-r--r--regress/usr.sbin/syslogd/args-selector.pl5
12 files changed, 29 insertions, 59 deletions
diff --git a/regress/usr.sbin/relayd/Relayd.pm b/regress/usr.sbin/relayd/Relayd.pm
index d4fdbf0bfac..4938b11c983 100644
--- a/regress/usr.sbin/relayd/Relayd.pm
+++ b/regress/usr.sbin/relayd/Relayd.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Relayd.pm,v 1.15 2015/05/22 19:09:18 bluhm Exp $
+# $OpenBSD: Relayd.pm,v 1.16 2015/07/20 05:34:16 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -20,6 +20,8 @@ use warnings;
package Relayd;
use parent 'Proc';
use Carp;
+use Cwd;
+use Sys::Hostname;
use File::Basename;
sub new {
@@ -58,6 +60,9 @@ sub new {
# substitute variables in config file
my $curdir = dirname($0) || ".";
+ my $objdir = getcwd();
+ my $hostname = hostname();
+ (my $host = $hostname) =~ s/\..*//;
my $connectport = $self->{connectport};
my $connectaddr = $self->{connectaddr};
my $listenaddr = $self->{listenaddr};
diff --git a/regress/usr.sbin/syslogd/Syslogd.pm b/regress/usr.sbin/syslogd/Syslogd.pm
index 21d7012a0d7..9289a0f4206 100644
--- a/regress/usr.sbin/syslogd/Syslogd.pm
+++ b/regress/usr.sbin/syslogd/Syslogd.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Syslogd.pm,v 1.13 2015/07/16 16:34:34 bluhm Exp $
+# $OpenBSD: Syslogd.pm,v 1.14 2015/07/20 05:34:16 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
# Copyright (c) 2014 Florian Riehm <mail@friehm.de>
@@ -23,6 +23,7 @@ use parent 'Proc';
use Carp;
use Cwd;
use File::Basename;
+use Sys::Hostname;
use Time::HiRes qw(time alarm sleep);
sub new {
@@ -53,6 +54,10 @@ sub new {
_make_abspath(\$self->{$_}) foreach (qw(conffile outfile outpipe));
# substitute variables in config file
+ my $curdir = dirname($0) || ".";
+ my $objdir = getcwd();
+ my $hostname = hostname();
+ (my $host = $hostname) =~ s/\..*//;
my $connectdomain = $self->{connectdomain};
my $connectaddr = $self->{connectaddr};
my $connectproto = $self->{connectproto};
@@ -65,14 +70,14 @@ sub new {
my $memory = $self->{memory};
print $fh "*.*\t:$memory->{size}:$memory->{name}\n" if $memory;
my $loghost = $self->{loghost};
- if ($loghost) {
- $loghost =~ s/(\$[a-z]+)/$1/eeg;
- } else {
- $loghost = "\@$connectaddr";
- $loghost .= ":$connectport" if $connectport;
+ unless ($loghost) {
+ $loghost = '@$connectaddr';
+ $loghost .= ':$connectport' if $connectport;
}
- print $fh "*.*\t$loghost\n";
- print $fh $self->{conf} if $self->{conf};
+ my $config = "*.*\t$loghost\n";
+ $config .= $self->{conf} if $self->{conf};
+ $config =~ s/(\$[a-z]+)/$1/eeg;
+ print $fh $config;
close $fh;
return $self->create_out();
diff --git a/regress/usr.sbin/syslogd/args-block-duplicate.pl b/regress/usr.sbin/syslogd/args-block-duplicate.pl
index 66778dce7f5..dc901d93739 100644
--- a/regress/usr.sbin/syslogd/args-block-duplicate.pl
+++ b/regress/usr.sbin/syslogd/args-block-duplicate.pl
@@ -8,15 +8,10 @@
use strict;
use warnings;
-use Cwd;
-use Sys::Hostname;
-
-my $objdir = getcwd();
-(my $host = hostname()) =~ s/\..*//;
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
!nonexist
+nonexist
*.* $objdir/file-0.log
diff --git a/regress/usr.sbin/syslogd/args-block-host-quick.pl b/regress/usr.sbin/syslogd/args-block-host-quick.pl
index eb1c5745d38..181d5d6bf25 100644
--- a/regress/usr.sbin/syslogd/args-block-host-quick.pl
+++ b/regress/usr.sbin/syslogd/args-block-host-quick.pl
@@ -8,15 +8,10 @@
use strict;
use warnings;
-use Cwd;
-use Sys::Hostname;
-
-my $objdir = getcwd();
-(my $host = hostname()) =~ s/\..*//;
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
+nonexist
*.* $objdir/file-0.log
++$host
diff --git a/regress/usr.sbin/syslogd/args-block-host.pl b/regress/usr.sbin/syslogd/args-block-host.pl
index 58311aa4629..1b55ce00944 100644
--- a/regress/usr.sbin/syslogd/args-block-host.pl
+++ b/regress/usr.sbin/syslogd/args-block-host.pl
@@ -8,15 +8,10 @@
use strict;
use warnings;
-use Cwd;
-use Sys::Hostname;
-
-my $objdir = getcwd();
-(my $host = hostname()) =~ s/\..*//;
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
+nonexist
*.* $objdir/file-0.log
+$host
diff --git a/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl b/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl
index 12b63567dda..678aa8e9d63 100644
--- a/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl
+++ b/regress/usr.sbin/syslogd/args-block-prog-host-quick.pl
@@ -8,15 +8,10 @@
use strict;
use warnings;
-use Cwd;
-use Sys::Hostname;
-
-my $objdir = getcwd();
-(my $host = hostname()) =~ s/\..*//;
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
!nonexist
+nonexist
*.* $objdir/file-0.log
diff --git a/regress/usr.sbin/syslogd/args-block-prog-host.pl b/regress/usr.sbin/syslogd/args-block-prog-host.pl
index 8a27efa453a..a6c9b629e2b 100644
--- a/regress/usr.sbin/syslogd/args-block-prog-host.pl
+++ b/regress/usr.sbin/syslogd/args-block-prog-host.pl
@@ -8,15 +8,10 @@
use strict;
use warnings;
-use Cwd;
-use Sys::Hostname;
-
-my $objdir = getcwd();
-(my $host = hostname()) =~ s/\..*//;
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
!nonexist
+nonexist
*.* $objdir/file-0.log
diff --git a/regress/usr.sbin/syslogd/args-block-prog-quick.pl b/regress/usr.sbin/syslogd/args-block-prog-quick.pl
index a3e48c0393e..46592296da3 100644
--- a/regress/usr.sbin/syslogd/args-block-prog-quick.pl
+++ b/regress/usr.sbin/syslogd/args-block-prog-quick.pl
@@ -8,13 +8,10 @@
use strict;
use warnings;
-use Cwd;
-
-my $objdir = getcwd();
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
!nonexist
*.* $objdir/file-0.log
!!syslogd-regress
diff --git a/regress/usr.sbin/syslogd/args-block-prog.pl b/regress/usr.sbin/syslogd/args-block-prog.pl
index a2cff7d1b7a..eab86cea16b 100644
--- a/regress/usr.sbin/syslogd/args-block-prog.pl
+++ b/regress/usr.sbin/syslogd/args-block-prog.pl
@@ -8,13 +8,10 @@
use strict;
use warnings;
-use Cwd;
-
-my $objdir = getcwd();
our %args = (
syslogd => {
- conf => <<"EOF",
+ conf => <<'EOF',
!nonexist
*.* $objdir/file-0.log
!syslogd-regress
diff --git a/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl b/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl
index 1d48ffa97a4..322d671dcb4 100644
--- a/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl
+++ b/regress/usr.sbin/syslogd/args-fdexhaustion-config.pl
@@ -9,13 +9,10 @@
use strict;
use warnings;
-use Cwd;
-
-my $objdir = getcwd();
our %args = (
syslogd => {
- conf => join("", map { "*.*\t$objdir/file-$_.log\n" } 0..19),
+ conf => join("", map { "*.*\t\$objdir/file-$_.log\n" } 0..19),
rlimit => {
RLIMIT_NOFILE => 30,
},
diff --git a/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl b/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl
index aa019fc1c3c..ea1e65186fa 100644
--- a/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl
+++ b/regress/usr.sbin/syslogd/args-fdexhaustion-sighup.pl
@@ -9,9 +9,6 @@
use strict;
use warnings;
-use Cwd;
-
-my $objdir = getcwd();
our %args = (
client => {
@@ -23,7 +20,7 @@ our %args = (
loggrep => { get_between2loggrep() },
},
syslogd => {
- conf => join("", map { "*.*\t$objdir/file-$_.log\n" } 0..19),
+ conf => join("", map { "*.*\t\$objdir/file-$_.log\n" } 0..19),
rlimit => {
RLIMIT_NOFILE => 30,
},
diff --git a/regress/usr.sbin/syslogd/args-selector.pl b/regress/usr.sbin/syslogd/args-selector.pl
index f5f646bbd07..d06dc9e7514 100644
--- a/regress/usr.sbin/syslogd/args-selector.pl
+++ b/regress/usr.sbin/syslogd/args-selector.pl
@@ -8,11 +8,8 @@
use strict;
use warnings;
-use Cwd;
use Sys::Syslog;
-my $objdir = getcwd();
-
my (@messages, @priorities);
foreach my $fac (qw(local5 local6 local7)) {
foreach my $sev (qw(notice warning err)) {
@@ -55,7 +52,7 @@ sub selector2config {
my $conf = "";
my $i = 0;
foreach my $sel (sort keys %s2m) {
- $conf .= "$sel\t$objdir/file-$i.log\n";
+ $conf .= "$sel\t\$objdir/file-$i.log\n";
$i++;
}
return $conf;