Files
IFEM/Apps/Common/scripts/regtest.sh.in
akva 15fccaa7e5 added: option to run regression tests through valgrind
while ctest does support it through a -D, it does not integrate
nicely with the rest of the system

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@2404 e10b68d5-8a6e-419e-a041-bce267b0401d
2015-07-10 22:03:23 +02:00

64 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# This script performs a single regression.
# It is used by the 'make test' target in the buildsystems
# Usually you should use 'make test' rather than calling this script directly
#
# Parameters: $1 = Application binary
# $2 = Regression test file
# $3 = If given, number of MPI nodes
# A regression test file is of the format:
# parameters to application
# blank line
# output from program to compare to
mysim=$1
cd `dirname $2`
readarray < $2
test -n "$3" && mysim="$PETSC_DIR/bin/petscmpiexec -n $3 $mysim"
$mysim $MAPFILE 2>&1 > templog
globres=1
IFS=$'\n'
for line in `cat $2`
do
test -z "$line" && continue
echo "$line" | grep -q ".inp" && continue
result=0
if grep -q "$line" templog
then result=1
fi
if test $result -eq 0
then
if test $globres -eq 1
then
echo "-------- $2 --------" >> @CMAKE_BINARY_DIR@/failed.log
fi
globres=0
echo Failed to find output: $line >> @CMAKE_BINARY_DIR@/failed.log
fi
done
if test $globres -eq 0
then
cat templog >> @CMAKE_BINARY_DIR@/failed.log
rm templog
exit 1
fi
if [ "@IFEM_TEST_MEMCHECK@" == "1" ] || [ "@IFEM_TEST_MEMCHECK@" == "ON" ]
then
if ! grep -q "ERROR SUMMARY: 0 errors" valgrindlog
then
cat templog >> @CMAKE_BINARY_DIR@/failed.log
cat valgrindlog >> @CMAKE_BINARY_DIR@/failed.log
rm templog
rm valgrindlog
exit 1
fi
fi
rm templog
rm -f valgrindlog
exit 0