mirror of https://github.com/CGAL/cgal
154 lines
3.3 KiB
Bash
Executable File
154 lines
3.3 KiB
Bash
Executable File
#!/bin/sh
|
|
OUTPUTFILE=error.txt
|
|
DIFFOUTPUT=ErrorDiff
|
|
ERRORFILE=error.txt
|
|
|
|
use_purify=0
|
|
|
|
compile_and_run()
|
|
{
|
|
echo "Compiling $1 ... "
|
|
if eval 'make CGAL_MAKEFILE=$CGAL_MAKEFILE \
|
|
TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \
|
|
TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" $1' ; then
|
|
echo " compilation of $1 succeeded" >> $ERRORFILE
|
|
else
|
|
echo " ERROR: compilation of $1 failed" >> $ERRORFILE
|
|
fi
|
|
|
|
if [ -f $1 ] ; then
|
|
OUTPUTFILE=ProgramOutput.$1.$PLATFORM
|
|
rm -f $OUTPUTFILE
|
|
COMMAND="./$1"
|
|
if [ -f $1.cmd ] ; then
|
|
COMMAND="$COMMAND `cat $1.cmd`"
|
|
fi
|
|
if [ -f $1.cin ] ; then
|
|
COMMAND="cat $1.cin | $COMMAND"
|
|
fi
|
|
echo "Executing $1 ... "
|
|
echo
|
|
if eval 2>&1 $COMMAND > $OUTPUTFILE ; then
|
|
echo " execution of $1 succeeded" >> $ERRORFILE
|
|
else
|
|
echo " ERROR: execution of $1 failed" >> $ERRORFILE
|
|
fi
|
|
else
|
|
echo " ERROR: could not execute $1" >> $ERRORFILE
|
|
fi
|
|
|
|
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE $1.clean > /dev/null "
|
|
}
|
|
|
|
|
|
one_run()
|
|
{
|
|
goodresult=RESULT/${base}/`basename ${datafile}`
|
|
if "./${base}" < ${datafile} >output
|
|
then
|
|
if [ -r ${goodresult} ]
|
|
then
|
|
if diff -b output ${goodresult} > diffoutput
|
|
then
|
|
succes=ja
|
|
else
|
|
succes=nee
|
|
echo "input: ${datafile}" >> ProgramOutput.${base}.$PLATFORM
|
|
cat diffoutput >> ProgramOutput.${base}.$PLATFORM
|
|
fi
|
|
else
|
|
succes=ja
|
|
fi
|
|
else
|
|
succes=nee
|
|
explanation="non zero return code"
|
|
fi
|
|
if [ ${succes} = ja ]
|
|
then
|
|
echo "succes: ${base} < ${datafile}">> $OUTPUTFILE
|
|
else
|
|
echo "ERROR: ${base} < ${datafile}" >> $OUTPUTFILE
|
|
echo " " "$explanation" >> $OUTPUTFILE
|
|
fi
|
|
}
|
|
|
|
make_and_execute()
|
|
{
|
|
if [ -r ii_files/${base}.ii.$1 ]
|
|
then
|
|
mv ii_files/${base}.ii.$1 ii_files/${base}.ii
|
|
fi
|
|
EXTRA_FLAGS="-DTESTR=$1"
|
|
export EXTRA_FLAGS
|
|
if make ${base} # 2>/dev/null
|
|
then
|
|
echo "succes: compiling ${file} with TESTR=$1" >> $OUTPUTFILE
|
|
if [ -r ii_files/${base}.ii ]
|
|
then
|
|
mv ii_files/${base}.ii ii_files/${base}.ii.$1
|
|
fi
|
|
if [ ${use_purify} -eq 1 ]
|
|
then
|
|
purify -log-file="%v.$1.%p.plog" ${base}
|
|
mv ${base}.pure ${base}
|
|
fi
|
|
for datafile in ${datafiles}
|
|
do
|
|
if [ -r ${datafile} ]
|
|
then
|
|
one_run
|
|
fi
|
|
done
|
|
else
|
|
echo "ERROR: compiling ${file} with TESTR=$1" >> $OUTPUTFILE
|
|
fi
|
|
make ${base}.clean
|
|
}
|
|
|
|
echo ${CGAL_LIB_DIR}
|
|
|
|
rm -f $OUTPUTFILE
|
|
touch $OUTPUTFILE
|
|
rm -f $DIFFOUTPUT
|
|
touch $DIFFOUTPUT
|
|
|
|
if [ $# -ne 0 ]
|
|
then
|
|
sourcefiles="$*"
|
|
else
|
|
sourcefiles="*.C"
|
|
fi
|
|
|
|
|
|
for file in ${sourcefiles}
|
|
do
|
|
base=`basename ${file} .C`
|
|
rm -f ProgramOutput.${base}.$PLATFORM
|
|
touch -f ProgramOutput.${base}.$PLATFORM
|
|
xdatafiles="DATA/${base}.x.*"
|
|
# idatafiles="DATA/${base}.i.*"
|
|
# ixdatafiles="DATA/${base}.ix.*"
|
|
# datafiles="${idatafiles} ${ixdatafiles}"
|
|
# datafiles="${ixdatafiles}"
|
|
if [ -d "DATA/${base}" ]
|
|
then
|
|
datafiles="DATA/${base}/ix.*"
|
|
else
|
|
datafiles=""
|
|
fi
|
|
if [ "${datafiles}" ]
|
|
then
|
|
echo "TESTR=1" >> ProgramOutput.${base}.$PLATFORM
|
|
make_and_execute 1;
|
|
fi
|
|
# datafiles="${xdatafiles} ${ixdatafiles}"
|
|
if [ "${datafiles}" ]
|
|
then
|
|
echo "TESTR=5" >> ProgramOutput.${base}.$PLATFORM
|
|
make_and_execute 5;
|
|
else
|
|
compile_and_run ${base}
|
|
fi
|
|
done
|
|
|