Page MenuHomePhabricator

[SECP256K1] Add macOS to the CI
ClosedPublic

Authored by Fabien on Sep 28 2020, 15:48.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABC836f5d85b22a: [SECP256K1] Add macOS to the CI
Summary
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
(#723 (comment))

    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 setting CFLAGS, it's enough to
just set CFLAGS directly and it can cause troubles in sh (the whole
EXTRAFLAGS="--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 the gcc binary, so we have to explicitly set CC=gcc-9
under that scenario, so I also explicitly install gcc@9 so it shouldn't
break when macOS gets gcc-10.

    Bumped ubuntu to bionic because of #748 (comment) (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.

    https://travis-ci.org/github/elichai/secp256k1/jobs/681663742#L336

Backport of secp256k1 PR750.

This backport adds a few changes to the original PR:

  • This PR contains a bug fix on the valgrind return value (was always 0 ) for the constant time check test. This makes the schnorr signature to trigger a false positive, and this diff includes a fix extracted from PR558.
  • This PR works around a bug in the brew plugin for Travis that causes an update if a package is installed via the built-in addon. However forcing no update will install a cmake version which is too old, so this workaround has not been ported.
  • The java tests fails with autotools on OSX due to an RPATH issue with the libraries. Since there is no trivial fix the test is skipped for now.
Test Plan

Run the Travis build.
https://travis-ci.org/github/Fabcien/secp256k1/builds/731184003
Note: this has been tested by part since the whole tests take > 6h

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Sep 28 2020, 15:48
Fabien planned changes to this revision.

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Fabien edited the test plan for this revision. (Show Details)

Use the homebrew addon to prevent cmake installation flakyness.
Skip java tests with autotools/osx.

This revision is now accepted and ready to land.Sep 29 2020, 09:16
This revision was automatically updated to reflect the committed changes.