Skip to content

Commit

Permalink
[tests] use current perl interpreter path for env.PERL in lighttpd.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
stbuehler authored and gstrauss committed Jul 26, 2023
1 parent 0552e54 commit e9480df
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions tests/LightyTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,9 @@ use IO::Socket ();
use Test::More; # diag()
use Socket;
use Cwd 'abs_path';
use Config;

sub find_program {
my @DEFAULT_PATHS = ('/usr/bin/', '/usr/local/bin/');
my ($envname, $program) = @_;
my $location;

if (defined $ENV{$envname}) {
$location = $ENV{$envname};
} else {
$location = `which "$program" 2>/dev/null`;
chomp $location;
if (! -x $location) {
for my $path (@DEFAULT_PATHS) {
$location = $path . $program;
last if -x $location;
}
}
}

if (-x $location) {
$ENV{$envname} = $location;
return 1;
} else {
delete $ENV{$envname};
return 0;
}
}

BEGIN {
our $HAVE_PERL = find_program('PERL', 'perl');
if (!$HAVE_PERL) {
die "Couldn't find path to perl, but it obviously seems to be running";
}
}
$ENV{PERL} = $Config{perlpath} . $Config{_exe};

sub mtime {
my $file = shift;
Expand Down

0 comments on commit e9480df

Please sign in to comment.