we now use ctest for testing + extra clean up
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#option :
|
||||
#options:
|
||||
# GIT_REPO the path to the Git repository, default is the current working directory
|
||||
# DESTINATION the path where the release is created, default is /tmp
|
||||
# PUBLIC=[ON/OFF] indicates if a public release should be built, default is OFF
|
||||
@@ -201,8 +201,7 @@ foreach(manpage ${MANPAGES})
|
||||
configure_file(${GIT_REPO}/Installation/${manpage} ${release_dir}/${manpage} @ONLY)
|
||||
endforeach()
|
||||
|
||||
# make an extra copy of examples and demos for the testsuite and generate
|
||||
# create_cgal_test_with_cmake for tests, demos, and examples
|
||||
# make an extra copy of examples and demos for the testsuite
|
||||
if (TESTSUITE)
|
||||
SET(FMT_ARG "format:SCM branch:%n%H %d%n%nShort log from master:%n")
|
||||
execute_process(
|
||||
@@ -221,23 +220,6 @@ if (TESTSUITE)
|
||||
#append result in .scm-branch
|
||||
file(APPEND ${release_dir}/.scm-branch "${OUT_VAR}")
|
||||
|
||||
file(GLOB tests RELATIVE "${release_dir}/test" "${release_dir}/test/*")
|
||||
foreach(d ${tests})
|
||||
if(IS_DIRECTORY "${release_dir}/test/${d}")
|
||||
if(NOT EXISTS "${release_dir}/test/${d}/cgal_test_with_cmake")
|
||||
execute_process(
|
||||
COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake
|
||||
WORKING_DIRECTORY "${release_dir}/test/${d}"
|
||||
RESULT_VARIABLE RESULT_VAR
|
||||
OUTPUT_VARIABLE OUT_VAR
|
||||
)
|
||||
if(NOT "${RESULT_VAR}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Error while running create_cgal_test_with_cmake in ${release_dir}/test/${d}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(MAKE_DIRECTORY "${release_dir}/tmp")
|
||||
#copy demo/PKG to test/PKG_Demo
|
||||
file(GLOB demos RELATIVE "${release_dir}/demo" "${release_dir}/demo/*")
|
||||
@@ -250,17 +232,6 @@ if (TESTSUITE)
|
||||
#do the copy in 2 pass since we cannot specify the target name
|
||||
file(COPY "${release_dir}/demo/${d}" DESTINATION "${release_dir}/tmp")
|
||||
file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Demo")
|
||||
if(NOT EXISTS "${release_dir}/test/${d}_Demo/cgal_test_with_cmake")
|
||||
execute_process(
|
||||
COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake --no-run
|
||||
WORKING_DIRECTORY "${release_dir}/test/${d}_Demo"
|
||||
RESULT_VARIABLE RESULT_VAR
|
||||
OUTPUT_VARIABLE OUT_VAR
|
||||
)
|
||||
if(NOT "${RESULT_VAR}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Error while running create_cgal_test_with_cmake in ${release_dir}/test/${d}_Demo")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -271,17 +242,6 @@ if (TESTSUITE)
|
||||
#do the copy in 2 pass since we cannot specify the target name
|
||||
file(COPY "${release_dir}/examples/${d}" DESTINATION "${release_dir}/tmp")
|
||||
file(RENAME "${release_dir}/tmp/${d}" "${release_dir}/test/${d}_Examples")
|
||||
if(NOT EXISTS "${release_dir}/test/${d}_Examples/cgal_test_with_cmake")
|
||||
execute_process(
|
||||
COMMAND ${BASH} ${GIT_REPO}/Scripts/developer_scripts/create_cgal_test_with_cmake
|
||||
WORKING_DIRECTORY "${release_dir}/test/${d}_Examples"
|
||||
RESULT_VARIABLE RESULT_VAR
|
||||
OUTPUT_VARIABLE OUT_VAR
|
||||
)
|
||||
if(NOT "${RESULT_VAR}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Error while running create_cgal_test_with_cmake in ${release_dir}/test/${d}_Examples")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
file(REMOVE_RECURSE "${release_dir}/tmp")
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
dir=${PWD%/*}
|
||||
dir=${dir##*/}
|
||||
|
||||
if [ "x${dir}" = "xdemo" ]; then
|
||||
in_demo="--no-run"
|
||||
fi
|
||||
|
||||
[ ! -e CMakeLists.txt ] && echo "No CMakeLists.txt in current directory, creating it" && cgal_create_cmake_script test
|
||||
|
||||
# If there is already a cgal_test_with_cmake script in the current directory, execute it.
|
||||
[ ! -x cgal_test_with_cmake ] && echo "No cgal_test_with_cmake in current directory, creating it" && create_cgal_test_with_cmake ${in_demo}
|
||||
|
||||
./cgal_test_with_cmake $@
|
||||
cat error.txt
|
||||
@@ -1,214 +0,0 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# =============================================================================
|
||||
# $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Scripts/developer_scripts/create_cgal_test $
|
||||
# $Id: create_cgal_test 36975 2007-03-09 22:52:40Z spion $
|
||||
#
|
||||
# author(s) : Wieger Wesselink, Geert-Jan Giezeman
|
||||
#
|
||||
# coordinator : Utrecht University
|
||||
# =============================================================================
|
||||
#
|
||||
# This script creates a cgal_test_with_cmake script with entries for files with a common
|
||||
# C++ file extension (as mentioned in the g++ man page) in the current test directory.
|
||||
|
||||
VERSION=1.1
|
||||
|
||||
DO_RUN="y"
|
||||
|
||||
usage()
|
||||
{
|
||||
echo 'Usage : create_cgal_test [--no-run]'
|
||||
echo
|
||||
echo ' --help : prints this usage help'
|
||||
echo ' --no-run : produces a cgal_test_with_cmake script that only does compilation, no execution'
|
||||
exit
|
||||
}
|
||||
|
||||
while [ $1 ]; do
|
||||
case "$1" in
|
||||
-h|-help|--h|--help)
|
||||
usage;
|
||||
;;
|
||||
--no-run)
|
||||
DO_RUN=""
|
||||
shift; continue
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
header()
|
||||
{
|
||||
echo "#---------------------------------------------------------------------#"
|
||||
echo "# $1"
|
||||
echo "#---------------------------------------------------------------------#"
|
||||
}
|
||||
|
||||
create_script()
|
||||
{
|
||||
echo "#! /bin/sh"
|
||||
echo
|
||||
echo "# This is a script for the CGAL test suite. Such a script must obey"
|
||||
echo "# the following rules:"
|
||||
echo "#"
|
||||
echo "# - the name of the script is cgal_test_with_cmake"
|
||||
echo "# - for every target two one line messages are written to the file 'error.txt'"
|
||||
echo "# the first one indicates if the compilation was successful"
|
||||
echo "# the second one indicates if the execution was successful"
|
||||
echo "# if one of the two was not successful, the line should start with 'ERROR:'"
|
||||
echo "# - running the script should not require any user interaction"
|
||||
echo "# - the script should clean up object files and executables"
|
||||
echo
|
||||
cat << EOF
|
||||
ERRORFILE=error.txt
|
||||
DO_RUN=${DO_RUN}
|
||||
if [ -z "\${MAKE_CMD}" ]; then
|
||||
MAKE_CMD=make
|
||||
fi
|
||||
NEED_CLEAN=
|
||||
|
||||
EOF
|
||||
header "configure"
|
||||
cat << 'EOF'
|
||||
|
||||
configure()
|
||||
{
|
||||
echo "Configuring... "
|
||||
|
||||
if eval 'cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \
|
||||
-DCGAL_DIR="$CGAL_DIR" \
|
||||
--no-warn-unused-cli \
|
||||
.' ; then
|
||||
|
||||
echo " successful configuration" >> $ERRORFILE
|
||||
else
|
||||
echo " ERROR: configuration" >> $ERRORFILE
|
||||
fi
|
||||
}
|
||||
|
||||
EOF
|
||||
header "compile_and_run <target>"
|
||||
cat << EOF
|
||||
|
||||
compile_and_run()
|
||||
{
|
||||
if [ -z "\${CGAL_DATA_DIR}" ]; then
|
||||
if [ -d \${CGAL_DIR}/data ]; then
|
||||
export CGAL_DATA_DIR=\${CGAL_DIR}/data
|
||||
else
|
||||
if [ -d \${CGAL_DIR}/Data/data ]; then
|
||||
export CGAL_DATA_DIR=\${CGAL_DIR}/Data/data
|
||||
else
|
||||
echo "ERROR: Cannot run test script, please set the variable CGAL_DATA_DIR"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Runs will be using CGAL_DATA_DIR = \${CGAL_DATA_DIR}"
|
||||
|
||||
echo "Compiling \$1 ... "
|
||||
SUCCESS="y"
|
||||
|
||||
if eval '"\${MAKE_CMD}" VERBOSE=ON -fMakefile \$1' ; then
|
||||
echo " successful compilation of \$1" >> \$ERRORFILE
|
||||
else
|
||||
echo " ERROR: compilation of \$1" >> \$ERRORFILE
|
||||
SUCCESS=""
|
||||
fi
|
||||
|
||||
if [ -n "\$DO_RUN" ] ; then
|
||||
if [ -n "\${SUCCESS}" ] ; then
|
||||
OUTPUTFILE=ProgramOutput.\$1.\$PLATFORM
|
||||
rm -f \$OUTPUTFILE
|
||||
COMMAND="./\$1"
|
||||
if [ -f \$1.cmd ] ; then
|
||||
COMMAND="\$COMMAND \`eval echo \$(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
|
||||
}
|
||||
|
||||
EOF
|
||||
header "remove the previous error file"
|
||||
cat << EOF
|
||||
|
||||
rm -f \$ERRORFILE
|
||||
touch \$ERRORFILE
|
||||
|
||||
EOF
|
||||
header "configure, compile and run the tests"
|
||||
cat << EOF
|
||||
|
||||
configure
|
||||
|
||||
if [ \$# -ne 0 ] ; then
|
||||
for file in \$* ; do
|
||||
compile_and_run \$file
|
||||
done
|
||||
else
|
||||
echo "Run all tests."
|
||||
EOF
|
||||
|
||||
# workaround for Cygwin, to avoid that the 'sort' from
|
||||
# C:\Windows\system32 is used instead of /usr/bin/sort
|
||||
PATH=/usr/bin:$PATH
|
||||
|
||||
for file in `ls *.cc *.cp *.cxx *.cpp *.CPP *.c++ *.C 2> /dev/null | sort` ; do
|
||||
if [ -n "`grep '\<main\>' $file`" ] ; then
|
||||
BASE=`basename $file .cc`
|
||||
BASE=`basename $BASE .cp`
|
||||
BASE=`basename $BASE .cxx`
|
||||
BASE=`basename $BASE .cpp`
|
||||
BASE=`basename $BASE .CPP`
|
||||
BASE=`basename $BASE .c++`
|
||||
BASE=`basename $BASE .C`
|
||||
cat <<EOF
|
||||
if grep -qE "^${BASE}:" Makefile; then
|
||||
compile_and_run $BASE
|
||||
NEED_CLEAN=y
|
||||
fi
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
cat << EOF
|
||||
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
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
if [ -f cgal_test_with_cmake ] ; then
|
||||
echo "moving cgal_test_with_cmake to cgal_test_with_cmake.bak ..."
|
||||
mv -f cgal_test_with_cmake cgal_test_with_cmake.bak
|
||||
fi
|
||||
create_script > cgal_test_with_cmake
|
||||
chmod 755 cgal_test_with_cmake
|
||||
echo "created cgal_test_with_cmake, version $VERSION, in $PWD ..."
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec "${0%_with_cmake}" ${1+"$@"}
|
||||
Reference in New Issue
Block a user