[tests] revert _WIN32 adjustments in LightyTest.pm
This reverts commit c1bc5efe9a
.
This commit is contained in:
parent
c1bc5efe9a
commit
d1b5f52e96
|
@ -50,17 +50,20 @@ sub new {
|
|||
my $class = shift;
|
||||
my $self = {};
|
||||
my $lpath;
|
||||
my $exe = $^O eq "cygwin" ? ".exe" : "";
|
||||
|
||||
$self->{CONFIGFILE} = 'lighttpd.conf';
|
||||
|
||||
$lpath = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'} : '..');
|
||||
$self->{BASEDIR} = abs_path($lpath);
|
||||
|
||||
$lpath = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'}."/tests" : '.');
|
||||
$lpath = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'}."/tests/" : '.');
|
||||
$self->{TESTDIR} = abs_path($lpath);
|
||||
|
||||
if (mtime($self->{BASEDIR}."/src/lighttpd$exe") > mtime($self->{BASEDIR}."/build/lighttpd$exe")) {
|
||||
$lpath = (defined $ENV{'srcdir'} ? $ENV{'srcdir'} : '.');
|
||||
$self->{SRCDIR} = abs_path($lpath);
|
||||
|
||||
|
||||
if (mtime($self->{BASEDIR}.'/src/lighttpd') > mtime($self->{BASEDIR}.'/build/lighttpd')) {
|
||||
$self->{BINDIR} = $self->{BASEDIR}.'/src';
|
||||
if (mtime($self->{BASEDIR}.'/src/.libs')) {
|
||||
$self->{MODULES_PATH} = $self->{BASEDIR}.'/src/.libs';
|
||||
|
@ -71,7 +74,7 @@ sub new {
|
|||
$self->{BINDIR} = $self->{BASEDIR}.'/build';
|
||||
$self->{MODULES_PATH} = $self->{BASEDIR}.'/build';
|
||||
}
|
||||
$self->{LIGHTTPD_PATH} = $self->{BINDIR}."/lighttpd$exe";
|
||||
$self->{LIGHTTPD_PATH} = $self->{BINDIR}.'/lighttpd';
|
||||
if (exists $ENV{LIGHTTPD_EXE_PATH}) {
|
||||
$self->{LIGHTTPD_PATH} = $ENV{LIGHTTPD_EXE_PATH};
|
||||
}
|
||||
|
@ -175,39 +178,24 @@ sub start_proc {
|
|||
my $SOCK;
|
||||
($SOCK, $self->{PORT}) = bind_ephemeral_tcp_socket();
|
||||
|
||||
my $testdir = $self->{TESTDIR};
|
||||
my $conf = $self->{TESTDIR}.'/'.$self->{CONFIGFILE};
|
||||
my $modules_path = $self->{MODULES_PATH};
|
||||
# pre-process configfile if necessary
|
||||
#
|
||||
|
||||
# test for cygwin w/ _WIN32 native lighttpd.exe (not linked w/ cygwin1.dll)
|
||||
# ($^O eq "MSWin32") is untested; not supported
|
||||
my $win32native = $^O eq "cygwin"
|
||||
&& 0 != system("ldd '$$self{LIGHTTPD_PATH}' | grep -q cygwin");
|
||||
$ENV{'SRCDIR'} = $self->{BASEDIR}.'/tests';
|
||||
$ENV{'PORT'} = $self->{PORT};
|
||||
|
||||
if ($win32native) {
|
||||
chomp($ENV{PERL} = `cygpath -alm "$ENV{PERL}"`);
|
||||
chomp($testdir = `cygpath -alm "$testdir"`);
|
||||
chomp($conf = `cygpath -alm "$conf"`);
|
||||
chomp($modules_path = `cygpath -alm "$modules_path"`);
|
||||
$ENV{PERL} =~ s/^[A-Z]://i; # remove volume (C:)
|
||||
$testdir =~ s/^[A-Z]://i; # remove volume (C:)
|
||||
$conf =~ s/^[A-Z]://i; # remove volume (C:)
|
||||
$modules_path =~ s/^[A-Z]://i; # remove volume (C:)
|
||||
}
|
||||
|
||||
my @cmdline = ($self->{LIGHTTPD_PATH}, "-D", "-f", $conf, "-m", $modules_path);
|
||||
my @cmdline = ($self->{LIGHTTPD_PATH}, "-D", "-f", $self->{SRCDIR}."/".$self->{CONFIGFILE}, "-m", $self->{MODULES_PATH});
|
||||
splice(@cmdline, -2) if exists $ENV{LIGHTTPD_EXE_PATH};
|
||||
if (!defined $ENV{"TRACEME"}) {
|
||||
} elsif ($ENV{"TRACEME"} eq 'strace') {
|
||||
if (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'strace') {
|
||||
@cmdline = (qw(strace -tt -s 4096 -o strace -f -v), @cmdline);
|
||||
} elsif ($ENV{"TRACEME"} eq 'truss') {
|
||||
} elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'truss') {
|
||||
@cmdline = (qw(truss -a -l -w all -v all -o strace), @cmdline);
|
||||
} elsif ($ENV{"TRACEME"} eq 'gdb') {
|
||||
} elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'gdb') {
|
||||
@cmdline = ('gdb', '--batch', '--ex', 'run', '--ex', 'bt full', '--args', @cmdline);
|
||||
} elsif ($ENV{"TRACEME"} eq 'valgrind') {
|
||||
} elsif (defined $ENV{"TRACEME"} && $ENV{"TRACEME"} eq 'valgrind') {
|
||||
@cmdline = (qw(valgrind --tool=memcheck --track-origins=yes --show-reachable=yes --leak-check=yes --log-file=valgrind.%p), @cmdline);
|
||||
}
|
||||
# diag("\nstarting lighttpd at :$$self{PORT}, cmdline: @cmdline");
|
||||
# diag("\nstarting lighttpd at :".$self->{PORT}.", cmdline: @cmdline");
|
||||
my $child = fork();
|
||||
if (not defined $child) {
|
||||
diag("\nFork failed");
|
||||
|
@ -215,8 +203,7 @@ sub start_proc {
|
|||
return -1;
|
||||
}
|
||||
if ($child == 0) {
|
||||
$ENV{'SRCDIR'} = $testdir;
|
||||
if ($win32native) {
|
||||
if ($^O eq "MSWin32") {
|
||||
# On platforms where systemd socket activation is not supported
|
||||
# or inconvenient for testing (i.e. cygwin <-> native Windows exe),
|
||||
# there is a race condition with close() before server start,
|
||||
|
@ -224,11 +211,11 @@ sub start_proc {
|
|||
# and the point is to avoid a port which is already in use.
|
||||
close($SOCK);
|
||||
my $CONF;
|
||||
open($CONF,'>',$self->{TESTDIR}."/tmp/bind.conf") || die "open: $!";
|
||||
open($CONF,'>',"$ENV{'SRCDIR'}/tmp/bind.conf") || die "open: $!";
|
||||
print $CONF <<BIND_OVERRIDE;
|
||||
server.systemd-socket-activation := "disable"
|
||||
server.bind = "127.0.0.1"
|
||||
server.port = $$self{'PORT'}
|
||||
server.port = $ENV{'PORT'}
|
||||
BIND_OVERRIDE
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -26,7 +26,7 @@ $HTTP["host"] == "auth.example.org" {
|
|||
server.name = "auth.example.org"
|
||||
|
||||
$HTTP["url"] =~ "\.php$" {
|
||||
auth.backend.htpasswd.userfile = env.SRCDIR + "/lighttpd.htpasswd"
|
||||
auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd"
|
||||
auth.backend = "htpasswd"
|
||||
auth.require = (
|
||||
"" => (
|
||||
|
|
|
@ -192,7 +192,7 @@ $HTTP["host"] == "lowercase-exclude" {
|
|||
$HTTP["host"] == "lowercase-auth" {
|
||||
server.force-lowercase-filenames = "enable"
|
||||
auth.backend = "plain"
|
||||
auth.backend.plain.userfile = env.SRCDIR + "/lighttpd.user"
|
||||
auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
|
||||
auth.require = (
|
||||
"/image.jpg" => (
|
||||
"method" => "digest",
|
||||
|
@ -225,11 +225,11 @@ $HTTP["host"] =~ "^deflate(?:-cache)?\.example\.org$" {
|
|||
$HTTP["host"] =~ "^auth-" {
|
||||
$HTTP["host"] == "auth-htpasswd.example.org" {
|
||||
auth.backend = "htpasswd"
|
||||
auth.backend.htpasswd.userfile = env.SRCDIR + "/lighttpd.htpasswd"
|
||||
auth.backend.htpasswd.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.htpasswd"
|
||||
}
|
||||
$HTTP["host"] == "auth-plain.example.org" {
|
||||
auth.backend = "plain"
|
||||
auth.backend.plain.userfile = env.SRCDIR + "/lighttpd.user"
|
||||
auth.backend.plain.userfile = env.SRCDIR + "/tmp/lighttpd/lighttpd.user"
|
||||
}
|
||||
auth.require = (
|
||||
"/server-status" => (
|
||||
|
|
|
@ -33,6 +33,9 @@ cp "${srcdir}/docroot/"*.html \
|
|||
"${srcdir}/docroot/"*.fcgi \
|
||||
"${srcdir}/docroot/"*.txt \
|
||||
"${tmpdir}/servers/www.example.org/pages/"
|
||||
cp "${srcdir}/lighttpd.user" "${tmpdir}/"
|
||||
cp "${srcdir}/lighttpd.htpasswd" "${tmpdir}/"
|
||||
cp "${srcdir}/var-include-sub.conf" "${tmpdir}/../"
|
||||
|
||||
# create some content
|
||||
touch "${tmpdir}/servers/www.example.org/pages/image.jpg" \
|
||||
|
|
Loading…
Reference in New Issue