lighttpd: fix tests on Linux

The tests were enabled in #53488 and succeeded on Darwin; on Linux they
still failed because of empty hostname inside the sandbox (we have no
UTS-namespace hostname and I think no /etc/hosts). Nix on Darwin lacks
powerful enough sandboxing, so there were no problems on Darwin.

Patching the tests to fallback to "127.0.0.1" if hostname of the
localhost cannot be retrieved matches the behaviour of lighttpd itself
and allows the tests to pass.

Not sure if having no hostname in the test environment is a bit too
weird for the upstream to care.
This commit is contained in:
Michael Raskin 2019-01-11 11:19:59 +01:00
parent 5ef8b40d4d
commit 3bd38b0daa

@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
postPatch = ''
patchShebangs tests
# Linux sandbox has an empty hostname and not /etc/hosts, which fails some tests
sed -ire '/[$]self->{HOSTNAME} *=/i if(length($name)==0) { $name = "127.0.0.1" }' tests/LightyTest.pm
'';
nativeBuildInputs = [ pkgconfig ];