Browse Source

add meta_builds.sh

This fixes #267 #268 #269
Steffen Jaeckel 8 years ago
parent
commit
2dad6d30bf
2 changed files with 66 additions and 20 deletions
  1. 4 20
      .travis.yml
  2. 62 0
      meta_builds.sh

+ 4 - 20
.travis.yml

@@ -13,7 +13,7 @@ addons:
 
 install:
     - sudo apt-get update -qq
-    - sudo apt-get install libtommath-dev
+    - sudo apt-get install libtommath-dev libgmp-dev
 
 before_script:
   - gem install coveralls-lcov
@@ -38,17 +38,9 @@ script:
   - bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile.shared V=1" "-DUSE_TFM -DTFM_DESC" "-ltfm"
 env:
   - |
-    BUILDSCRIPT="check_source.sh"
-    BUILDNAME="CHECK_SOURCES"
-    BUILDOPTIONS=" "
-  - |
-    BUILDSCRIPT="scan_build.sh"
-    BUILDNAME="SCAN_BUILD"
-    BUILDOPTIONS=" "
-  - |
-    BUILDSCRIPT="coverage.sh"
-    BUILDNAME="COVERAGE"
-    BUILDOPTIONS=" "
+    BUILDSCRIPT="meta_builds.sh"
+    BUILDNAME="META_BUILS"
+    BUILDOPTIONS="-DGMP_DESC"
   - |
     BUILDSCRIPT="run.sh"
     BUILDNAME="STOCK"
@@ -113,14 +105,6 @@ env:
     BUILDSCRIPT="run.sh"
     BUILDNAME="CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE+PTHREAD"
     BUILDOPTIONS="-DLTC_CLEAN_STACK -DLTC_NO_TABLES -DLTC_SMALL_CODE -DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING -DLTC_PTHREAD"
-  - |
-    BUILDSCRIPT="testbuild.sh"
-    BUILDNAME="NOTEST"
-    BUILDOPTIONS="-DLTC_NO_TEST"
-  - |
-    BUILDSCRIPT="testbuild.sh"
-    BUILDNAME="NOFILE"
-    BUILDOPTIONS="-DLTC_NO_FILE"
 
 after_failure:
   - cat test_std.txt

+ 62 - 0
meta_builds.sh

@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# This builds different stuff depending on the compiler:
+# gcc - valgrind, coverage
+# clang - asan, ubsan, scan-build
+# both - the two testbuild's NOTEST and NOFILE
+
+set -e
+
+if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
+   echo "only run $0 for the regular makefile, early exit success"
+   exit 0
+fi
+
+function run_gcc() {
+   bash check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5"
+
+   make clean &>/dev/null
+
+   bash coverage.sh "COVERAGE" "$2" "$3" "$4" "$5"
+
+   make clean &>/dev/null
+
+   make CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" test LTC_DEBUG=2
+
+   valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test
+
+   make clean &>/dev/null
+
+   make CFLAGS="-fsanitize=address -fno-omit-frame-pointer -static-libasan $2 $CFLAGS $4" EXTRALIBS="-lasan $5" test LTC_DEBUG=1
+   ASAN_OPTIONS=verbosity=1 ./test t ltm
+   ASAN_OPTIONS=verbosity=1 ./test t gmp
+}
+
+function run_clang() {
+   bash scan_build.sh "SCAN_BUILD" "$2" "$3" "$4" "$5"
+
+   make clean &>/dev/null
+
+   make LDFLAGS="-fsanitize=undefined" CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" all LTC_DEBUG=1
+   UBSAN_OPTIONS=verbosity=1 ./test t ltm
+   UBSAN_OPTIONS=verbosity=1 ./test t gmp
+}
+
+
+make clean &>/dev/null
+
+EXTRALIBS="$5 -lgmp"
+
+if [ -z "$(echo $CC | grep "clang")" ]; then
+   run_gcc "$1" "$2" "$3" "$4" "$EXTRALIBS"
+else
+   run_clang "$1" "$2" "$3" "$4" "$EXTRALIBS"
+fi
+
+make clean &>/dev/null
+
+bash testbuild.sh "NOTEST" "-DLTC_NO_TEST" "$3" "$4" "$5"
+
+make clean &>/dev/null
+
+bash testbuild.sh "NOFILE" "-DLTC_NO_FILE" "$3" "$4" "$5"