From 9f1fd59afa0eaf610f8e8026492cf6608a69e29a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 3 Mar 2011 15:48:55 +0000 Subject: [PATCH] Rename create_cgal_test_with_cmake to create_cgal_test For the moment, it still creates file named "cgal_test_with_cmake"... --- .gitattributes | 1 + Scripts/developer_scripts/create_cgal_test | 188 +++++++++++++++++ .../create_cgal_test_with_cmake | 189 +----------------- 3 files changed, 191 insertions(+), 187 deletions(-) create mode 100755 Scripts/developer_scripts/create_cgal_test diff --git a/.gitattributes b/.gitattributes index 65bd89ecb9f..fb0333bdc62 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3167,6 +3167,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 -text Scripts/developer_scripts/create_cgal_test_with_cmake -text Scripts/developer_scripts/create_demos_zip_files.sh -text Scripts/developer_scripts/create_macosx_installer -text diff --git a/Scripts/developer_scripts/create_cgal_test b/Scripts/developer_scripts/create_cgal_test new file mode 100755 index 00000000000..706427ac936 --- /dev/null +++ b/Scripts/developer_scripts/create_cgal_test @@ -0,0 +1,188 @@ +#! /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" + +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 "\$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \\ + -DCGAL_DIR="\$CGAL_DIR" \\ + .' ; then + + echo " successful configuration" >> \$ERRORFILE + else + echo " ERROR: configuration" >> \$ERRORFILE + fi +} + +EOF + header "compile_and_run " +cat << EOF + +compile_and_run() +{ + 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 \`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 + for file in `ls *.C *.cpp 2>/dev/null | sort` ; do + if [ -n "`grep '\' $file`" ] ; then + tmp=`basename $file .C` + tmp=`basename $tmp .cpp` + cat < /dev/null; then + compile_and_run $tmp + 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 ..." diff --git a/Scripts/developer_scripts/create_cgal_test_with_cmake b/Scripts/developer_scripts/create_cgal_test_with_cmake index 4727ae09156..bfe9f0addd8 100755 --- a/Scripts/developer_scripts/create_cgal_test_with_cmake +++ b/Scripts/developer_scripts/create_cgal_test_with_cmake @@ -1,188 +1,3 @@ -#! /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. +#!/bin/sh -VERSION=1.1 - -DO_RUN="y" - -usage() -{ - 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 -} - -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 "\$CMAKE_GENERATOR" -DRUNNING_CGAL_AUTO_TEST=TRUE \\ - -DCGAL_DIR="\$CGAL_DIR" \\ - .' ; then - - echo " successful configuration" >> \$ERRORFILE - else - echo " ERROR: configuration" >> \$ERRORFILE - fi -} - -EOF - header "compile_and_run " -cat << EOF - -compile_and_run() -{ - 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 \`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 - for file in `ls *.C *.cpp 2>/dev/null | sort` ; do - if [ -n "`grep '\' $file`" ] ; then - tmp=`basename $file .C` - tmp=`basename $tmp .cpp` - cat < /dev/null; then - compile_and_run $tmp - 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 ..." +exec ${0%_with_cmake} ${1+"$@"}