91 lines
2.2 KiB
Bash
Executable File
91 lines
2.2 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`
|
|
MAPFILE=`head -n1 $2`
|
|
test $? -eq 0 || exit 1
|
|
if test -z "$4"
|
|
then
|
|
test -n "$3" && mysim="mpirun -n $3 $mysim"
|
|
else
|
|
test -n "$5" && mysim="mpirun -n $5 $mysim"
|
|
fi
|
|
hdf5=""
|
|
tmplog=`mktemp -t ifemlogXXXXXX`
|
|
if test -n "$4"
|
|
then
|
|
hdf5="-hdf5 @CMAKE_BINARY_DIR@/Testing/$3"
|
|
rm -f @CMAKE_BINARY_DIR@/Testing/$3.hdf5
|
|
rm -f @CMAKE_BINARY_DIR@/Testing/$3_restart.hdf5
|
|
fi
|
|
$mysim $hdf5 $MAPFILE 2>&1 > $tmplog
|
|
retcode=$?
|
|
if test $retcode -ne 0
|
|
then
|
|
echo Application returned error code: $retcode >> @CMAKE_BINARY_DIR@/failed.log
|
|
echo Application returned error code: $retcode >> /dev/stderr
|
|
exit 1
|
|
fi
|
|
if test -n "$4"
|
|
then
|
|
$mysim $MAPFILE -restart @CMAKE_BINARY_DIR@/Testing/$3_restart.hdf5 $4 2>&1 > $tmplog
|
|
fi
|
|
appres=$?
|
|
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" $tmplog
|
|
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
|
|
echo Failed to find output: $line >> /dev/stderr
|
|
fi
|
|
done
|
|
|
|
if test $globres -eq 0 || test $appres -ne 0
|
|
then
|
|
cat $tmplog >> @CMAKE_BINARY_DIR@/failed.log
|
|
rm -f $tmplog
|
|
exit 1
|
|
fi
|
|
|
|
if [ "@IFEM_TEST_MEMCHECK@" == "1" ] || [ "@IFEM_TEST_MEMCHECK@" == "ON" ]
|
|
then
|
|
if ! grep -q "ERROR SUMMARY: 0 errors" @CMAKE_BINARY_DIR@/valgrindlog
|
|
then
|
|
cat $tmplog >> @CMAKE_BINARY_DIR@/failed.log
|
|
cat @CMAKE_BINARY_DIR@/valgrindlog >> @CMAKE_BINARY_DIR@/failed.log
|
|
rm -f $tmplog
|
|
rm -f @CMAKE_BINARY_DIR@/valgrindlog
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
rm -f $tmplog
|
|
rm -f @CMAKE_BINARY_DIR@/valgrindlog
|
|
exit 0
|