2018-07-18 14:26:38 +02:00
|
|
|
#!/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
|
|
|
|
|
|
2018-07-27 14:01:49 +02:00
|
|
|
test -f $2 || exit 1
|
|
|
|
|
|
2018-07-18 14:26:38 +02:00
|
|
|
cd `dirname $2`
|
|
|
|
|
MAPFILE=`head -n1 $2`
|
2018-07-25 10:51:03 +02:00
|
|
|
tmplog=`mktemp -t ifemlogXXXXXX`
|
2018-07-18 14:26:38 +02:00
|
|
|
tmpnew=`mktemp -t ifemlogXXXXXX`
|
|
|
|
|
tmpold=`mktemp -t ifemlogXXXXXX`
|
|
|
|
|
output=`mktemp -t ifemXXXXXX.$3`
|
|
|
|
|
if [ "$3" == "hdf5" ]
|
|
|
|
|
then
|
2018-07-25 10:53:27 +02:00
|
|
|
test -n "$4" && mysim="mpirun -n $4 $mysim"
|
2018-07-25 10:51:03 +02:00
|
|
|
$mysim $MAPFILE -hdf5 $output 2>&1 | tee $tmplog
|
2018-07-18 14:26:38 +02:00
|
|
|
else
|
2018-07-25 10:51:03 +02:00
|
|
|
$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
|
2018-07-18 14:26:38 +02:00
|
|
|
fi
|
|
|
|
|
tail -n +3 $2 > $tmpold
|
|
|
|
|
if [ "$3" == "hdf5" ]
|
|
|
|
|
then
|
|
|
|
|
@H5LS_COMMAND@ -r $output > $tmpnew
|
|
|
|
|
else
|
|
|
|
|
@VTFLS_COMMAND@ $output > $tmpnew
|
|
|
|
|
fi
|
|
|
|
|
|
2018-07-25 10:51:03 +02:00
|
|
|
diff -u $tmpold $tmpnew > $tmplog
|
2018-07-18 14:26:38 +02:00
|
|
|
res=$?
|
2018-07-25 10:51:03 +02:00
|
|
|
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
|
2018-07-18 14:26:38 +02:00
|
|
|
rm $tmpnew $tmpold $tmplog $output
|
|
|
|
|
|
|
|
|
|
exit $res
|