Files
secondo/bin/Selftest
2026-01-23 17:03:45 +08:00

62 lines
1.4 KiB
Plaintext

#
# SelfTest Startup Script
#
# 12.12.2006, M. Spiekermann
export SECONDO_PARAM_RTFlags="DEBUG:DemangleStackTrace,CMSG:Color,CTLG:SkipExamples,SI:PrintCounters,SMI:AutoRemoveLogs"
# On linux the variable below will use a less efficient
# malloc implementation which does error detection and aborts
# the process as soon as an error is recognized.
export MALLOC_CHECK_=2
if [ "$1" == "--valgrind" ]; then
shift
runner="valgrind --num-callers=25 --suppressions=vgs.txt --track-origins=yes $(which SecondoBDB) -test -e"
else
if [ "$1" == "--valgrindlc" ]; then
shift
runner="valgrind --num-callers=25 --leak-check=full --suppressions=vgs.txt $(which SecondoBDB) -test -e"
else
runner="$(which SecondoBDB) -test -e"
fi
fi
# check if nice command is present
runCmd=$runner
if [ $# -eq 0 ]; then
files=$(find tmp -iname "*.examples")
else
files=$*
fi
declare -i err=0
errFiles=""
for f in $files; do
$runCmd -i $f
rc=$?
if [ $rc -ne 0 ]; then
err=$[$err + 1]
errRC="($rc errors)"
if [ $rc -eq 139 ]; then
errRC="(aborted after receiving SIGSEGV)"
fi
if [ $rc -eq 134 ]; then
errRC="(aborted after receiving SIGABRT)"
fi
errFiles=$errFiles"\n $f $errRC"
fi
done
if [ $err -ne 0 ]; then
echo -e "\n\n Selftest failed! List of failing test files:"
echo -e "$errFiles"
echo -e "\n"
else
echo -e "Selftest finished successfully "
fi
exit $err