diff --git a/.gitattributes b/.gitattributes index b3078835f83..7328ecfb56c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3433,6 +3433,7 @@ Scripts/developer_scripts/check_no_CGAL_USE_without_includes_before -text Scripts/developer_scripts/check_svn_keywords -text Scripts/developer_scripts/common_impl.rb -text Scripts/developer_scripts/create_assertions.sh eol=lf +Scripts/developer_scripts/create_cgal_test_with_cmake -text Scripts/developer_scripts/create_macosx_installer -text Scripts/developer_scripts/list_package_files.rb -text Scripts/developer_scripts/list_package_files_impl.rb -text @@ -4098,6 +4099,7 @@ Surface_mesher/find_debug_macros -text Surface_mesher/find_non_debug_macros -text Surface_mesher/test/Surface_mesher/CMakeLists.txt -text Surface_mesher/test/Surface_mesher/combined_spheres.cin -text +Testsuite/test/collect_cgal_testresults_from_cmake -text Testsuite/test/makefile2 -text Testsuite/test/run_testsuite eol=lf Testsuite/test/run_testsuite_with_cmake -text diff --git a/Scripts/developer_scripts/autotest_cgal_with_cmake b/Scripts/developer_scripts/autotest_cgal_with_cmake index 9ec039e22d7..0e3f94d98bc 100755 --- a/Scripts/developer_scripts/autotest_cgal_with_cmake +++ b/Scripts/developer_scripts/autotest_cgal_with_cmake @@ -269,7 +269,7 @@ cd ${CGAL_BINARY_DIR}/test; [ -n "${ULIMIT_OPTIONS}" ] && ulimit ${ULIMIT_OPTIONS}; nice ${NICE_OPTIONS} make ${MAKE_OPTS} -fmakefile2; echo 'COLLECTING RESULTS'; -./collect_cgal_testresults; +./collect_cgal_testresults_from_cmake; echo 'COPYING RESULTS'; cp results_${CGAL_TESTER}_${2}.tar.gz results_${CGAL_TESTER}_${2}.txt ${CGAL_TEST_DIR}; echo 'REMOVING LOCAL_TEST_DIR'; @@ -513,6 +513,11 @@ setup_dirs_for_latest_in_server() # dir for the actual release CGAL_DIR=${CGAL_ROOT}/${CGAL_RELEASE_ID} + # check, if CGAL_DIR exists + if [ !-d ${CGAL_DIR} ]; then + error "directory ${CGAL_DIR} does not exist" + fi + # dir of the previous release # HAS TO exist ! # (used to copy config/install files and evt. gmp stuff) @@ -540,6 +545,11 @@ setup_dirs_for_latest_unzipped() # dir for the actual release CGAL_DIR=${CGAL_ROOT}/${CGAL_RELEASE_ID} + # check, if CGAL_DIR exists + if [ !-d ${CGAL_DIR} ]; then + error "directory ${CGAL_DIR} does not exist" + fi + # dir of the previous release # HAS TO exist ! # (used to copy config/install files and evt. gmp stuff) @@ -580,6 +590,7 @@ setup_dirs() if [ ! -r ${LOGS_DIR} ]; then mkdir $LOGS_DIR fi + } update_symlinks() diff --git a/Scripts/developer_scripts/create_cgal_test_with_cmake b/Scripts/developer_scripts/create_cgal_test_with_cmake new file mode 100755 index 00000000000..e9ea79f206b --- /dev/null +++ b/Scripts/developer_scripts/create_cgal_test_with_cmake @@ -0,0 +1,155 @@ +#! /bin/sh +# +# ============================================================================= +# $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 all .C and .cpp +# files in the current test directory. + +VERSION=1.1 + +DO_RUN="y" + +while [ $1 ]; do + case "$1" in + -h|-help|--h|--help) + echo 'Usage : create_cgal_test_with_cmake [--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 + ;; + --no-run) + DO_RUN="" + shift; continue + ;; + 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 + echo "ERRORFILE=error.txt" + echo "DO_RUN=${DO_RUN}" + echo + header "configure" + echo +cat << EOF +configure() +{ + echo "Configuring... " + CONFIGURED="y" + + if eval 'cmake -DCGAL_DIR="\$CGAL_DIR" .' ; then + echo " succesful configuration" >> \$ERRORFILE + else + echo " ERROR: configuration" >> \$ERRORFILE + CONFIGURED="" + fi +} + +EOF + header "compile_and_run " + echo +cat << EOF +compile_and_run() +{ + echo "Compiling \$1 ... " + SUCCES="y" + + if eval 'make TESTSUITE_CXXFLAGS="\$TESTSUITE_CXXFLAGS" \\ + TESTSUITE_LDFLAGS="\$TESTSUITE_LDFLAGS" -fMakefile \$1' ; then + echo " succesful 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 " succesful execution of \$1" >> \$ERRORFILE + else + echo " ERROR: execution of \$1" >> \$ERRORFILE + fi + else + echo " ERROR: not executed \$1" >> \$ERRORFILE + fi + fi + + eval "make CGAL_MAKEFILE=\$CGAL_MAKEFILE clean > /dev/null 2>&1 " +} + +EOF + header "remove the previous error file" + echo + echo "rm -f \$ERRORFILE" + echo "touch \$ERRORFILE" + echo + header "configure, compile and run the tests" + echo + echo "configure" + echo +cat << EOF +if [ \$# -ne 0 ] ; then + for file in \$* ; do + compile_and_run \$file + done +else +EOF + for file in `ls *.C *.cpp 2>/dev/null | sort` ; do + if [ -n "`grep '\' $file`" ] ; then + tmp=`basename $file .C` + tmp=`basename $tmp .cpp` + echo " compile_and_run $tmp" + fi + done + echo "fi" +} + +echo "create_cgal_test_with_cmake version $VERSION" +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 ..." diff --git a/Scripts/developer_scripts/create_internal_release b/Scripts/developer_scripts/create_internal_release index 8bc27e824db..875f27a8863 100755 --- a/Scripts/developer_scripts/create_internal_release +++ b/Scripts/developer_scripts/create_internal_release @@ -339,6 +339,15 @@ sub make_testscripts() system("$DEVELSCRIPTSDIR/create_cgal_test") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test failed"; } } + if ( ! -f 'cgal_test_with_cmake' ) { + $_ = $DIR; + # chomp; + if (/_Demo$/) { + system("$DEVELSCRIPTSDIR/create_cgal_test_with_cmake", "--no-run") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test_with_cmake --no-run failed"; + } else { + system("$DEVELSCRIPTSDIR/create_cgal_test_with_cmake") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test_with_cmake failed"; + } + } chdir '..'; } } diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index 6dd406fb2bb..7058d1d3a58 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -48,9 +48,6 @@ create_cmake_script() echo 'set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)' echo - echo 'set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{CGALROOT}/cmake/modules" )' - echo - echo 'find_package(CGAL)' echo @@ -60,7 +57,7 @@ create_cmake_script() echo echo 'if ( CGAL_FOUND AND QT_FOUND )' echo - echo ' include(UseCGAL)' + echo ' include( ${CGAL_USE_FILE} )' echo ' include(Qt3Macros)' echo @@ -108,7 +105,7 @@ create_cmake_script() echo 'if ( CGAL_FOUND )' echo - echo ' include(UseCGAL)' + echo ' include( ${CGAL_USE_FILE} )' echo ' include(CreateSingleSourceCGALProgram)' echo diff --git a/Testsuite/test/collect_cgal_testresults_from_cmake b/Testsuite/test/collect_cgal_testresults_from_cmake new file mode 100755 index 00000000000..ea798dd0cd5 --- /dev/null +++ b/Testsuite/test/collect_cgal_testresults_from_cmake @@ -0,0 +1,155 @@ +#!/bin/sh +# collect_cgal_testresults_from_cmake +# =================================== +# collect all files to generate the html page +# containing the testsuite results +# +# to be run in the CGAL/test directory or a local test directory. +# CGAL_TESTER, CGAL_TESTER_NAME, CGAL_TESTER_ADDRESS are environment variables. + +print_platforms() +{ + cd Number_types # Pick a stable directory at random + for FILE in `ls CompilerOutput_*` ; do + PLATFORM=`echo $FILE | sed 's/CompilerOutput_//'| sed 's/\.gz//'` + printf "$PLATFORM " + done + cd .. +} + +#print_testresult +print_testresult() +{ + if [ ! -f ErrorOutput_$1 ] ; then + RESULT="?" + else + if eval grep ERROR ErrorOutput_$1 > /dev/null ; then + RESULT="n" + else + if eval grep -i warning CompilerOutput_$1 | grep -v 'read_only_relocs,warning' > /dev/null + then + RESULT="w" + else + RESULT="y" + fi + fi + fi + echo "$2 $RESULT" +} + +# do_platform +do_platform() +{ + PLATFORM=$1 + CURRENT_DIR=`pwd` + TESTER=${CGAL_TESTER:-${USER:-`whoami`}} + TESTER_NAME="${CGAL_TESTER_NAME:-${TESTER}}" + TESTER_ADDRESS="${CGAL_TESTER_ADDRESS:-${TESTER}}" + TEST_REPORT="TestReport_${TESTER}_${PLATFORM}" + RESULT_FILE=$CURRENT_DIR/results_${TESTER}_${PLATFORM}.txt + CGAL_DIR=.. + rm -f $RESULT_FILE + touch $RESULT_FILE + sed -n '/CGAL_VERSION /s/#define //p' < $CGAL_DIR/include/CGAL/version.h >> $RESULT_FILE + echo "TESTER ${TESTER}" >> $RESULT_FILE + echo "TESTER_NAME ${TESTER_NAME}" >> $RESULT_FILE + echo "TESTER_ADDRESS ${TESTER_ADDRESS}" >> $RESULT_FILE + echo "PLATFORM ${PLATFORM}" >> $RESULT_FILE + + LEDA_INCL_DIR=`cat "${CGAL_DIR}/config/install/${PLATFORM}" |sed -n '/LEDA_INCL_DIR/s/^.*= .\([^ ]*\). .*$/\1/p'` + if [ -r ${LEDA_INCL_DIR}/LEDA/basic.h ]; then + sed -n '/__LEDA__/s/^#define __LEDA__/LEDA version/p' < ${LEDA_INCL_DIR}/LEDA/basic.h >>$RESULT_FILE + fi + + cat "${CGAL_DIR}/config/install/${PLATFORM}" >> $RESULT_FILE + echo "------------" >> $RESULT_FILE + + if [ -f install.log.${PLATFORM} ] ; then + [ -f install.log ] && cat install.log >> Installation/ProgramOutput.install.log.${PLATFORM} + cat install.log.${PLATFORM} >> Installation/ProgramOutput.install.log.${PLATFORM} + + grep "Compilation of" install.log.${PLATFORM} \ + | awk '{ print $3 " " $4 " " $6; }' \ + | sed -e 's/succeeded\.$/y/' -e 's/failed\.$/n/' \ + | while read libname shared_or_static y_or_no; do + mkdir "${libname}_${shared_or_static}" + + # Make sure to let the following variable _buildlog_marker be synced + # with the variable _buildlog_marker from the script install_cgal. + _buildlog_marker="log for ${libname} ${shared_or_static} shown" + + cat install.log.${PLATFORM} \ + | sed -n "/${_buildlog_marker} below/,/${_buildlog_marker} above/ p" \ + > ${libname}_${shared_or_static}/$TEST_REPORT + + # Test if there is a warning in the build log. + if [ "$y_or_no" = "y" ]; then + if grep -i warning ${libname}_${shared_or_static}/$TEST_REPORT | grep -v 'read_only_relocs,warning' > /dev/null; then + y_or_no=w + fi + fi + + echo ${libname}_${shared_or_static} $y_or_no >> $RESULT_FILE + done + fi + + for DIR in $TEST_DIRECTORIES ; do + if [ -d $DIR ] ; then + echo " $DIR ..." + cd $DIR + + print_testresult $PLATFORM $DIR >> $RESULT_FILE + + rm -f ${TEST_REPORT} + touch $TEST_REPORT + + if [ ! -f ErrorOutput_${PLATFORM} ] ; then + echo "Error: file $DIR/ErrorOutput_${PLATFORM} does not exist!" + else + cat ErrorOutput_${PLATFORM} >> $TEST_REPORT + fi + + if [ ! -f CompilerOutput_${PLATFORM} ] ; then + echo "Error: file $DIR/CompilerOutput_${PLATFORM} does not exist!" + else + cat CompilerOutput_${PLATFORM} >> $TEST_REPORT + fi + + if 2>&1 eval ls ProgramOutput.*.${PLATFORM} > /dev/null ; then + PROGRAM_OUTPUT=`ls ProgramOutput.*$PLATFORM*` + for FILE in $PROGRAM_OUTPUT ; do + echo >> $TEST_REPORT + echo "------------------------------------------------------------------" >> $TEST_REPORT + echo "- $FILE" >> $TEST_REPORT + echo "------------------------------------------------------------------" >> $TEST_REPORT + cat $FILE >> $TEST_REPORT + done + fi + + cd .. + fi + done + + OUTPUT_FILE=results_${TESTER}_${PLATFORM}.tar + rm -f $OUTPUT_FILE $OUTPUT_FILE.gz + tar cf $OUTPUT_FILE results_${TESTER}_${PLATFORM}.txt */$TEST_REPORT + echo + echo "compressing ..." + gzip -9f $OUTPUT_FILE + echo "results written to file $OUTPUT_FILE.gz" + echo +} + +if [ -z "$1" ] ; then + TEST_DIRECTORIES=`ls` +else + TEST_DIRECTORIES="$*" +fi + +for PLATFORM in `print_platforms` ; do + echo "---------------------------------------------------------------" + echo " Collecting results of platform $PLATFORM" + echo "---------------------------------------------------------------" + do_platform $PLATFORM +done +