enable parallel builds

This commit is contained in:
Steffen Jaeckel 2017-10-18 13:30:06 +02:00
parent 30948fc0e9
commit 29c640f7e1
3 changed files with 26 additions and 5 deletions

View File

@ -12,6 +12,13 @@ if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
exit 0 exit 0
fi fi
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
function run_gcc() { function run_gcc() {
bash check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5" bash check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5"
@ -20,7 +27,7 @@ function run_gcc() {
echo echo
echo "Build for ASAN..." echo "Build for ASAN..."
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 make -j$MAKE_JOBS 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
echo "Run ASAN tests with LTM..." echo "Run ASAN tests with LTM..."
@ -49,14 +56,14 @@ function run_clang() {
scan_build=$(which scan-build) scan_build=$(which scan-build)
[ -z "$scan_build" ] && scan_build=$(find /usr/bin/ -name 'scan-build-*' | sort -nr | head -n1) || true [ -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" [ -z "$scan_build" ] && { echo "couldn't find clang scan-build"; exit 1; } || echo "run $scan_build"
$scan_build --status-bugs make all CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" $scan_build --status-bugs make -j$MAKE_JOBS all CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5"
make clean &>/dev/null make clean &>/dev/null
echo echo
echo "Build for UBSAN..." 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 make -j$MAKE_JOBS LDFLAGS="-fsanitize=undefined" CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" all LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
echo "Run UBSAN tests with LTM..." echo "Run UBSAN tests with LTM..."
UBSAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt || exit 1 UBSAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt || exit 1

View File

@ -3,11 +3,18 @@
# output version # output version
bash printinfo.sh bash printinfo.sh
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
echo "$1 (Build Only, $2, $3)..." echo "$1 (Build Only, $2, $3)..."
make clean 1>/dev/null 2>/dev/null make clean 1>/dev/null 2>/dev/null
echo -n "building..." echo -n "building..."
touch testok.txt touch testok.txt
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -f $3 test tv_gen 1>gcc_1.txt 2>gcc_2.txt || (echo "build $1 failed see gcc_2.txt for more information" && cat gcc_2.txt && rm -f testok.txt && exit 1) CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j$MAKE_JOBS -f $3 test tv_gen 1>gcc_1.txt 2>gcc_2.txt || (echo "build $1 failed see gcc_2.txt for more information" && cat gcc_2.txt && rm -f testok.txt && exit 1)
if find testok.txt -type f 1>/dev/null 2>/dev/null ; then if find testok.txt -type f 1>/dev/null 2>/dev/null ; then
echo "successful" echo "successful"
exit 0 exit 0

View File

@ -7,6 +7,13 @@ if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
exit 0 exit 0
fi fi
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
# output version # output version
bash printinfo.sh bash printinfo.sh
@ -14,7 +21,7 @@ make clean &>/dev/null
echo "Build for valgrind..." echo "Build for valgrind..."
make CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt make -j$MAKE_JOBS CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
echo "Run tests with valgrind..." echo "Run tests with valgrind..."