From 0c5ff9066e6fa41b1fbd5d0b8c2f02e8a04e96ea Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sat, 2 May 2020 22:06:04 +0300 Subject: [PATCH] Add macOS support to travis --- .travis.yml | 29 ++++++++++++++++++++--------- contrib/travis.sh | 9 +++++++-- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 16f7593..ad0eee8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ language: c -os: linux +os: + - linux + - osx + +# Valgrind currently supports upto macOS 10.13, the latest xcode of that version is 10.1 +osx_image: xcode10.1 addons: apt: packages: @@ -30,10 +35,13 @@ env: - CFLAGS=-O0 CTIMETEST= - ECMULTGENPRECISION=2 - ECMULTGENPRECISION=8 + - VALGRIND=yes ENDOMORPHISM=yes BIGNUM=no ASM=x86_64 EXPERIMENTAL=yes ECDH=yes RECOVERY=yes EXTRAFLAGS="--disable-openssl-tests" CPPFLAGS=-DVALGRIND BUILD= + - VALGRIND=yes BIGNUM=no ASM=x86_64 EXPERIMENTAL=yes ECDH=yes RECOVERY=yes EXTRAFLAGS="--disable-openssl-tests" CPPFLAGS=-DVALGRIND BUILD= matrix: fast_finish: true include: - compiler: clang + os: linux env: HOST=i686-linux-gnu ENDOMORPHISM=yes addons: apt: @@ -45,6 +53,7 @@ matrix: - libc6-dbg:i386 - compiler: clang env: HOST=i686-linux-gnu + os: linux addons: apt: packages: @@ -54,6 +63,7 @@ matrix: - libc6-dbg:i386 - compiler: gcc env: HOST=i686-linux-gnu ENDOMORPHISM=yes + os: linux addons: apt: packages: @@ -62,6 +72,7 @@ matrix: - libtool-bin - libc6-dbg:i386 - compiler: gcc + os: linux env: HOST=i686-linux-gnu addons: apt: @@ -71,14 +82,12 @@ matrix: - valgrind - libtool-bin - libc6-dbg:i386 - - compiler: gcc - env: - - BIGNUM=no ENDOMORPHISM=yes ASM=x86_64 EXPERIMENTAL=yes ECDH=yes RECOVERY=yes - - VALGRIND=yes EXTRAFLAGS="--disable-openssl-tests" CPPFLAGS=-DVALGRIND BUILD= - - compiler: gcc - env: # The same as above but without endomorphism. - - BIGNUM=no ASM=x86_64 EXPERIMENTAL=yes ECDH=yes RECOVERY=yes - - VALGRIND=yes EXTRAFLAGS="--disable-openssl-tests" CPPFLAGS=-DVALGRIND BUILD= + +# We use this to install macOS dependencies instead of the built in `homebrew` plugin, +# because in xcode earlier than 11 they have a bug requiring updating the system which overall takes ~8 minutes. +# https://travis-ci.community/t/macos-build-fails-because-of-homebrew-bundle-unknown-command/7296 +before_install: + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install gmp valgrind gcc@9; fi before_script: ./autogen.sh @@ -90,3 +99,5 @@ after_script: - cat ./exhaustive_tests.log - cat ./valgrind_ctime_test.log - cat ./bench.log + - $CC --version + - valgrind --version diff --git a/contrib/travis.sh b/contrib/travis.sh index 9276867..383ef3f 100755 --- a/contrib/travis.sh +++ b/contrib/travis.sh @@ -11,6 +11,10 @@ if [ "$HOST" = "i686-linux-gnu" ] then export CC="$CC -m32" fi +if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$TRAVIS_COMPILER" = "gcc" ] +then + export CC="gcc-9" +fi ./configure \ --enable-experimental="$EXPERIMENTAL" --enable-endomorphism="$ENDOMORPHISM" \ @@ -33,7 +37,8 @@ if [ -n "$BENCH" ] then if [ -n "$VALGRIND" ] then - EXEC='libtool --mode=execute valgrind --error-exitcode=42' + # Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool + EXEC='./libtool --mode=execute valgrind --error-exitcode=42' else EXEC= fi @@ -54,5 +59,5 @@ then fi if [ -n "$CTIMETEST" ] then - libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1 + ./libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1 fi