yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
369 stars 95 forks source link

Long double tests fail on big-endian 64-bit architectures #655

Closed glondu closed 4 years ago

glondu commented 4 years ago

The tests in test-complex involving rotdist_complexld fail on big-endian 64-bit architectures, for example s390x:

[...]
running test-complex
FFF
==============================================================================
Error: Complex number tests:2:basic operations on complex numbers passed by value(stubs).

File "/<<PKGBUILDDIR>>/_build/oUnit-Complex number tests-zandonai#00.log", line 36, characters 1-1:
Error: Complex number tests:2:basic operations on complex numbers passed by value(stubs) (in the log).

File "tests/test-complex/test_complex.ml", line 163, characters 1-1:
Error: Complex number tests:2:basic operations on complex numbers passed by value(stubs) (in the code).

rotdist
------------------------------------------------------------------------------
==============================================================================
Error: Complex number tests:1:basic operations on complex numbers (stubs).

File "/<<PKGBUILDDIR>>/_build/oUnit-Complex number tests-zandonai#00.log", line 28, characters 1-1:
Error: Complex number tests:1:basic operations on complex numbers (stubs) (in the log).

File "tests/test-complex/test_complex.ml", line 93, characters 1-1:
Error: Complex number tests:1:basic operations on complex numbers (stubs) (in the code).

rotdist
------------------------------------------------------------------------------
==============================================================================
Error: Complex number tests:0:basic operations on complex numbers (foreign).

File "/<<PKGBUILDDIR>>/_build/oUnit-Complex number tests-zandonai#00.log", line 20, characters 1-1:
Error: Complex number tests:0:basic operations on complex numbers (foreign) (in the log).

File "tests/test-complex/test_complex.ml", line 93, characters 1-1:
Error: Complex number tests:0:basic operations on complex numbers (foreign) (in the code).

rotdist
------------------------------------------------------------------------------
Ran: 3 tests in: 0.00 seconds.
FAILED: Cases: 3 Tried: 3 Errors: 0 Failures: 3 Skip:  0 Todo: 0 Timeouts: 0.
glondu commented 4 years ago

It turns out this is due to libm not being linked into the test library. This patch fixes that.

yallop commented 4 years ago

Thanks for tracking that down, @glondu. I've submitted your patch as a PR in #656.