2017-10-18 11:29:51 +00:00
|
|
|
#!/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
|
|
|
|
|
2017-10-18 11:30:06 +00:00
|
|
|
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
|
|
|
|
|
2017-10-18 11:29:51 +00:00
|
|
|
# output version
|
2017-10-18 20:45:11 +00:00
|
|
|
bash .ci/printinfo.sh
|
2017-10-18 11:29:51 +00:00
|
|
|
|
|
|
|
make clean &>/dev/null
|
|
|
|
|
|
|
|
echo "Build for valgrind..."
|
|
|
|
|
2023-06-17 19:29:41 +00:00
|
|
|
# set DWARFv4 as debug format for clang, since it creates DWARFv5 as default which isn't support in old valgrind
|
|
|
|
[ -z "$(echo $CC | grep "clang")" ] || GFLAG="-gdwarf-4"
|
|
|
|
|
|
|
|
make -j$MAKE_JOBS CFLAGS="$2 $CFLAGS $4 $GFLAG" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
|
2017-10-18 11:29:51 +00:00
|
|
|
|
|
|
|
echo "Run tests with valgrind..."
|
|
|
|
|
|
|
|
for i in `seq 1 10` ; do sleep 300 && echo "Valgrind tests in Progress..."; done &
|
|
|
|
alive_pid=$!
|
|
|
|
|
2017-10-18 15:24:45 +00:00
|
|
|
valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test >test_std.txt 2> >(tee -a test_err.txt >&2) || { kill $alive_pid; echo "Valgrind failed"; exit 1; }
|
2017-10-18 11:29:51 +00:00
|
|
|
|
|
|
|
kill $alive_pid
|
2017-11-09 14:31:51 +00:00
|
|
|
|
|
|
|
# ref: $Format:%D$
|
|
|
|
# git commit: $Format:%H$
|
|
|
|
# commit time: $Format:%ai$
|