cgal/Vanilla/cep_test

76 lines
1.9 KiB
Bash
Executable File

#! /bin/sh
# This is a script for running the Vanilla test suite.
#
# This script assumes that the CGAL_MAKEFILE environment variable is set
#---------------------------------------------------------------------#
# compile_and_run <target>
#---------------------------------------------------------------------#
compile_and_run()
{
echo "Compiling $1 ... "
if eval 'make CGAL_MAKEFILE=$CGAL_MAKEFILE $1'; then
echo " compilation of $1 succeeded"
else
echo " ERROR: compilation of $1 failed"
exit 1
fi
if [ -f $1 ] ; then
OUTPUTFILE=$1.out
rm -f $OUTPUTFILE
COMMAND="./$1"
#
# check for a .cmd file that contains command-line arguments for the program
#
if [ -f $1.cmd ] ; then
COMMAND="$COMMAND `cat $1.cmd`"
fi
#
# check for a .cin file that contains input to be provided to the program
#
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"
else
echo " ERROR: execution of $1 failed"
exit 1
fi
else
echo " ERROR: could not execute $1"
exit 1
fi
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null "
}
#---------------------------------------------------------------------#
# compile libVanill.a if it doesn't exist
#---------------------------------------------------------------------#
if [ ! -f lib/libVanill.a ]; then
make CGAL_MAKEFILE=$CGAL_MAKEFILE
fi
#---------------------------------------------------------------------#
# compile and run the tests
#---------------------------------------------------------------------#
cd test_suite
if [ $# -ne 0 ] ; then
for file in $* ; do
compile_and_run $file
done
else
compile_and_run vanilla_test1
compile_and_run vanilla_test2
compile_and_run vanilla_test3
fi