Fixed bugs in cgal_test_with_cmake when executed by CGAL test suite:

* cgal_test_with_cmake does not work when $MAKE_CMD environment variable exists.
* cgal_test_with_cmake returns an error when an application cannot be compiled.
This commit is contained in:
Laurent Saboret
2009-06-24 13:36:01 +00:00
parent dc2c4ebf70
commit 92e5ef0499
7 changed files with 297 additions and 129 deletions
@@ -4,7 +4,7 @@
# This script is a modified version of cgal_test_with_cmake which:
# - is cross-platform Unix/make and Cygwin/VisualC++
# - concats all log files to cgal_test_with_cmake.log
# - does not clean up object files and executables (too slow when called by developer)
# - does not clean up object files and executables if $NEED_CLEAN==n
#
# This is a script for the CGAL test suite. Such a script must obey
@@ -16,22 +16,23 @@
# 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=y
if [ -z "${MAKE_CMD}" ]; then
case "$CMAKE_GENERATOR" in
Visual* ) # if VisualC++
MAKE_CMD="devenv.com *.sln /Build Release /Project"
MAKE_CLEAN_CMD="devenv.com *.sln /Clean Release"
;;
* ) # if make
MAKE_CMD="make -fMakefile"
MAKE_CLEAN_CMD="make -fMakefile clean"
;;
esac
MAKE_CMD=make
fi
NEED_CLEAN=
case "$CMAKE_GENERATOR" in
Visual* ) # if VisualC++
MAKE_CMD="devenv.com *.sln /Build Release /Project"
MAKE_CLEAN_CMD="devenv.com *.sln /Clean Release"
;;
* ) # if make
MAKE_CMD="${MAKE_CMD} -fMakefile"
MAKE_CLEAN_CMD="${MAKE_CMD} clean"
;;
esac
#---------------------------------------------------------------------#
# configure
@@ -57,11 +58,35 @@ configure()
find_executable()
{
PARAM_APPLICATION=""
[ -f ./release/$1.exe ] && PARAM_APPLICATION="./release/$1.exe"
[ -f ./x64/release/$1.exe ] && PARAM_APPLICATION="./x64/release/$1.exe"
[ -x ./$1 ] && PARAM_APPLICATION="./$1"
echo "$PARAM_APPLICATION"
PARAM_APPLICATION=""
[ -f ./release/$1.exe ] && PARAM_APPLICATION="./release/$1.exe"
[ -f ./x64/release/$1.exe ] && PARAM_APPLICATION="./x64/release/$1.exe"
[ -x ./$1 ] && PARAM_APPLICATION="./$1"
echo "$PARAM_APPLICATION"
}
#---------------------------------------------------------------------#
# can_compile <target>
#---------------------------------------------------------------------#
can_compile()
{
case "$CMAKE_GENERATOR" in
Visual* ) # if VisualC++
if [ -f "$1.vcproj" ]; then
echo y
else
echo n
fi
;;
* ) # if make
if ${MAKE_CMD} help | grep "$1" > /dev/null; then
echo y
else
echo n
fi
;;
esac
}
#---------------------------------------------------------------------#
@@ -136,31 +161,49 @@ if [ $# -ne 0 ] ; then
done
else
echo "Run all tests."
compile_and_run average_spacing_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run grid_simplification_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run jet_smoothing_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run normal_estimation
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run normals_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run property_map
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run random_simplification_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run read_write_xyz_point_set_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
compile_and_run remove_outliers_example
NEED_CLEAN= # Do *not* call make clean (too slow when called by developer)
if [ `can_compile average_spacing_example` == "y" ]; then
compile_and_run average_spacing_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile grid_simplification_example` == "y" ]; then
compile_and_run grid_simplification_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile jet_smoothing_example` == "y" ]; then
compile_and_run jet_smoothing_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile normal_estimation` == "y" ]; then
compile_and_run normal_estimation
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile normals_example` == "y" ]; then
compile_and_run normals_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile property_map` == "y" ]; then
compile_and_run property_map
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile random_simplification_example` == "y" ]; then
compile_and_run random_simplification_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile read_write_xyz_point_set_example` == "y" ]; then
compile_and_run read_write_xyz_point_set_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
if [ `can_compile remove_outliers_example` == "y" ]; then
compile_and_run remove_outliers_example
[ -z "${NEED_CLEAN}" ] && NEED_CLEAN=y
fi
fi
#
# The clean target generated by CMake under cygwin
# always fails for some reason
#
if [ -n "${NEED_CLEAN}" ]; then
if [ "${NEED_CLEAN}" == "y" ]; then
if ! ( uname | grep -q "CYGWIN" ) ; then
${MAKE_CLEAN_CMD}
fi