summaryrefslogtreecommitdiffstats
path: root/t/simple-httpd
diff options
context:
space:
mode:
Diffstat (limited to 't/simple-httpd')
-rwxr-xr-xt/simple-httpd8
1 files changed, 6 insertions, 2 deletions
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";