summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rwxr-xr-xt/simple-httpd8
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index c9748f54..66be375d 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
o display RPM version in cpan-testers logs
o do not fail test when libnss.so is not found in Debian 9 or FreeBSD
o fix failing to build some rpms on FreeBSD
+ o fix failing tests when serving over HTTP from within /root
o fix test with rpm < 4.13 on CentOS7
o make sure genhdlist2 works
o perform some file conflict tests only on Mageia
diff --git a/t/simple-httpd b/t/simple-httpd
index 1f758699..fcc9a301 100755
--- a/t/simple-httpd
+++ b/t/simple-httpd
@@ -6,6 +6,7 @@
use base qw(Net::Server::Single);
use strict;
+use Cwd 'getcwd';
@ARGV == 3 or die "usage: simple-httpd <document root> <log dir> <port>\n";
my ($DOCUMENT_ROOT, $SERVER_ROOT, $PORT) = @ARGV;
@@ -23,8 +24,11 @@ sub configure_hook {
my $root = $self->{server_root} = $SERVER_ROOT;
$self->{server}->{port} = "*:$PORT"; # port and addr to bind
- $self->{server}->{user} = 'nobody'; # user to run as
- $self->{server}->{group} = 'nogroup' if -e '/etc/mageia-release'; # group to run as
+ # running as nobody will make all tests to fail when running as root and in /root (access denied -> 404)
+ if (getcwd() !~ m!^/root/!) {
+ $self->{server}->{user} = 'nobody'; # user to run as
+ $self->{server}->{group} = 'nogroup' if -e '/etc/mageia-release'; # group to run as
+ }
$self->{server}->{log_file} = "$root/server.log";