Issue #7 new

Test suite failure

nomeata
created an issue

Hi,

I just noticed that the test suite is locale-dependent, i.e. with LANG=C it fails, but with LANG=C.UTF-8 it works:

debian/hlibrary.setup test --builddir=dist-ghc
Running 1 test suites...
Test suite test-libzip: RUNNING...
### Failure in: 0:Monadic API:9:create an archive with Unicode filenames
expected: ["\19990\30028/","\19990\30028/\1087\1088\1080\1074\1077\1090.txt","\19990\30028/\1084\1080\1088.txt"]
 but got: ["/","/.txt","/.txt"]
Cases: 27  Tried: 27  Errors: 0  Failures: 1
Test suite test-libzip: FAIL
Test suite logged to: dist-ghc/test/LibZip-0.11.1-test-libzip.log
0 of 1 test suites (0 of 1 test cases) passed.
make: *** [check-ghc-stamp] Error 1

Is this a bug? If not, it might still make sense to make the test suite environment-independent somehow.

Greetings, Joachim

Comments (2)

  1. Sergey Astanin repo owner

    It appears that Foreign.C.String.peekCString function in GHC doesn't peek a unicode string if it's run in C locale.

    In a UTF-8 locale it works as expected:

    % LANG=en_US.UTF-8 cabal repl
    ...
    ghci> import Foreign.C.String
    ghci> import qualified Data.ByteString.UTF8 as UTF8
    ghci> import qualified Data.ByteString as BS
    ghci> BS.useAsCString (UTF8.fromString "\x4e16\x754c") peekCString
    "\19990\30028"
    

    And in C locale:

     % LANG=C cabal repl
    ...
    ghci> import Foreign.C.String
    ghci> import qualified Data.ByteString as BS
    ghci> import qualified Data.ByteString.UTF8 as UTF8
    ghci> BS.useAsCString (UTF8.fromString "\x4e16\x754c") peekCString
    ""
    

    It's on GHC 7.6.3.

    That's the reason the test fails in the C locale. I'll think about a workaround.

  2. Log in to comment