From 14131940c29e89e609712cf65d8b0ea411551c8a Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 18 Apr 2019 18:53:56 +0200 Subject: [PATCH 1/2] add windows builds to travis --- .travis.yml | 28 ++++++++++++++++++++++------ testme.sh | 32 ++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56d4a600b..c004b833a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,8 +36,8 @@ branches: # Additional installs: Valgrind for memory tests. install: - - sudo apt-get update -qq - - sudo apt-get install valgrind + - '[ "$OS" != "WIN" ] && sudo apt-get update -qq || true' + - '[ "$OS" != "WIN" ] && sudo apt-get install valgrind || true' - apt-cache search gcc | grep '^gcc-[0-9\.]* ' - apt-cache search clang | grep compiler @@ -67,6 +67,26 @@ matrix: packages: - astyle + # Windows build with gcc + - os: windows + env: + - MSBUILD_PATH="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin" + - OS=WIN + - BUILDOPTIONS='--all --make-options="-f makefile.mingw"' + script: + - export PATH=$MSBUILD_PATH:$PATH + - ./testme.sh ${BUILDOPTIONS} + + # Windows build with msvc + - os: windows + env: + - MSBUILD_PATH="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin" + - OS=WIN + - BUILDOPTIONS='--make=nmake.exe --make-options="-f makefile.msvc"' + script: + - export PATH=$MSBUILD_PATH:$PATH + - ./testme.sh ${BUILDOPTIONS} + # GCC for the 32-bit architecture (no valgrind yet) - env: BUILDOPTIONS='--with-cc=gcc-5 --with-m32' addons: @@ -157,9 +177,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" From 8f48f109cdcade6878d43dc25ede4ce873d423ee Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Fri, 26 Apr 2019 15:11:36 +0200 Subject: [PATCH 2/2] next try --- .travis.yml | 199 +++++++++++++++++++++++++--------------------------- 1 file changed, 97 insertions(+), 102 deletions(-) diff --git a/.travis.yml b/.travis.yml index c004b833a..2d7b69f6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,8 +38,6 @@ branches: install: - '[ "$OS" != "WIN" ] && sudo apt-get update -qq || true' - '[ "$OS" != "WIN" ] && sudo apt-get install valgrind || true' - - apt-cache search gcc | grep '^gcc-[0-9\.]* ' - - apt-cache search clang | grep compiler # The language is C and it will load the respective dependencies language: c @@ -60,116 +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 +# # Check source code format +# - env: BUILDOPTIONS='--format' +# addons: +# apt: +# packages: +# - astyle # Windows build with gcc - os: windows env: - - MSBUILD_PATH="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin" - OS=WIN - - BUILDOPTIONS='--all --make-options="-f makefile.mingw"' - script: - - export PATH=$MSBUILD_PATH:$PATH - - ./testme.sh ${BUILDOPTIONS} + - BUILDOPTIONS='--all' + before_script: + - chmod +x testme.sh # Windows build with msvc - os: windows env: - - MSBUILD_PATH="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin" - OS=WIN - - BUILDOPTIONS='--make=nmake.exe --make-options="-f makefile.msvc"' - script: - - export PATH=$MSBUILD_PATH:$PATH - - ./testme.sh ${BUILDOPTIONS} - - # 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' + - 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.