cgal/Polyhedron/demo/Polyhedron/cgal_test_with_cmake

184 lines
5.1 KiB
Bash
Executable File

#! /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_with_cmake
# - 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
DO_RUN=
if [ -z "${MAKE_CMD}" ]; then
MAKE_CMD=make
fi
NEED_CLEAN=
#---------------------------------------------------------------------#
# configure
#---------------------------------------------------------------------#
configure()
{
echo "Configuring... "
if eval 'cmake "$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \
-DCGAL_DIR="$CGAL_DIR" \
.' ; then
echo " successful configuration" >> $ERRORFILE
else
echo " ERROR: configuration" >> $ERRORFILE
fi
}
#---------------------------------------------------------------------#
# compile_and_run <target>
#---------------------------------------------------------------------#
compile_and_run()
{
echo "Compiling $1 ... "
SUCCES="y"
if eval '${MAKE_CMD} VERBOSE=ON -fMakefile $1' ; then
echo " successful compilation of $1" >> $ERRORFILE
else
echo " ERROR: compilation of $1" >> $ERRORFILE
SUCCES=""
fi
if [ -n "$DO_RUN" ] ; then
if [ -n "${SUCCES}" ] ; 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
ulimit -t 3600 2> /dev/null
if eval $COMMAND > $OUTPUTFILE 2>&1 ; then
echo " successful execution of $1" >> $ERRORFILE
else
echo " ERROR: execution of $1" >> $ERRORFILE
fi
else
echo " ERROR: not executed $1" >> $ERRORFILE
fi
fi
}
#---------------------------------------------------------------------#
# remove the previous error file
#---------------------------------------------------------------------#
rm -f $ERRORFILE
touch $ERRORFILE
#---------------------------------------------------------------------#
# configure, compile and run the tests
#---------------------------------------------------------------------#
configure
if [ $# -ne 0 ] ; then
for file in $* ; do
compile_and_run $file
done
else
echo "Run all tests."
for target in \
Polyhedron_3 \
camera_positions_plugin \
convex_hull_plugin \
corefinement_plugin \
cut_plugin \
demo_framework \
edit_polyhedron_plugin \
gocad_plugin \
inside_out_plugin \
intersection_plugin \
io_implicit_function_plugin \
jet_fitting_plugin \
join_polyhedra_plugin \
kernel_plugin \
mesh_3_plugin \
mesh_segmentation_plugin \
mesh_simplification_plugin \
nef_io_plugin \
nef_plugin \
normal_estimation_plugin \
off_plugin \
off_to_nef_plugin \
off_to_xyz_plugin \
orient_soup_plugin \
parameterization_plugin \
pca_plugin \
point_dialog \
point_inside_polyhedron_plugin \
point_set_average_spacing_plugin \
point_set_outliers_removal_plugin \
point_set_simplification_plugin \
point_set_smoothing_plugin \
poisson_plugin \
polyhedron_slicer_plugin \
polyhedron_stitching_plugin \
polylines_io_plugin \
remeshing_plugin \
scene_basic_objects \
scene_c2t3_item \
scene_combinatorial_map_item \
scene_edit_polyhedron_item \
scene_implicit_function_item \
scene_nef_polyhedron_item \
scene_points_with_normal_item \
scene_polygon_soup_item \
scene_polyhedron_item \
scene_polyhedron_item_decorator \
scene_polyhedron_item_k_ring_selection \
scene_polyhedron_selection_item \
scene_polyhedron_transform_item \
scene_polylines_item \
scene_textured_polyhedron_item \
selection_io_plugin \
selection_plugin \
self_intersection_plugin \
stl_plugin \
subdivision_methods_plugin \
transform_polyhedron_plugin \
triangulate_facets_plugin \
trivial_plugin \
xyz_plugin \
p_klein_function_plugin \
p_sphere_function_plugin \
p_tanglecube_function_plugin \
advancing_front_plugin \
all
do
if ${MAKE_CMD} -f Makefile help | grep "$target" > /dev/null; then
compile_and_run "$target"
NEED_CLEAN=y
fi
done
fi
#
# The clean target generated by CMake under cygwin
# always fails for some reason
#
if [ -n "${NEED_CLEAN}" ]; then
if ! ( uname | grep -q "CYGWIN" ) ; then
${MAKE_CMD} -fMakefile clean
fi
fi