From a2642a2f34b7892e2f3b45b18e351bb15676e38e Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Wed, 5 Mar 2008 20:42:26 +0000 Subject: [PATCH] autotest_cgal_with_cmake update --- .gitattributes | 3 +- CMake/CMakeLists.txt | 19 -- .../CreateSingleSourceCGALProgram.cmake | 26 +-- .../CreateSingleSourceCGALQt3Program.cmake | 6 +- .../CreateSingleSourceCGALQt4Program.cmake | 12 +- CMake/test/CMakeLists.txt | 20 -- .../autotest_cgal_with_cmake | 170 ++++++++------- Testsuite/test/makefile2 | 197 ++++++++++++++++++ Testsuite/test/run_testsuite_with_cmake | 180 ++++++++++++++++ 9 files changed, 504 insertions(+), 129 deletions(-) delete mode 100644 CMake/test/CMakeLists.txt create mode 100644 Testsuite/test/makefile2 create mode 100755 Testsuite/test/run_testsuite_with_cmake diff --git a/.gitattributes b/.gitattributes index 0b27c9c3f7b..a9fe0f8cfaa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1606,7 +1606,6 @@ CMake/src/CGALPDB/CMakeLists.txt -text CMake/src/CGALQt/CMakeLists.txt -text CMake/src/CGALimageIO/CMakeLists.txt -text CMake/src/CMakeLists.txt -text -CMake/test/CMakeLists.txt -text Circular_kernel_2/Benchmarks/parser/Report.pdf -text svneol=unset#application/pdf Circular_kernel_2/Benchmarks/readme.doc -text svneol=unset#application/msword Circular_kernel_2/Benchmarks/readme.pdf -text svneol=unset#application/pdf @@ -4098,7 +4097,9 @@ 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/makefile2 -text Testsuite/test/run_testsuite eol=lf +Testsuite/test/run_testsuite_with_cmake -text Timer/examples/Timer/CMakeLists.txt -text Timer/test/Timer/CMakeLists.txt -text Triangulation_2/demo/Triangulation_2/CMakeLists.txt -text diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt index ae29f663e6f..6b03464b475 100644 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt @@ -291,25 +291,6 @@ optional_add_subdirectory( examples ON EXCLUDE_FROM_ALL ) # install(DIRECTORY examples DESTINATION ${CGAL_INSTALL_ROOT} COMPONENT examples ) #endif() -#-------------------------------------------------------------------------------------------------- -# -# -= TESTSUITE =- -# -#-------------------------------------------------------------------------------------------------- - -# INCLUDE(Dart) -# MARK_AS_ADVANCED(DART_ROOT TCL_TCLSH) -set(TESTING_ENABLED OFF CACHE BOOL "Turn testing on/off") -if(TESTING_ENABLED) - - ENABLE_TESTING() - - add_subdirectory(test EXCLUDE_FROM_ALL ) - -# configure_file(${CGAL_SOURCE_DIR}/CMake/CTestCustom.ctest.in ${CGAL_BINARY_DIR}/CMake/CTestCustom.ctest @ONLY) -# FILE(WRITE ${CGAL_BINARY_DIR}/CTestCustom.cmake "INCLUDE(\"${CGAL_BINARY_DIR}/CMake/CTestCustom.ctest\")\n") -endif() - #-------------------------------------------------------------------------------------------------- # # -= CPack =- diff --git a/CMake/cmake/modules/CreateSingleSourceCGALProgram.cmake b/CMake/cmake/modules/CreateSingleSourceCGALProgram.cmake index 7196829f7b8..71a4557c385 100644 --- a/CMake/cmake/modules/CreateSingleSourceCGALProgram.cmake +++ b/CMake/cmake/modules/CreateSingleSourceCGALProgram.cmake @@ -11,22 +11,22 @@ macro(create_single_source_cgal_program first ) add_executable (${exe_name} ${all}) - #add_dependencies(${exe_name} CGAL CGAL_CORE) + set_target_properties( ${exe_name} PROPERTIES COMPILE_FLAGS "$(EXTRA_FLAGS) $(TESTSUITE_CXXFLAGS)" ) + set_target_properties( ${exe_name} PROPERTIES LINK_FLAGS "$(TESTSUITE_LDFLAGS)" ) + + add_dependencies(${exe_name} CGAL) + + if ( CGAL_USE_CGAL_CORE ) + add_dependencies(${exe_name} CGAL_CORE) + endif() # Link the executable to CGAL and third-party libraries - if ( NOT AUTO_LINK_ENABLED ) - target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + if ( AUTO_LINK_ENABLED ) + target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} ) + else() + target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ) endif() - # TODO: get test parameters from ${exe_name}.cmd - #set ( test_args ) - # - #if ( EXISTS ${exe_name}.cmd ) - # file( READ ${exe_name}.cmd ${test_args} ) - # message( STATUS "Command line arguments for ${exe_name}: ${test_args} ) - #endif() - # - #add_test( ${exe_name} ${exe_name} ${ARGS} ) - endif(EXISTS ${first}) + endif() endmacro() diff --git a/CMake/cmake/modules/CreateSingleSourceCGALQt3Program.cmake b/CMake/cmake/modules/CreateSingleSourceCGALQt3Program.cmake index c183118bfb7..328a7b0958e 100644 --- a/CMake/cmake/modules/CreateSingleSourceCGALQt3Program.cmake +++ b/CMake/cmake/modules/CreateSingleSourceCGALQt3Program.cmake @@ -21,15 +21,19 @@ macro(create_single_source_cgal_qt3_program first ) add_dependencies(${exe_name} CGAL CGAL_QT) if ( CGAL_USE_CGAL_CORE ) - add_dependencies(${exe_name} CGAL_CORE) + add_dependencies(${exe_name} CGAL_CORE) endif() + set_target_properties( ${exe_name} PROPERTIES COMPILE_FLAGS "$(EXTRA_FLAGS) $(TESTSUITE_CXXFLAGS)" ) + set_target_properties( ${exe_name} PROPERTIES LINK_FLAGS "$(TESTSUITE_LDFLAGS)" ) + # Link the executable to CGAL and third-party libraries if ( AUTO_LINK_ENABLED ) target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ) else() target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES}) endif() + endif(EXISTS ${first}) endmacro() diff --git a/CMake/cmake/modules/CreateSingleSourceCGALQt4Program.cmake b/CMake/cmake/modules/CreateSingleSourceCGALQt4Program.cmake index 91e158f4b67..22465ac8a93 100644 --- a/CMake/cmake/modules/CreateSingleSourceCGALQt4Program.cmake +++ b/CMake/cmake/modules/CreateSingleSourceCGALQt4Program.cmake @@ -18,14 +18,16 @@ macro(create_single_source_cgal_qt4_program first ) add_executable (${exe_name} ${all}) add_dependencies(${exe_name} CGAL CGAL_CORE) + set_target_properties( ${exe_name} PROPERTIES COMPILE_FLAGS "$(EXTRA_FLAGS) $(TESTSUITE_CXXFLAGS)" ) + set_target_properties( ${exe_name} PROPERTIES LINK_FLAGS "$(TESTSUITE_LDFLAGS)" ) + # Link the executable to CGAL and third-party libraries - if ( NOT AUTO_LINK_ENABLED ) - target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) + if ( AUTO_LINK_ENABLED ) + target_link_libraries(${exe_name} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ) + else() + target_link_libraries(${exe_name} ${CGAL_LIBRARIES} ${CGAL_QT_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES}) endif() - # Add " make test" rule for executable - # TODO: get test parameters from ${exe_name}.cmd - # add_test(${exe_name} ${exe_name}) endif(EXISTS ${first}) endmacro() diff --git a/CMake/test/CMakeLists.txt b/CMake/test/CMakeLists.txt deleted file mode 100644 index 66d69f73f09..00000000000 --- a/CMake/test/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -project(CGAL_TEST) - -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - -file( GLOB list "*" ) - -foreach( entry ${list} ) - - if ( IS_DIRECTORY ${entry} ) - - if ( EXISTS ${entry}/CMakeLists.txt ) - message( STATUS "Configuring ${entry} test" ) - add_subdirectory( ${entry} ) - else() - message( STATUS "Skipping ${entry} test" ) - endif() - - endif() - -endforeach() diff --git a/Scripts/developer_scripts/autotest_cgal_with_cmake b/Scripts/developer_scripts/autotest_cgal_with_cmake index 095267eefa3..41a02d0aca9 100755 --- a/Scripts/developer_scripts/autotest_cgal_with_cmake +++ b/Scripts/developer_scripts/autotest_cgal_with_cmake @@ -22,10 +22,13 @@ #sets the umask to 022 & 0777 umask 022 + +SCP="scp" WGET="wget" +WGET_OPTS="--no-check-certificate" CURL="curl" -CURL_OPTS="--remote-name --silent --location-trusted" -CGAL_URL="http://cgal.inria.fr/CGAL/Members/Releases" +CURL_OPTS="-k --remote-name --silent --location-trusted" +CGAL_URL="https://cgal.geometryfactory.com/CGAL/Members/Releases" LATEST_LOCATION="${CGAL_URL}/LATEST" TAR="tar" GZIP="gzip" @@ -40,6 +43,7 @@ CGAL_ROOT=`pwd` FTP_SERVER="ftp-sop.inria.fr" FTP_STORE_DIR="geometrica/Incoming" FTP_OPTS="-p -v -n" +UPLOAD_RESULT_DESTINATION="cgaltest@cgal.geometryfactory.com:incoming" BUILD_HOSTS="must_be_set_in_.autocgalrc" MAIL_ADDRESS="must_be_set_in_.autocgalrc" MYSHELL="must_be_set_in_.autocgalrc" @@ -56,6 +60,11 @@ do echo "Using latest unzipped release instead of getting a new one from the server" USE_LATEST_UNZIPPED="y" fi + + if [ "$arg" = "-l" ]; then + echo "Not uploading results to dashboard" + DO_NOT_UPLOAD="y" + fi done # Now loading autocgalrc. @@ -120,18 +129,9 @@ datestr() # $2 = target filename (basename only) put_on_web() { - if [ -n "${USE_CURL}" ]; then - $CURL --upload-file ${1} --user anonymous:${MAIL_ADDRESS} \ - ftp://${FTP_SERVER}/${FTP_STORE_DIR}/${2} >> ${ACTUAL_LOGFILE} 2>&1 - else - $FTP $FTP_OPTS $FTP_SERVER >> ${ACTUAL_LOGFILE} 2>&1 <> ${ACTUAL_LOGFILE} 2>&1 } error() @@ -191,7 +191,7 @@ build_cgal_libs() LOCAL_BUILD_ON="`value_of BUILD_ON_${1}`" if [ -z "${LOCAL_BUILD_ON}" ]; then - eval "${LOCAL_BUILD_ON}=\"`value_of COMPILERS_${1}`\"" + LOCAL_BUILD_ON=`value_of COMPILERS_${1}` fi if [ "${LOCAL_BUILD_ON}" = "all" ]; then @@ -206,10 +206,20 @@ build_cgal_libs() fi for i in ${LOCAL_BUILD_ON}; do - remote_command ${1} "cd ${CGAL_DIR}; cmake ${CGAL_DIR}/cmake/platforms/${i}; ${CGAL_DIR}/cmake/platforms/${i}/make" >> ${ACTUAL_LOGFILE} 2>&1 + + CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${i} + + log ${ACTUAL_LOGFILE} " under ${CGAL_BINARY_DIR}" + + remote_command ${1} "cd ${CGAL_BINARY_DIR}; \ + cmake -DWITH_demo=FALSE -DWITH_examples=FALSE -DWITH_CGALPDB=FALSE ../../..; \ + make -fMakefile" >> ${ACTUAL_LOGFILE} 2>&1 + + cp ${CGAL_BINARY_DIR}/CMakeFiles/CMakeError.log ${CGAL_TEST_DIR}/CMakeError_${i}.log + cp ${CGAL_BINARY_DIR}/CMakeFiles/CMakeOutput.log ${CGAL_TEST_DIR}/CMakeOutput_${i}.log + done - #cp ${CGAL_DIR}/install.log* ${CGAL_TEST_DIR}/ } #----------------------------------------------- @@ -234,43 +244,41 @@ run_testsuite() # processors to use # --------------------------------------------------- # $1 = HOST -# $2 = COMPILER +# $2 = PLATFORM test_script() { NUMBER_OF_PROCESSORS="`value_of PROCESSORS_${1}`" - cd ${CGAL_TEST_DIR} - TEST_DIR_ROOT=${TEST_DIR_ROOT:-${CGAL_DIR}} - LOCAL_TEST_DIR=${TEST_DIR_ROOT}/test_${2} + CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${2} + cd ${CGAL_BINARY_DIR} log ${ACTUAL_LOGFILE}.${1} "Testing on ${1} with ${2}" if [ "${NUMBER_OF_PROCESSORS}" = "1" ] ; then MAKE_OPTS="" else MAKE_OPTS="-j ${NUMBER_OF_PROCESSORS}" fi - cat > ${CGAL_TEST_DIR}/localtestscript.${1} < ${CGAL_BINARY_DIR}/localtestscript.${1} <> ${ACTUAL_LOGFILE}.${1} 2>&1 + chmod ugo+x ${CGAL_BINARY_DIR}/localtestscript.${1} + remote_command ${1} "${CGAL_BINARY_DIR}/localtestscript.${1}" >> ${ACTUAL_LOGFILE}.${1} 2>&1 log_done ${ACTUAL_LOGFILE}.${1} - #PLATFORM=`basename $CGAL_MAKEFILE | sed -e "s/makefile_//g"` # # collect results and put them on the web # @@ -284,15 +292,18 @@ EOF ${COMPRESSOR} -9f ${ACTUAL_LOGFILE}.${1} mv ${ACTUAL_LOGFILE}.${1}.gz ${LOGS_DIR}/${LOGFILENAME} - put_on_web \ - test_results-${1}.tar.gz \ - ${FILENAME} + echo "Test results: ${CGAL_TEST_DIR}/test_results-${1}.tar.gz" + + if [ -z "${DO_NOT_UPLOAD}" ]; then + put_on_web test_results-${1}.tar.gz ${FILENAME} + fi # # notify the CGAL world # if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then for i in ${MAIL_ADDRESS}; do + echo "Notifying ${i} about autotest finished." printf "result collection::\n${FILENAME}\n" | ${SENDMAIL} -s "autohandle" ${i} done fi @@ -311,7 +322,7 @@ get_cgal() if [ -n "${USE_CURL}" ]; then ${CURL} ${CURL_OPTS} ${CGAL_LOCATION} >> ${ACTUAL_LOGFILE} 2>&1 else - ${WGET} ${CGAL_LOCATION} >> ${ACTUAL_LOGFILE} 2>&1 + ${WGET} ${WGET_OPTS} ${CGAL_LOCATION} >> ${ACTUAL_LOGFILE} 2>&1 fi if [ ${?} != 0 ]; then error "Could not get CGAL" @@ -350,26 +361,26 @@ unzip_cgal() copy_old_stuff() { - # copy config build configuration files - + # copy config build configuration files + if [ ! ${OLD_CGAL_DIR} -ef ${CGAL_DIR} ]; then # Each build platform is given by a folder under cmake/build - cd ${OLD_CGAL_DIR}/cmake/platforms + cd ${OLD_CGAL_BINARY_DIR_BASE} for platform in * do if [ -d "${platform}" ]; then # if the platform folder doesn't exist in the tested release it is created now. - if [ ! -d "${CGAL_DIR}/cmake/platforms/${platform}" ]; then - log ${ACTUAL_LOGFILE} "Creating platform folder ${platform} in ${CGAL_DIR}/cmake/platforms/" - mkdir "${CGAL_DIR}/cmake/platforms/${platform}" + if [ ! -d "${CGAL_BINARY_DIR_BASE}/${platform}" ]; then + log ${ACTUAL_LOGFILE} "Creating platform folder ${platform} in ${CGAL_BINARY_DIR_BASE}/" + mkdir "${CGAL_BINARY_DIR_BASE}/${platform}" fi # If there is any configuration cached in the old release, copy it if [ -f "${platform}/CMakeCache.txt" ]; then - log ${ACTUAL_LOGFILE} "Copying old ${platform}/CMakeCache.txt into ${CGAL_DIR}/cmake/platforms/${platform}/" - cp "${platform}/CMakeCache.txt" "${CGAL_DIR}/cmake/platforms/${platform}" >> ${ACTUAL_LOGFILE} + log ${ACTUAL_LOGFILE} "Copying old ${platform}/CMakeCache.txt into ${CGAL_BINARY_DIR_BASE}/${platform}/" + cp "${platform}/CMakeCache.txt" "${CGAL_BINARY_DIR_BASE}/${platform}" >> ${ACTUAL_LOGFILE} fi fi @@ -377,6 +388,8 @@ copy_old_stuff() done log_done ${ACTUAL_LOGFILE} + + fi } @@ -407,8 +420,26 @@ run_test() if [ -n "${CONSOLE_OUTPUT}" ]; then printf "\n-------------------------------------------------------\n" fi + for i in ${BUILD_HOSTS}; do - run_testsuite ${i} "`value_of COMPILERS_${i}`" & + + LOCAL_TEST_ON=`value_of COMPILERS_${i}` + + if [ "${LOCAL_TEST_ON}" = "all" ]; then + LOCAL_TEST_ON="" + cd ${CGAL_BINARY_DIR_BASE} + for platform in * + do + if [ -d "${platform}" ]; then + LOCAL_TEST_ON="${LOCAL_TEST_ON} ${platform}" + fi + done + fi + + for j in ${LOCAL_TEST_ON}; do + run_testsuite ${i} ${j} #& + done + done } @@ -448,7 +479,7 @@ setup_dirs_for_latest_in_server() if [ -n "${USE_CURL}" ]; then ${CURL} ${CURL_OPTS} ${LATEST_LOCATION} >> ${ACTUAL_LOGFILE} 2>&1 else - ${WGET} ${LATEST_LOCATION} >> ${ACTUAL_LOGFILE} 2>&1 + ${WGET} ${WGET_OPTS} ${LATEST_LOCATION} >> ${ACTUAL_LOGFILE} 2>&1 fi if [ ! -f "LATEST" ]; then error "COULD NOT DOWNLOAD LATEST!" @@ -488,16 +519,10 @@ setup_dirs_for_latest_in_server() OLD_CGAL_DIR=${CGAL_ROOT}/CGAL-I CURRENT_CGAL_DIR=${CGAL_ROOT}/${CGAL_CURRENT_RELEASE_ID} - # you will guess it :) - CGAL_INCL_DIR=${CGAL_DIR}/include - OLD_CGAL_INCL_DIR=${OLD_CGAL_DIR}/include - CGAL_LIB_DIR=${CGAL_DIR}/lib - OLD_CGAL_LIB_DIR=${OLD_CGAL_DIR}/lib - CGAL_MAKE_DIR=${CGAL_DIR}/make CGAL_TEST_DIR=${CGAL_DIR}/test - CGAL_RUN_TEST=${CGAL_TEST_DIR}/run_testsuite - CGAL_COLLECT_TEST=${CGAL_TEST_DIR}/collect_cgal_testresults + OLD_CGAL_BINARY_DIR_BASE=${OLD_CGAL_DIR}/cmake/platforms + CGAL_BINARY_DIR_BASE=${CGAL_DIR}/cmake/platforms } setup_dirs_for_latest_unzipped() @@ -522,16 +547,10 @@ setup_dirs_for_latest_unzipped() CURRENT_CGAL_DIR=${CGAL_ROOT}/${CGAL_CURRENT_RELEASE_ID} - - # you will guess it :) - CGAL_INCL_DIR=${CGAL_DIR}/include - OLD_CGAL_INCL_DIR=${OLD_CGAL_DIR}/include - CGAL_LIB_DIR=${CGAL_DIR}/lib - OLD_CGAL_LIB_DIR=${OLD_CGAL_DIR}/lib - CGAL_MAKE_DIR=${CGAL_DIR}/make CGAL_TEST_DIR=${CGAL_DIR}/test - CGAL_RUN_TEST=${CGAL_TEST_DIR}/run_testsuite - CGAL_COLLECT_TEST=${CGAL_TEST_DIR}/collect_cgal_testresults + + OLD_CGAL_BINARY_DIR_BASE=${OLD_CGAL_DIR}/cmake/platforms + CGAL_BINARY_DIR_BASE=${CGAL_DIR}/cmake/platforms } @@ -567,8 +586,11 @@ update_symlinks() { rm ${OLD_CGAL_DIR} ln -s `basename ${CGAL_DIR}` ${OLD_CGAL_DIR} - rm ${CURRENT_CGAL_DIR} - ln -s `basename ${CGAL_DIR}` ${CURRENT_CGAL_DIR} + + if [ ! ${OLD_CGAL_DIR} -ef ${CURRENT_CGAL_DIR} ]; then + rm ${CURRENT_CGAL_DIR} + ln -s `basename ${CGAL_DIR}` ${CURRENT_CGAL_DIR} + fi } # ---------------------------------------------------- @@ -580,6 +602,7 @@ rm -f ${ACTUAL_LOGFILE} if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then for i in ${MAIL_ADDRESS}; do + echo "Notifying ${i} about autotest started." printf "subject says it all\n" | \ ${SENDMAIL} -s "Started autotest" ${i} done @@ -615,9 +638,15 @@ main_procedure() unzip_cgal fi - #copy_old_stuff - build_cgal - #update_symlinks + if [ ! ${OLD_CGAL_DIR} -ef ${CGAL_DIR} ]; then + copy_old_stuff + fi + + #build_cgal + + if [ ! ${OLD_CGAL_DIR} -ef ${CGAL_DIR} ]; then + update_symlinks + fi if [ "${BUILD_HOSTS}" = "localhost" ]; then TEXT="`value_of COMPILERS_localhost`" @@ -627,6 +656,7 @@ main_procedure() fi fi +#SKIP_TEST="y" if [ -z "${SKIP_TEST}" ]; then run_test diff --git a/Testsuite/test/makefile2 b/Testsuite/test/makefile2 new file mode 100644 index 00000000000..a055c259771 --- /dev/null +++ b/Testsuite/test/makefile2 @@ -0,0 +1,197 @@ +# A makefile which calls run_testsuite_with_cmake over all directories. +# +# Author : Sylvain Pion + +# The "all" target is split in several parts (based on the first +# character of each directory) to allow parallelization using "make -j". + +all: all_sS all_nN all_aA all_bB all_cC all_dD all_eE all_fF all_gG all_hH all_iI all_jJ all_kK all_lL all_mM all_oO all_pP all_qQ all_rR all_tT all_uU all_vV all_wW all_xX all_yY all_zZ + +all_aA: + @+for DIR in [0-9_aA]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_bB: + @+for DIR in [bB]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_cC: + @+for DIR in [cC]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_dD: + @+for DIR in [dD]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_eE: + @+for DIR in [eE]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_fF: + @+for DIR in [fF]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_gG: + @+for DIR in [gG]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_hH: + @+for DIR in [hH]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_iI: + @+for DIR in [iI]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_jJ: + @+for DIR in [jJ]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_kK: + @+for DIR in [kK]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_lL: + @+for DIR in [lL]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_mM: + @+for DIR in [mM]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_nN: + @+for DIR in [nN]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_oO: + @+for DIR in [oO]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_pP: + @+for DIR in [pP]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_qQ: + @+for DIR in [qQ]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_rR: + @+for DIR in [rR]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_sS: + @+for DIR in [sS]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_tT: + @+for DIR in [tT]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_uU: + @+for DIR in [uU]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_vV: + @+for DIR in [vV]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_wW: + @+for DIR in [wW]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_xX: + @+for DIR in [xX]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_yY: + @+for DIR in [yY]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +all_zZ: + @+for DIR in [zZ]*; do \ + if test -d "$$DIR"; then \ + ( ./run_testsuite_with_cmake "$$DIR" ) \ + fi; \ + done + +clean: + @for DIR in *; do \ + if test -d "$$DIR"; then \ + ( cd "$$DIR" && $(MAKE) clean ) \ + fi; \ + done diff --git a/Testsuite/test/run_testsuite_with_cmake b/Testsuite/test/run_testsuite_with_cmake new file mode 100755 index 00000000000..9257fc3dccc --- /dev/null +++ b/Testsuite/test/run_testsuite_with_cmake @@ -0,0 +1,180 @@ +#! /bin/sh +# +# This is the test script for the CGAL-library. +# +# Usage: +# run_testsuite for running the test suite in all subdirectories +# run_testsuite for running the test suite in the listed +# subdirectories +# +# To use this script you have to do two things: +# +# 2) set some additional compiler and or linker flags + +TESTSUITE_CXXFLAGS="" +TESTSUITE_LDFLAGS="" + +CURRENTDIR=`pwd` +ERRORFILE=${CURRENTDIR}/error.txt +PLATFORM=$CGAL_TEST_PLATFORM + +#clear the error file +rm -f $ERRORFILE +touch $ERRORFILE + +# Wait for process with pid $1. +# Wait for $2 periods of $3 seconds, checking after every period +# if the watched process has finished. +wait_for_process() +{ + pid=$1; + cycles=$2 + period=$3 + while [ $cycles -ne 0 ] + do + cycles=`expr $cycles - 1` +# send SIGCONT to the process and check the exit value of kill. +# If the process still exists, the call to kill succeeds (and the signal is +# ignored). + + kill -CONT $pid 2>kill_output 1>/dev/null; terminated=$? +# But under CYGWIN the exit status is not to be trusted. + if [ $terminated -eq 0 ]; then + if grep -i 'no such process' kill_output; then + terminated=1; + fi + fi + rm -f kill_output + if [ $terminated -eq 0 ] + then + sleep $period + else + cycles=0 + running=0 + fi + done + if [ $terminated -eq 0 ] + then + if false; then +# Send signal Terminate (SIGTERM) to the whole process group. +# First disable the default action (quit) for the current process. + trap true TERM + kill -TERM 0 + trap TERM + else + + # $pid is the PID of the forked shell that launched the command + # in background, in run_local_cgal_test(). If the shell is + # Bash, the Bash manual states that it ignores SIGTERM. + # However, it does not catch SIGHUP. That is why the first + # signal send is SIGHUP. + kill -HUP $pid + sleep 10 + # If SIGHUP was not enough, SIGKILL will finish the job, 10s after. + kill -KILL $pid + fi + return 1 + fi + return 0 +} + +run_local_cgal_test() +{ + eval ./cgal_test_with_cmake >current_compiler_output 2>&1 + exit_value=$? + if [ $exit_value -ne 0 ] + then + printf "%s\n" "$exit_value" > test_failure + fi +} + +#test_directory +test_directory() +{ + cd $CURRENTDIR + if [ -d $1 ] ; then + echo "DIRECTORY $1:" + echo + + echo "DIRECTORY $1:" >> $ERRORFILE + echo >> $ERRORFILE + cd $1 + + COMPILER_OUTPUT=CompilerOutput_$PLATFORM + rm -f $COMPILER_OUTPUT + ERROR_OUTPUT=ErrorOutput_$PLATFORM + rm -f $ERROR_OUTPUT + + echo "------------------------------------------------------------------" >> $COMPILER_OUTPUT + echo "- Compiler output from platform $PLATFORM" >> $COMPILER_OUTPUT + echo "------------------------------------------------------------------" >> $COMPILER_OUTPUT + echo >> $COMPILER_OUTPUT + + echo "------------------------------------------------------------------" >> $ERROR_OUTPUT + echo "- Error output from platform $PLATFORM" >> $ERROR_OUTPUT + echo "------------------------------------------------------------------" >> $ERROR_OUTPUT + echo >> $ERROR_OUTPUT + + if [ -f cgal_test_with_cmake -a -x cgal_test_with_cmake ] ; then + export PLATFORM TESTSUITE_CXXFLAGS TESTSUITE_LDFLAGS + rm -f error.txt + run_local_cgal_test & + + if wait_for_process "$!" "1200" "5" + then + if [ -f test_failure ] ; then + exit_failure=`cat test_failure` + rm -f test_failure + echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> $ERRORFILE + echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> $ERROR_OUTPUT + fi + else + echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> $ERRORFILE + echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> $ERROR_OUTPUT + fi + cat current_compiler_output >> $COMPILER_OUTPUT + cat current_compiler_output + rm -f current_compiler_output + + if [ -f error.txt ] ; then + cat error.txt >> $ERRORFILE + cat error.txt >> $ERROR_OUTPUT + else + echo "ERROR: the script cgal_test_with_cmake failed to generate output" >> $ERRORFILE + fi + else + echo " Could not execute the script cgal_test_with_cmake in directory $1" + echo "ERROR: could not execute the script $1/cgal_test_with_cmake" >> $ERRORFILE + fi + echo >> $ERRORFILE + echo >> $ERROR_OUTPUT + fi + echo +} + +run_testsuite() +{ + + echo "---------------------------------------------------------------" + echo "- Testing platform $PLATFORM" + echo "---------------------------------------------------------------" + echo + + echo "---------------------------------------------------------------" >> $ERRORFILE + echo "- TEST RESULTS FROM PLATFORM $PLATFORM" >> $ERRORFILE + echo "---------------------------------------------------------------" >> $ERRORFILE + echo >> $ERRORFILE + + for DIR in $TEST_DIRECTORIES ; do + test_directory $DIR + done +} + +if [ -z "$1" ] ; then + TEST_DIRECTORIES=`ls` +else + TEST_DIRECTORIES="$*" +fi + +run_testsuite +