Browse Source

move valgrind build to own travis instance

testing under valgrind takes forever, so we start a separate build-job
Steffen Jaeckel 8 years ago
parent
commit
30948fc0e9
3 changed files with 66 additions and 13 deletions
  1. 4 0
      .travis.yml
  2. 36 13
      meta_builds.sh
  3. 26 0
      valgrind.sh

+ 4 - 0
.travis.yml

@@ -41,6 +41,10 @@ env:
     BUILDSCRIPT="meta_builds.sh"
     BUILDNAME="META_BUILS"
     BUILDOPTIONS="-DGMP_DESC"
+  - |
+    BUILDSCRIPT="valgrind.sh"
+    BUILDNAME="VALGRIND"
+    BUILDOPTIONS=" "
   - |
     BUILDSCRIPT="run.sh"
     BUILDNAME="STOCK"

+ 36 - 13
meta_builds.sh

@@ -17,22 +17,35 @@ function run_gcc() {
 
    make clean &>/dev/null
 
-   bash coverage.sh "COVERAGE" "$2" "$3" "$4" "$5"
+   echo
+   echo "Build for ASAN..."
 
-   make clean &>/dev/null
+   make CFLAGS="-fsanitize=address -fno-omit-frame-pointer -static-libasan $2 $CFLAGS $4" EXTRALIBS="-lasan $5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
+
+   echo
+   echo "Run ASAN tests with LTM..."
 
-   make CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
+   ASAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt || exit 1
 
-   valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test 1>test_std.txt 2> test_err.txt
+   if echo $2 | grep -q GMP ; then
+      echo
+      echo "Run ASAN tests with GMP..."
+
+      ASAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt || exit 1
+   fi
 
    make clean &>/dev/null
 
-   make CFLAGS="-fsanitize=address -fno-omit-frame-pointer -static-libasan $2 $CFLAGS $4" EXTRALIBS="-lasan $5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
-   ASAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt
-   ASAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt
+   echo
+   echo "Create code coverage"
+
+   bash coverage.sh "COVERAGE" "$2" "$3" "$4" "$5"
 }
 
 function run_clang() {
+   # output version
+   bash printinfo.sh
+
    scan_build=$(which scan-build)
    [ -z "$scan_build" ] && scan_build=$(find /usr/bin/ -name 'scan-build-*' | sort -nr | head -n1) || true
    [ -z "$scan_build" ] && { echo "couldn't find clang scan-build"; exit 1; } || echo "run $scan_build"
@@ -40,17 +53,27 @@ function run_clang() {
 
    make clean &>/dev/null
 
+   echo
+   echo "Build for UBSAN..."
+
    make LDFLAGS="-fsanitize=undefined" CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" all LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
-   UBSAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt
-   UBSAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt
-}
 
-# output version
-bash printinfo.sh
+   echo "Run UBSAN tests with LTM..."
+   UBSAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt || exit 1
+
+   if echo $2 | grep -q GMP ; then
+      echo
+      echo "Run UBSAN tests with GMP..."
+
+      UBSAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt || exit 1
+   fi
+}
 
 make clean &>/dev/null
 
-EXTRALIBS="$5 -lgmp"
+EXTRALIBS="$5"
+
+echo $2 | grep -q GMP && EXTRALIBS="$EXTRALIBS -lgmp"
 
 if [ -z "$(echo $CC | grep "clang")" ]; then
    run_gcc "$1" "$2" "$3" "$4" "$EXTRALIBS"

+ 26 - 0
valgrind.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+
+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
+
+# output version
+bash printinfo.sh
+
+make clean &>/dev/null
+
+echo "Build for valgrind..."
+
+make CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
+
+echo "Run tests with valgrind..."
+
+for i in `seq 1 10` ; do sleep 300 && echo "Valgrind tests in Progress..."; done &
+alive_pid=$!
+
+valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test 1>test_std.txt 2>test_err.txt || { kill $alive_pid; echo "Valgrind failed"; exit 1; }
+
+kill $alive_pid