diff --git a/.travis.yml b/.travis.yml index 56d4a600b..2d7b69f6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,10 +36,8 @@ branches: # Additional installs: Valgrind for memory tests. install: - - sudo apt-get update -qq - - sudo apt-get install valgrind - - apt-cache search gcc | grep '^gcc-[0-9\.]* ' - - apt-cache search clang | grep compiler + - '[ "$OS" != "WIN" ] && sudo apt-get update -qq || true' + - '[ "$OS" != "WIN" ] && sudo apt-get install valgrind || true' # The language is C and it will load the respective dependencies language: c @@ -60,96 +58,113 @@ matrix: # We have only one program and the variable $BUILDOPTIONS # has only the options to that program: testme.sh - # Check source code format - - env: BUILDOPTIONS='--format' - addons: - apt: - packages: - - astyle - - # GCC for the 32-bit architecture (no valgrind yet) - - env: BUILDOPTIONS='--with-cc=gcc-5 --with-m32' - addons: - apt: - packages: - - libc6-dev-i386 - - gcc-multilib - - # clang for the 32-bit architecture (no valgrind yet) - - env: BUILDOPTIONS='--with-cc=clang-7 --with-m32' - addons: - apt: - packages: - - libc6-dev-i386 - - gcc-multilib - - # GCC for the x64_32 architecture (32-bit longs and 32-bit pointers) - # TODO: Probably not possible to run anything in x32 in Travis - # but needs to be checked to be sure. - - env: BUILDOPTIONS='--with-cc=gcc-5 --with-mx32' - addons: - apt: - packages: - - libc6-dev-x32 - - gcc-multilib - - # GCC for the x86-64 architecture (64-bit longs and 64-bit pointers) - - env: BUILDOPTIONS='--with-cc=gcc-5 --with-m64 --with-valgrind' - - env: BUILDOPTIONS='--with-cc=gcc-4.7 --with-m64 --with-valgrind' - addons: - apt: - packages: - - gcc-4.7 - - env: BUILDOPTIONS='--with-cc=gcc-4.8 --with-m64 --with-valgrind' - addons: - apt: - packages: - - gcc-4.8 - - env: BUILDOPTIONS='--with-cc=gcc-4.9 --with-m64 --with-valgrind' - addons: - apt: - packages: - - gcc-4.9 - - # clang for x86-64 architecture (64-bit longs and 64-bit pointers) - - env: CONV_WARNINGS=1 BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-valgrind' - - env: BUILDOPTIONS='--with-cc=clang-6.0 --with-m64 --with-valgrind' - addons: - apt: - packages: - - clang-6.0 - - env: BUILDOPTIONS='--with-cc=clang-5.0 --with-m64 --with-valgrind' - addons: - apt: - packages: - - clang-5.0 - - env: BUILDOPTIONS='--with-cc=clang-4.0 --with-m64 --with-valgrind' - addons: - apt: - packages: - - clang-4.0 - - # GCC for the x86-64 architecture with restricted limb sizes - # formerly started with the option "--with-low-mp" to testme.sh - # but testing all three in one run took to long and timed out. - - env: BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_8BIT --with-valgrind' - - env: BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_16BIT --with-valgrind' - - env: BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_32BIT --with-valgrind' - - # clang for the x86-64 architecture with restricted limb sizes - - env: BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_8BIT --with-valgrind' - - env: BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_16BIT --with-valgrind' - - env: BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_32BIT --with-valgrind' - - # GCC for the x86-64 architecture testing against a different Bigint-implementation - # with 333333 different inputs. - - env: BUILDOPTIONS='--with-cc=gcc-5 --test-vs-mtest=333333 --with-valgrind' - - env: BUILDOPTIONS='--with-cc=clang-7 --test-vs-mtest=333333 --with-valgrind' - - # clang for the x86-64 architecture testing against a different Bigint-implementation - # with a better random source. - - env: BUILDOPTIONS='--with-cc=gcc-5 --test-vs-mtest=333333 --mtest-real-rand --with-valgrind' - - env: BUILDOPTIONS='--with-cc=clang-7 --test-vs-mtest=333333 --mtest-real-rand --with-valgrind' +# # Check source code format +# - env: BUILDOPTIONS='--format' +# addons: +# apt: +# packages: +# - astyle + + # Windows build with gcc + - os: windows + env: + - OS=WIN + - BUILDOPTIONS='--all' + before_script: + - chmod +x testme.sh + + # Windows build with msvc + - os: windows + env: + - OS=WIN + - BUILDOPTIONS='--make=nmake.exe --make-options=-f --make-options=makefile.msvc' + before_script: + - . '"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64' + - chmod +x testme.sh + +# # GCC for the 32-bit architecture (no valgrind yet) +# - env: BUILDOPTIONS='--with-cc=gcc-5 --with-m32' +# addons: +# apt: +# packages: +# - libc6-dev-i386 +# - gcc-multilib +# +# # clang for the 32-bit architecture (no valgrind yet) +# - env: BUILDOPTIONS='--with-cc=clang-7 --with-m32' +# addons: +# apt: +# packages: +# - libc6-dev-i386 +# - gcc-multilib +# +# # GCC for the x64_32 architecture (32-bit longs and 32-bit pointers) +# # TODO: Probably not possible to run anything in x32 in Travis +# # but needs to be checked to be sure. +# - env: BUILDOPTIONS='--with-cc=gcc-5 --with-mx32' +# addons: +# apt: +# packages: +# - libc6-dev-x32 +# - gcc-multilib +# +# # GCC for the x86-64 architecture (64-bit longs and 64-bit pointers) +# - env: BUILDOPTIONS='--with-cc=gcc-5 --with-m64 --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=gcc-4.7 --with-m64 --with-valgrind' +# addons: +# apt: +# packages: +# - gcc-4.7 +# - env: BUILDOPTIONS='--with-cc=gcc-4.8 --with-m64 --with-valgrind' +# addons: +# apt: +# packages: +# - gcc-4.8 +# - env: BUILDOPTIONS='--with-cc=gcc-4.9 --with-m64 --with-valgrind' +# addons: +# apt: +# packages: +# - gcc-4.9 +# +# # clang for x86-64 architecture (64-bit longs and 64-bit pointers) +# - env: CONV_WARNINGS=1 BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=clang-6.0 --with-m64 --with-valgrind' +# addons: +# apt: +# packages: +# - clang-6.0 +# - env: BUILDOPTIONS='--with-cc=clang-5.0 --with-m64 --with-valgrind' +# addons: +# apt: +# packages: +# - clang-5.0 +# - env: BUILDOPTIONS='--with-cc=clang-4.0 --with-m64 --with-valgrind' +# addons: +# apt: +# packages: +# - clang-4.0 +# +# # GCC for the x86-64 architecture with restricted limb sizes +# # formerly started with the option "--with-low-mp" to testme.sh +# # but testing all three in one run took to long and timed out. +# - env: BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_8BIT --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_16BIT --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=gcc-5 --cflags=-DMP_32BIT --with-valgrind' +# +# # clang for the x86-64 architecture with restricted limb sizes +# - env: BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_8BIT --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_16BIT --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=clang-7 --cflags=-DMP_32BIT --with-valgrind' +# +# # GCC for the x86-64 architecture testing against a different Bigint-implementation +# # with 333333 different inputs. +# - env: BUILDOPTIONS='--with-cc=gcc-5 --test-vs-mtest=333333 --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=clang-7 --test-vs-mtest=333333 --with-valgrind' +# +# # clang for the x86-64 architecture testing against a different Bigint-implementation +# # with a better random source. +# - env: BUILDOPTIONS='--with-cc=gcc-5 --test-vs-mtest=333333 --mtest-real-rand --with-valgrind' +# - env: BUILDOPTIONS='--with-cc=clang-7 --test-vs-mtest=333333 --mtest-real-rand --with-valgrind' # Notifications go to # An email address is also possible. @@ -157,9 +172,5 @@ notifications: irc: "chat.freenode.net#libtom-notifications" # The actual script the jobs run. -# Because of a default timeout of 10 minutes it was necessary to use -# a Travis tool to extend that timeout to 40 minutes. 50 minutes -# seem to be the max and 20 the default if travis_wait is called without -# any options. script: - ./testme.sh ${BUILDOPTIONS} diff --git a/testme.sh b/testme.sh index 40ecb74f7..9239103e1 100755 --- a/testme.sh +++ b/testme.sh @@ -8,11 +8,16 @@ set -e +[ ! -z "$MAKE" ] || MAKE=make + if [ -f /proc/cpuinfo ] then - MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 )) + MAKE_JOBS="-j$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))" +elif [ "$MAKE" == "make" ] +then + MAKE_JOBS="-j8" else - MAKE_JOBS=8 + MAKE_JOBS="" fi ret=0 @@ -49,7 +54,11 @@ _help() echo " This is an option that will always be" echo " passed as parameter to CC." echo - echo " --make-option=* Give an option to make," + echo " --make=* Use the given command instead of \""$MAKE"\"." + echo " This can also be accomplished by setting" + echo " the MAKE environment variable." + echo + echo " --make-options=* Give an option to make," echo " e.g. --make-option=\"-f makefile.shared\"" echo " This is an option that will always be" echo " passed as parameter to make." @@ -105,7 +114,7 @@ _make() { echo -ne " Compile $1 $2" suffix=$(echo ${1}${2} | tr ' ' '_') - CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log + CC="$1" CFLAGS="$2 $TEST_CFLAGS" $MAKE $MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log errcnt=$(wc -l < gcc_errors_${suffix}.log) if [[ ${errcnt} -gt 1 ]]; then echo " failed" @@ -117,7 +126,7 @@ _make() _runtest() { - make clean > /dev/null + $MAKE clean > /dev/null _make "$1" "$2" "test_standalone" local _timeout="" which timeout >/dev/null && _timeout="timeout --foreground 90" @@ -130,7 +139,7 @@ _runtest() # TODO: merge _runvalgrind() { - make clean > /dev/null + $MAKE clean > /dev/null _make "$1" "$2" "test_standalone" local _timeout="" # 30 minutes? Yes. Had it at 20 minutes and the Valgrind run needed over 25 minutes. @@ -212,7 +221,10 @@ do fi start_alive_printing ;; - --make-option=*) + --make=*) + MAKE="${1#*=}" + ;; + --make-options=*) MAKE_OPTIONS="$MAKE_OPTIONS ${1#*=}" ;; --with-low-mp) @@ -258,9 +270,9 @@ function _check_git() { if [[ "$CHECK_FORMAT" == "1" ]] then - make astyle + $MAKE astyle _check_git "make astyle" - make new_file + $MAKE new_file _check_git "make format" perl helper.pl -a exit $? @@ -299,7 +311,7 @@ _banner if [[ "$TEST_VS_MTEST" != "" ]] then - make clean > /dev/null + $MAKE clean > /dev/null _make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "test" echo _make "gcc" "$MTEST_RAND" "mtest"