From cb34fa15d93e000cf61c2f716dbb40ca760ea37d Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Thu, 11 Apr 2002 08:08:16 +0000 Subject: [PATCH] 1st revision - for ms, cygwin --- .../test/Planar_map_IO/cgal_test_ms | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100755 Packages/Planar_map/test/Planar_map_IO/cgal_test_ms diff --git a/Packages/Planar_map/test/Planar_map_IO/cgal_test_ms b/Packages/Planar_map/test/Planar_map_IO/cgal_test_ms new file mode 100755 index 00000000000..f2a8c0bbbf9 --- /dev/null +++ b/Packages/Planar_map/test/Planar_map_IO/cgal_test_ms @@ -0,0 +1,128 @@ +#! /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 + +#---------------------------------------------------------------------# +# compile_and_run +#---------------------------------------------------------------------# + +compile_and_run() +{ + EXTRA_FLAGS="-DCGAL_PM_TEST_POINT_LOCATION=$2 -DCGAL_PM_TEST_TRAITS=$3 \ + $EXTRA_FLAGS " + export EXTRA_FLAGS + + echo "Compiling $1 with point location $2 and traits $3... " + if eval 'nmake -nologo -f makefile.mak CGAL_MAKEFILE=$CGAL_MAKEFILE \ + TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \ + TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" $1.exe' ; then + echo " compilation of $1 succeeded" >> $ERRORFILE + run $1 $2 $3 + + else + echo " ERROR: compilation of $1 failed" >> $ERRORFILE + fi + + eval "2>&1 nmake -nologo -f makefile.mak CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null" +} + +run() +{ + #if [ $3 -eq $CGAL_SEGMENT_TRAITS -o $3 -eq $CGAL_SEGMENT_LEDA_TRAITS ] ; then + # datafiles="DATA/segments/*" + #elif [ $3 -eq $CGAL_POLYLINE_TRAITS -o $3 -eq $CGAL_POLYLINE_LEDA_TRAITS ]; then + # datafiles="DATA/polylines/*" + #fi + + datafiles="DATA/*" + + if [ $3 -eq $CGAL_SEGMENT_TRAITS ] ; then + iofiles="DATA/exact_io/" + SUFFIO="exact_io" + elif [ $3 -eq $CGAL_SEGMENT_LEDA_TRAITS ] ; then + iofiles="DATA/leda_io/" + SUFFIO="leda_io" + fi + + for DATAFILE in ${datafiles} + do + + if [ -d $DATAFILE ]; then +# echo " $DATEFILE is a directory" + continue + fi + + IOFILE="${iofiles}`basename ${DATAFILE}`_${SUFFIO}" + echo $IOFILE + + if [ -f $1 ] ; then + rm -f pm.txt + + DATANAME=`basename $DATAFILE` + IONAME=`basename $IOFILE` + + + #if [ $REVERSE="reverse" ] ; then + # OUTPUTFILE=ProgramOutput.$3.$1.$DATANAME.$REVERSE.$PLATFORM.$2 + #else + OUTPUTFILE=ProgramOutput.$3.$1.$DATANAME.$PLATFORM.$2 + #fi + rm -f $OUTPUTFILE + COMMAND="./$1 $IOFILE $DATAFILE" + echo "Executing $COMMAND" + echo + if eval $COMMAND > $OUTPUTFILE 2>&1 ; then + echo " execution of $1 $DATAFILE succeeded" >> $ERRORFILE + else + echo " ERROR: execution of $1 $DATAFILE failed" >> $ERRORFILE + fi + else + echo " ERROR: could not execute $1 $DATAFILE " >> $ERRORFILE + fi + done + +} + + +#---------------------------------------------------------------------# +# remove the previous error file +#---------------------------------------------------------------------# + +rm -f $ERRORFILE +touch $ERRORFILE + +#---------------------------------------------------------------------# +# compile and run the tests +#---------------------------------------------------------------------# + +if [ $# -ne 0 ] ; then + for file in $* ; do + compile_and_run $file + done +else + CGAL_SEGMENT_TRAITS=1 + CGAL_SEGMENT_LEDA_TRAITS=2 + + #CGAL_POLYLINE_TRAITS=11 + #CGAL_POLYLINE_LEDA_TRAITS=12 + + CGAL_PM_TEST_TRAITS=$CGAL_SEGMENT_TRAITS + (compile_and_run test 1 $CGAL_PM_TEST_TRAITS) + (compile_and_run test 2 $CGAL_PM_TEST_TRAITS) + (compile_and_run test 3 $CGAL_PM_TEST_TRAITS) + CGAL_PM_TEST_TRAITS=$CGAL_SEGMENT_LEDA_TRAITS + (compile_and_run test 1 $CGAL_PM_TEST_TRAITS) + (compile_and_run test 2 $CGAL_PM_TEST_TRAITS) + (compile_and_run test 3 $CGAL_PM_TEST_TRAITS) +fi