git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit3bd38b0daa1b8c0fdadf01ae63e7ddda12fb1e74 authorMichael Raskin <7c6f434c@mail.ru> dateFri 11 Jan 2019, 11:19 (8 years ago) parent5ef8b40
1 file changed+2
pkgs/servers/http/lighttpd/default.nix+2
pkgs/servers/http/lighttpd/default.nix+2
@@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
2424
2525 postPatch = ''
2626 patchShebangs tests
27+ # Linux sandbox has an empty hostname and not /etc/hosts, which fails some tests
28+ sed -ire '/[$]self->{HOSTNAME} *=/i if(length($name)==0) { $name = "127.0.0.1" }' tests/LightyTest.pm
2729 '';
2830
2931 nativeBuildInputs = [ pkgconfig ];