cmake tests

This commit is contained in:
Ophir Setter 2008-08-06 17:34:48 +00:00
parent 1f8c6ab083
commit bda0a00f0c
4 changed files with 158 additions and 86 deletions

2
.gitattributes vendored
View File

@ -3303,6 +3303,8 @@ Snap_rounding_2/doc_tex/Snap_rounding_2/sr1.gif -text svneol=unset#image/gif
Snap_rounding_2/doc_tex/Snap_rounding_2/sr1.pdf -text svneol=unset#application/pdf
Snap_rounding_2/doc_tex/Snap_rounding_2/sr1.ps -text svneol=unset#application/postscript
Snap_rounding_2/test/Snap_rounding_2/cgal_test eol=lf
Snap_rounding_2/test/Snap_rounding_2/cgal_test_base -text
Snap_rounding_2/test/Snap_rounding_2/cgal_test_with_cmake -text
Spatial_searching/demo/Spatial_searching/help/index.html svneol=native#text/html
Spatial_searching/demo/Spatial_searching/spatial_searching.vcproj eol=crlf
Spatial_searching/doc_tex/Spatial_searching/Fig1.gif -text svneol=unset#image/gif

View File

@ -1,87 +1,3 @@
#! /bin/sh
#! /bin/bash
# This is a script for the CGAL test suite. Such a script must obey
# the following rules:
#
# - the name of the script is cgal_test
# - for every target two one line messages are written to the file 'error.txt'
# the first one indicates if the compilation was successful
# the second one indicates if the execution was successful
# if one of the two was not successful, the line should start with 'ERROR:'
# - running the script should not require any user interaction
# - the script should clean up object files and executables
ERRORFILE=error.txt
CMP='diff -w'
#---------------------------------------------------------------------#
# compile <target>
#---------------------------------------------------------------------#
compile()
{
echo "Compiling $1 ... "
EXTRA_FLAGS="-DCGAL_SNAP_ROUNDING_TEST=$2"
export EXTRA_FLAGS
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
}
#---------------------------------------------------------------------#
# run <target>
#---------------------------------------------------------------------#
run()
{
data_dir="data"
datafiles="data/data*"
for DATAFILE in ${datafiles}
do
if [ -f $1 ] ; then
DATANAME=`basename $DATAFILE`
OUTPUTFILE=ProgramOutput.$1.$DATANAME.$PLATFORM
rm -f $OUTPUTFILE
COMMAND="./$1 $DATAFILE > ${data_dir}/out"
echo "Executing ./$1 $DATAFILE > ${data_dir}/out"
echo
if eval 2>&1 $COMMAND > $OUTPUTFILE ; then
echo " execution of $1 ${data_dir}/$DATATFILE > ${data_dir}/out succeeded" >> $ERRORFILE
if ${CMP} ${data_dir}/out "${data_dir}/gold_$DATANAME" ; then
echo " no differences between output and gold were found" >> $ERRORFILE
else
echo " ERROR: differences between output and gold were found" >> $ERRORFILE
echo " ERROR: differences between output and gold were found :" >> $OUTPUTFILE
diff ${data_dir}/out "${data_dir}/gold_$DATANAME" >> $OUTPUTFILE
fi
else
echo " ERROR: execution of $1 $DATAFILE $2 ${data_dir}/out failed" >> $ERRORFILE
fi
else
echo " ERROR: could not execute $1" >> $ERRORFILE
fi
done
}
#---------------------------------------------------------------------#
# remove the previous error file
#---------------------------------------------------------------------#
rm -f $ERRORFILE
touch $ERRORFILE
#---------------------------------------------------------------------#
# compile and run the tests
#---------------------------------------------------------------------#
compile test
run test
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null "
#EOF
./cgal_test_base

View File

@ -0,0 +1,150 @@
#! /bin/sh
# This is a script for the CGAL test suite. Such a script must obey
# the following rules:
#
# - the name of the script is cgal_test
# - for every target two one line messages are written to the file 'error.txt'
# the first one indicates if the compilation was successful
# the second one indicates if the execution was successful
# if one of the two was not successful, the line should start with 'ERROR:'
# - running the script should not require any user interaction
# - the script should clean up object files and executables
ERRORFILE=error.txt
CMP='diff -w'
if [ -z "${MAKE_CMD}" ]; then
MAKE_CMD=make
fi
#---------------------------------------------------------------------#
# configure
#---------------------------------------------------------------------#
configure()
{
echo "Configuring... "
if eval 'cmake "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \
-DCGAL_DIR="$CGAL_DIR" \
-DCGAL_CXX_FLAGS:STRING="$TESTSUITE_CXXFLAGS" \
-DCGAL_EXE_LINKER_FLAGS="$TESTSUITE_LDFLAGS" \
-DCMAKE_BUILD_TYPE=NOTFOUND \
.' ; then
echo " succesful configuration" >> $ERRORFILE
else
echo " ERROR: configuration" >> $ERRORFILE
fi
}
#---------------------------------------------------------------------#
# compile <target>
#---------------------------------------------------------------------#
compile()
{
echo "Compiling $1 ... "
EXTRA_FLAGS="-DCGAL_SNAP_ROUNDING_TEST=$2"
export EXTRA_FLAGS
if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then
export TESTSUITE_CXXFLAGS="-DCGAL_SNAP_ROUNDING_TEST=$2"
configure
if eval '${MAKE_CMD} VERBOSE=1 -fMakefile \
$1' ; then
echo " compilation of $1 succeeded" >> $ERRORFILE
else
echo " ERROR: compilation of $1 failed" >> $ERRORFILE
fi
else
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
fi
}
#---------------------------------------------------------------------#
# run <target>
#---------------------------------------------------------------------#
run()
{
data_dir="data"
datafiles="data/data*"
for DATAFILE in ${datafiles}
do
if [ -f $1 ] ; then
DATANAME=`basename $DATAFILE`
OUTPUTFILE=ProgramOutput.$1.$DATANAME.$PLATFORM
rm -f $OUTPUTFILE
COMMAND="./$1 $DATAFILE > ${data_dir}/out"
echo "Executing ./$1 $DATAFILE > ${data_dir}/out"
echo
if eval 2>&1 $COMMAND > $OUTPUTFILE ; then
echo " execution of $1 ${data_dir}/$DATATFILE > ${data_dir}/out succeeded" >> $ERRORFILE
if ${CMP} ${data_dir}/out "${data_dir}/gold_$DATANAME" ; then
echo " no differences between output and gold were found" >> $ERRORFILE
else
echo " ERROR: differences between output and gold were found" >> $ERRORFILE
echo " ERROR: differences between output and gold were found :" >> $OUTPUTFILE
diff ${data_dir}/out "${data_dir}/gold_$DATANAME" >> $OUTPUTFILE
fi
else
echo " ERROR: execution of $1 $DATAFILE $2 ${data_dir}/out failed" >> $ERRORFILE
fi
else
echo " ERROR: could not execute $1" >> $ERRORFILE
fi
done
}
#---------------------------------------------------------------------#
# remove the previous error file
#---------------------------------------------------------------------#
rm -f $ERRORFILE
touch $ERRORFILE
#---------------------------------------------------------------------#
# compile and run the tests
#---------------------------------------------------------------------#
if [ $# -ne 0 ] ; then
case $1 in
-cmake) TEST_WITH_CMAKE="TRUE" ;;
*)TEST_WITH_CMAKE="FALSE" ;;
esac
else
TEST_WITH_CMAKE="FALSE"
fi
echo "Run all tests."
if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then
configure
fi
compile test
run test
if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then
#
# The clean target generated by CMake under cygwin
# always fails for some reason
#
if ! ( uname | grep -q "CYGWIN" ) ; then
make -fMakefile clean
fi
else
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null "
fi
#EOF

View File

@ -0,0 +1,4 @@
#! /bin/bash
./cgal_test_base -cmake