Files
IFEM/Apps/Common/scripts/iotest.sh.in

57 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
# This script performs a single IO regression test.
# 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 = File type to generate/test
# A IO regression test file is of the format:
# parameters to application
# blank line
# output from listing application
mysim=$1
test -f $2 || exit 1
cd `dirname $2`
MAPFILE=`head -n1 $2`
tmplog=`mktemp -t ifemlogXXXXXX`
tmpnew=`mktemp -t ifemlogXXXXXX`
tmpold=`mktemp -t ifemlogXXXXXX`
output=`mktemp -t ifemXXXXXX.$3`
if [ "$3" == "hdf5" ]
then
test -n "$4" && mysim="mpirun -n $4 $mysim"
$mysim $MAPFILE -hdf5 $output 2>&1 | tee $tmplog
else
$mysim $MAPFILE -vtf 0 -vtffile $output 2>&1 | tee $tmplog
fi
if test $? -ne 0
then
cat $tmplog >> @CMAKE_BINARY_DIR@/failed.log
exit 1
fi
tail -n +3 $2 > $tmpold
if [ "$3" == "hdf5" ]
then
@H5LS_COMMAND@ -r $output > $tmpnew
else
@VTFLS_COMMAND@ $output > $tmpnew
fi
diff -u $tmpold $tmpnew > $tmplog
res=$?
if test $res -ne 0
then
echo "Failure for $2" >> @CMAKE_BINARY_DIR@/failed.log
echo "======================" >> @CMAKE_BINARY_DIR@/failed.log
cat $tmplog >> @CMAKE_BINARY_DIR@/failed.log
cat $tmplog
fi
rm $tmpnew $tmpold $tmplog $output
exit $res