yesodweb/wai

warp tests don't build on non-linux/freebsd/darwin

sthibaul opened this issue · 1 comments

Hello,

As can be read on

https://buildd.debian.org/status/fetch.php?pkg=haskell-warp&arch=hurd-i386&ver=3.3.21-2&stamp=1660597971&raw=0

Building test suite 'spec' for warp-3.3.21..
[ 1 of 48] Compiling HTTP             ( test/HTTP.hs, dist-ghc/build/spec/spec-tmp/HTTP.o )
[ 2 of 48] Compiling Network.Wai.Handler.Warp.Date ( Network/Wai/Handler/Warp/Date.hs, dist-ghc/build/spec/spec-tmp/Network/Wai/Handler/Warp/Date.o )

Network/Wai/Handler/Warp/Date.hs:17:1: error:
    Could not load module ‘System.Posix’
    It is a member of the hidden package ‘unix-2.7.2.2’.
    Perhaps you need to add ‘unix’ to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
17 | import System.Posix (epochTime)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warp tests don't build on GNU/Hurd, because there's a missing dependency on unix. Looking at warp.cabal we can read

Test-Suite spec
[...]
  if (os(linux) || os(freebsd) || os(darwin)) && flag(allow-sendfilefd)
    Cpp-Options:   -DSENDFILEFD
    Build-Depends: unix

And thus on non-linux/freebsd/darwin, the unix dependency is not pulled, even though we have in Network/Wai/Handler/Warp/Date.hs :

import System.Posix (epochTime)

I'd say that that part of warp.cabal should be modified to always build-depend on unix on non-windows?

Thank you for your report. I believe that "test-suite spec" should have the same logic as "library".