This adds macOS to the travis so we can test all the same configurations under macOS, both with Apple’s clang and proper gcc on macOS. It also runs the ctime test, and valgrind on the tests just like on linux.
The current travis script is pretty messy because we added more and more configuration over time each one required more complex ifs making it harder to read, and because of the somewhat complex logic it failed[1] on macOS(having an old bash version) so I decided to just throw it into a standalone sh script instead, that way it can be formatted nicely and with -e
it will fail on every error without needing to put &&
everywhere.
Some changed in the script:
-
Replaced the usage of libtool with the locally generated libtool (https://github.com/bitcoin-core/secp256k1/pull/723#issuecomment-622999449)
-
Added
--error-exitcode=42
to the ctime tests because they currently silently fail on-O0
(https://travis-ci.org/github/bitcoin-core/secp256k1/jobs/681571334#L454) and disabled the ctime tests on-O0
. -
Moved the valgrind tests to the matrix so that they’ll run on both gcc and clang and on macOS. (also, now that #710 is merged we always pass
-DVALGRIND
when the valgrind headers exist but I left the explicit CFLAGS in those tests anyway, there’s no harm in explicitly doing that) -
Removed the use of
EXTRAFLAGS
for settingCFLAGS
, it’s enough to just setCFLAGS
directly and it can cause troubles in sh (the wholeEXTRAFLAGS="--disable-openssl-tests CPPFLAGS=-DVALGRIND"
) -
We have to explicitly set the gcc version on macOS+gcc because macOS ship with a fake gcc which is basically just an alias to their clang compiler, and installing proper gcc from brew adds a
gcc-*
binary and doesn’t replace thegcc
binary, so we have to explicitly setCC=gcc-9
under that scenario, so I also explicitly installgcc@9
so it shouldn’t break when macOS gets gcc-10. -
Bumped ubuntu to bionic because of #748 (review) (the end of
End of Standard Support
is in a year anyway) it’s in a separate commit so that if anyone have concerns I’ll just drop that commit.