automatically determine the number of parallel make jobs for the tests

This commit is contained in:
Steffen Jaeckel 2016-01-26 22:13:03 +01:00
parent da3ade0807
commit 892342c769

View File

@ -5,7 +5,14 @@ make clean 1>/dev/null 2>/dev/null
echo -n "building..."
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -f $3 all_test 1>gcc_1.txt 2>gcc_2.txt
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
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j$MAKE_JOBS -f $3 all_test 1>gcc_1.txt 2>gcc_2.txt
mret=$?
cnt=$(wc -l < gcc_2.txt)
# ignore 2 lines since ar prints to stderr instead of stdout and ar is called for