Merge remote-tracking branch 'cgal/5.6.x-branch' into HEAD

This commit is contained in:
Sébastien Loriot
2025-01-24 08:08:33 +01:00
24 changed files with 16 additions and 4881 deletions
-951
View File
@@ -1,951 +0,0 @@
#!/bin/bash
# ----------------------------------------------------
# ----------------------------------------------------
# autotest_cgal: a script to automagically install and
# test internal CGAL releases
# ----------------------------------------------------
# You will need
# * GNU wget and ftp
# * or alternatively curl
#
# Furthermore you have to edit .autocgalrc in order to
# customize it for your environment.
# In particular you have to change the BUILHOSTS
# variable to contain the names of your hosts and
# set the COMPILERS_<hostname> variables to the
# os-compilers descriptions on which you want to run
# the testsuite.
# ----------------------------------------------------
# ----------------------------------------------------
#
# $URL$
# $Id$
#sets the umask to 022 & 0777
umask 022
# Warn deprecated use of environment variables to pass on flags
if [ -n "$TESTSUITE_CXXFLAGS" ] ; then
echo "\$TESTSUITE_CXXFLAGS is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_CXX_FLAGS instead" >&2;
fi
if [ -n "$TESTSUITE_CXXFLAGS_RELEASE" ] ; then
echo "\$TESTSUITE_CXXFLAGS_RELEASE is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_CXX_FLAGS_RELEASE instead" >&2;
fi
if [ -n "$TESTSUITE_CXXFLAGS_DEBUG" ] ; then
echo "\$TESTSUITE_CXXFLAGS_DEBUG is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_CXX_FLAGS_DEBUG instead" >&2;
fi
if [ -n "$TESTSUITE_LDFLAGS" ] ; then
echo "\$TESTSUITE_LDFLAGS is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_(MODULE|SHARED|EXE)_LINKER_FLAGS instead" >&2;
fi
if [ -n "$TESTSUITE_LDFLAGS_RELEASE" ] ; then
echo "\$TESTSUITE_LDFLAGS_RELEASE is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_(MODULE|SHARED|EXE)_LINKER_FLAGS_RELEASE instead" >&2;
fi
if [ -n "$TESTSUITE_LDFLAGS_DEBUG" ] ; then
echo "\$TESTSUITE_LDFLAGS_DEBUG is deprecated. Please use the CMAKE variable (CMAKE|CGAL)_(MODULE|SHARED|EXE)_LINKER_FLAGS_DEBUG instead" >&2;
fi
# We want english warning and error messages!!
LANG=C
LC_ALL=C
export LANG
export LC_ALL
SCP="scp"
WGET="wget"
WGET_OPTS="--no-check-certificate --no-verbose"
CURL="curl"
CURL_OPTS="-k --remote-name --silent --location-trusted"
CGAL_URL="https://cgal.geometryfactory.com/CGAL/Releases"
LATEST_LOCATION="${CGAL_URL}/LATEST"
TAR="tar"
GZIP="gzip"
GUNZIP="gunzip"
COMPRESSOR="${GZIP}"
SENDMAIL="mail"
CGAL_TESTER=`whoami`
CGAL_TESTER_NAME="${CGAL_TESTER}"
CGAL_TESTER_ADDRESS="${CGAL_TESTER}"
CONSOLE_OUTPUT="y"
CGAL_ROOT=`pwd`
UPLOAD_RESULT_DESTINATION="cgaltest@cgaltest.geometryfactory.com:incoming"
BUILD_HOSTS="must_be_set_in_.autocgalrc"
MAIL_ADDRESS="must_be_set_in_.autocgalrc"
MYSHELL=""
REFERENCE_PLATFORMS_DIR="must_be_set_in_.autocgalrc"
ACTUAL_DIR=`pwd`
RSH="rsh"
NICE_OPTIONS="-19"
USE_TARGZ="n"
USE_TARBZ="n"
PLATFORMS=""
PLATFORM=""
USE_REFERENCE_PLATFORMS=""
SHOW_PROGRESS=""
# ----------------------------------------------------------------------------------------
# write to logfile
# $1 = logfile
# ----------------------------------------------------------------------------------------
log()
{
LOGFILE=${1}
shift
if [ -n "${CONSOLE_OUTPUT}" ]; then
printf "${*} ...\n"
fi
printf "\n-------------------------------------------------------\n" >> "${LOGFILE}"
printf " ${*} ...\n" >> "${LOGFILE}"
printf "\n-------------------------------------------------------\n" >> "${LOGFILE}"
}
log_done()
{
if [ -n "${CONSOLE_OUTPUT}" ]; then
printf \
" done\n-------------------------------------------------------\n"
fi
printf "\n-------------------------------------------------------\n" >> "${1}"
printf " **DONE**\n" >> "${1}"
printf "\n-------------------------------------------------------\n" >> "${1}"
}
# ----------------------------------------------------------------------------------------
# produce a string containing the actual date/time
# (used to identify files)
# ----------------------------------------------------------------------------------------
datestr()
{
date +%d%m%Y%H%M
}
# ----------------------------------------------------------------------------------------
# Print error and exit
# ----------------------------------------------------------------------------------------
error()
{
if [ -n "${CONSOLE_OUTPUT}" ]; then
printf "\nERROR: ${*}, exiting.\n" >&2
fi
printf "\nERROR: ${*}, exiting.\n" >> "${ACTUAL_LOGFILE}"
${COMPRESSOR} -9f "${ACTUAL_LOGFILE}"
FILENAME="${CGAL_RELEASE_ID}-log`datestr`.gz"
mv "${ACTUAL_LOGFILE}.gz" "${LOGS_DIR}/${FILENAME}"
if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then
for i in ${MAIL_ADDRESS}; do
printf "ERROR\n${LOGS_DIR}/${FILENAME}\n" | \
${SENDMAIL} -s "completed autotest" "${i}"
done
fi
rm -rf "$LOCK_FILE";
exit 1
}
# ----------------------------------------------------------------------------------------
# Return 0 if $1 exists in the list $2, otherwise returns non-zero.
# ----------------------------------------------------------------------------------------
is_in_list()
{
ELEMENT=${1}
LIST=${2}
for E in ${LIST} ; do
if [ "${E}" = "${ELEMENT}" ] ; then
return 0
fi
done
return 1
}
# ----------------------------------------------------------------------------------------
# function to print the value of variable $1
# ----------------------------------------------------------------------------------------
value_of()
{
_value=`eval "printf '$'${1}"`
eval "printf \"${_value}\""
}
# ----------------------------------------------------------------------------------------
# Executes a command remotely
# $1 = HOST
# $2 = COMMAND
# ----------------------------------------------------------------------------------------
remote_command()
{
if [ "${1}" = "localhost" ]; then
eval $2
else
printf "** Logging into host ${1} **\n"
${RSH} ${1} ${MYSHELL} \"${2}\"
fi
}
# ----------------------------------------------------------------------------------------
# Downloads the file "LATEST" whose contents indicates which release to test
# ----------------------------------------------------------------------------------------
download_latest()
{
if [ -r "LATEST" ]; then
rm -rf LATEST
fi
log "${ACTUAL_LOGFILE}" "getting LATEST"
if [ -n "${USE_CURL}" ]; then
${CURL} ${CURL_OPTS} "${LATEST_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1
else
${WGET} ${WGET_OPTS} "${LATEST_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1
fi
if [ ! -f "LATEST" ]; then
error "COULD NOT DOWNLOAD LATEST!"
fi
}
# ----------------------------------------------------------------------------------------
# Exits the testsuite if the latest release has been already tested.
# This is tested by comparing files LATEST and RELEASE_NR, where
# RELEASE_NR is a copy of the previous LATEST.
# ----------------------------------------------------------------------------------------
abort_if_latest_already_tested()
{
if [ -r "RELEASE_NR" ]; then
cmp LATEST RELEASE_NR >> "${ACTUAL_LOGFILE}"
if [ ! ${?} != 0 ]; then
log "${ACTUAL_LOGFILE}" "This release has already been tested."
rm -f "$LOCK_FILE";
exit 1;
fi
fi
}
# ----------------------------------------------------------------------------------------
# get CGAL
# ----------------------------------------------------------------------------------------
get_cgal()
{
if [ -z "$CGAL_LOCATION" ]; then
for i in `cat LATEST`
do
CGAL_LOCATION="${CGAL_URL}/${i}";
CGAL_ZIPFILE="${i}";
done
else
CGAL_ZIPFILE=`echo "$CGAL_LOCATION" | sed 's|.*/||'`
fi
CGAL_RELEASE_ID=`echo $CGAL_ZIPFILE | sed "s/.tar.gz//"`
if [ ! "${CGAL_RELEASE_ID}" = "${CGAL_ZIPFILE}" ]; then
USE_TARGZ="y"
else
CGAL_RELEASE_ID=`echo $CGAL_ZIPFILE | sed "s/.tar.bz2//"`
if [ ! "${CGAL_RELEASE_ID}" = "${CGAL_ZIPFILE}" ]; then
USE_TARBZ="y"
fi
fi
log "${ACTUAL_LOGFILE}" "CGAL_ZIPFILE = ${CGAL_ZIPFILE}"
log "${ACTUAL_LOGFILE}" "CGAL_RELEASE_ID = ${CGAL_RELEASE_ID}"
log "${ACTUAL_LOGFILE}" "getting CGAL"
rm -f "${CGAL_ZIPFILE}"
if [ -n "${USE_CURL}" ]; then
${CURL} ${CURL_OPTS} "${CGAL_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1
else
${WGET} ${WGET_OPTS} "${CGAL_LOCATION}" >> "${ACTUAL_LOGFILE}" 2>&1
fi
if [ ${?} != 0 ]; then
error "Could not get CGAL"
fi
log_done "${ACTUAL_LOGFILE}"
}
# ----------------------------------------------------------------------------------------
# Unzips and untars the downloaded CGAL release
# ----------------------------------------------------------------------------------------
unzip_cgal()
{
cd "${CGAL_ROOT}"
log "${ACTUAL_LOGFILE}" "unzipping CGAL"
if [ "${USE_TARGZ}" = "y" ]; then
DECOMPRESSOR="${GUNZIP}"
log_done "${ACTUAL_LOGFILE}"
fi
if [ "${USE_TARBZ}" = "y" ]; then
DECOMPRESSOR="bunzip2"
fi
log "${ACTUAL_LOGFILE}" "untarring CGAL"
${DECOMPRESSOR} -c "${CGAL_ZIPFILE}" | ${TAR} xf - >> "${ACTUAL_LOGFILE}" 2>&1
if [ ${?} != 0 ]; then
error "Could not untar CGAL"
fi
# check, if CGAL_DIR exists
if [ -d "${CGAL_ROOT}/${CGAL_RELEASE_ID}" ]; then
# Reset CGAL-I symlink
log "${ACTUAL_LOGFILE}" "Resetting CGAL-I symlink to ${CGAL_ROOT}/${CGAL_RELEASE_ID}"
rm -f CGAL-I
ln -s "${CGAL_ROOT}/${CGAL_RELEASE_ID}" CGAL-I
# Reset CGAL-3.x-I symlink
CGAL_RELEASE=`echo "${CGAL_RELEASE_ID}" | sed 's/I\([^-]*\)-.*/I\1/'`
log "${ACTUAL_LOGFILE}" "Resetting ${CGAL_RELEASE} symlink to ${CGAL_ROOT}/${CGAL_RELEASE_ID}"
rm -f "${CGAL_RELEASE}"
ln -s "${CGAL_ROOT}/${CGAL_RELEASE_ID}" "${CGAL_RELEASE}"
else
error "directory ${CGAL_ROOT}/${CGAL_RELEASE_ID} does not exist"
fi
log_done "${ACTUAL_LOGFILE}"
}
# ----------------------------------------------------------------------------------------
# Uniquely adds $1 to the global, space-separated list $PLATFORMS
# (if it is not in the list already)
# ----------------------------------------------------------------------------------------
add_to_platforms()
{
if ! is_in_list "${1}" "${PLATFORMS}" ; then
PLATFORMS="${PLATFORMS} ${1}"
fi
}
# ----------------------------------------------------------------------------------------
# Uniquely adds to the global, space-separated list $PLATFORMS all the directories found
# under ${REFERENCE_PLATFORMS_DIR}
# ----------------------------------------------------------------------------------------
collect_all_reference_platforms()
{
log "${ACTUAL_LOGFILE}" "Indicated to build on ALL platform folders"
if [ -d "${REFERENCE_PLATFORMS_DIR}" ]; then
cd "${REFERENCE_PLATFORMS_DIR}"
for PLATFORM in * ; do
if [ -d "${PLATFORM}" ]; then
add_to_platforms "${PLATFORM}"
fi
done
else
log "${ACTUAL_LOGFILE}" "WARNING: Invalid reference platforms directory: ${REFERENCE_PLATFORMS_DIR}"
fi
}
# ----------------------------------------------------------------------------------------
# Uniquely adds to the global, space-separated list $PLATFORMS all the directories found
# under $1
# ----------------------------------------------------------------------------------------
collect_all_current_platforms()
{
PLATFORMS=""
cd "${1}"
for PLATFORM in * ; do
if [ -d "${PLATFORM}" ]; then
PLATFORMS="${PLATFORMS} ${PLATFORM}"
fi
done
}
# ----------------------------------------------------------------------------------------
# Uniquely adds to the global, space-separated list $PLATFORMS all the directory names
# listed in the space-separated list $1
# NOTE: If any such name is "all", it's NOT added as a platform and the flag
# USE_REFERENCE_PLATFORMS is set instead.
# ----------------------------------------------------------------------------------------
build_platforms_list()
{
for LOCAL_PLATFORM in $1; do
if [ "${LOCAL_PLATFORM}" = "all" ] ; then
USE_REFERENCE_PLATFORMS='y'
else
add_to_platforms "${LOCAL_PLATFORM}"
fi
done
}
# ----------------------------------------------------------------------------------------
# Sets up the variables indicating the directories to use.
# Crates all platform directories under the current release binary folder.
# ----------------------------------------------------------------------------------------
setup_dirs()
{
# dir for the actual release
CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-I"`
CGAL_TEST_DIR=${CGAL_DIR}/test
CGAL_DATA_DIR=${CGAL_DIR}/data
export CGAL_DATA_DIR=$(echo "$CGAL_DATA_DIR" | sed -E 's/\/cygdrive\/([a-z])\//\U\1:\//')
if [ ! -d "${CGAL_DIR}/cmake" ]; then
mkdir "${CGAL_DIR}/cmake"
log "${ACTUAL_LOGFILE}" "Creating ${CGAL_DIR}/cmake"
fi
if [ ! -d "${CGAL_DIR}/cmake/platforms" ]; then
mkdir "${CGAL_DIR}/cmake/platforms"
log "${ACTUAL_LOGFILE}" "Creating ${CGAL_DIR}/cmake/platforms"
fi
export CGAL_RELEASE_DIR="${CGAL_DIR}"
CGAL_RELEASE_ID=`basename "${CGAL_RELEASE_DIR}"`
CGAL_BINARY_DIR_BASE=${CGAL_RELEASE_DIR}/cmake/platforms
log "${ACTUAL_LOGFILE}" "Release to test ${CGAL_RELEASE_DIR}"
log "${ACTUAL_LOGFILE}" "CGAL_RELEASE_ID=${CGAL_RELEASE_ID}"
if [ ! -r "${LOGS_DIR}" ]; then
mkdir "$LOGS_DIR"
fi
#
# Collects the list of platform directories to build and test on
#
# The global variable PLATFORMS contains all the platform directories for all hosts
# as indicated in .autocgalrc.
# If .autocgalrc says "all" in any entry for BUILD_ON_* or COMPILERS_*, the platform
# directories existing in the reference release are added to $PLATFORMS
#
PLATFORMS=""
for HOST in ${BUILD_HOSTS}; do
build_platforms_list "`value_of BUILD_ON_${HOST}`"
build_platforms_list "`value_of COMPILERS_${HOST}`"
done
if [ -n "${USE_REFERENCE_PLATFORMS}" ]; then
collect_all_reference_platforms
fi
for PLATFORM in ${PLATFORMS}; do
# MSVC2015 does not support C++17
if [ "$CGAL_RELEASE_ID" \> "CGAL-6.0" ]; then
if [ "$PLATFORMS" = "MSVC2015-Release-64bits" ]; then
continue
fi
fi
CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${PLATFORM}
if [ ! -d "${CGAL_BINARY_DIR}" ]; then
log "${ACTUAL_LOGFILE}" "Creating platform directory ${CGAL_BINARY_DIR}"
mkdir "${CGAL_BINARY_DIR}"
fi
done
}
# ----------------------------------------------------------------------------------------
# copy stuff from old CGAL installation
# ----------------------------------------------------------------------------------------
copy_old_stuff()
{
if [ -d "${REFERENCE_PLATFORMS_DIR}" ]; then
cd "${CGAL_BINARY_DIR_BASE}"
for PLATFORM in * ; do
if [ -d "${PLATFORM}" ]; then
# if the reference platform folder contains a setup script, copy it
if [ -f "${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/setup" ]; then
log "${ACTUAL_LOGFILE}" "Copying reference platform setup script [${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/setup] in [${CGAL_BINARY_DIR_BASE}/${PLATFORM}]"
cp "${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/setup" "${CGAL_BINARY_DIR_BASE}/${PLATFORM}"
# hack on Windows, where 'cp' does not copy the Windows ACLs
chmod a+r "${CGAL_BINARY_DIR_BASE}/${PLATFORM}/setup"
fi
fi
done
fi
}
# ----------------------------------------------------------------------------------------
# Builds the CGAL library on the host specified at $1
# ----------------------------------------------------------------------------------------
build_cgal_on_host()
{
HOST=${1}
PLATFORMS="`value_of BUILD_ON_${HOST}`"
if [ -z "${PLATFORMS}" ]; then
PLATFORMS=`value_of COMPILERS_${HOST}`
fi
if [ "${PLATFORMS}" = "all" ]; then
collect_all_current_platforms "${CGAL_BINARY_DIR_BASE}"
fi
if [ -n "${PLATFORMS}" ]; then
for PLATFORM in ${PLATFORMS} ; do
CGAL_BINARY_DIR="${CGAL_BINARY_DIR_BASE}/${PLATFORM}"
log "${ACTUAL_LOGFILE}" "Building cgal libs on host ${HOST} and platform ${PLATFORM}\nUnder ${CGAL_BINARY_DIR}\n"
if [ -f "${CGAL_BINARY_DIR}/localbuildscript" ] ; then
log "${ACTUAL_LOGFILE}" "WARNING! Already built on platform ${PLATFORM}."
else
if [ -f "${CGAL_BINARY_DIR}/setup" ]; then
cp "${CGAL_BINARY_DIR}/setup" "${CGAL_BINARY_DIR}/localbuildscript"
else
rm -f "${CGAL_BINARY_DIR}/localbuildscript"
fi
cat >> "${CGAL_BINARY_DIR}/localbuildscript" <<EOF
CGAL_BINARY_DIR='${CGAL_BINARY_DIR}';
MAKE_CMD='${MAKE_CMD}';
export MAKE_CMD;
export CGAL_BINARY_DIR;
cd '${CGAL_BINARY_DIR}';
cmake \${INIT_FILE:+"-C\${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \\
VERBOSE=1 \\
../../..;
${MAKE_CMD} VERBOSE=ON -k -fMakefile ;
cd ..;
EOF
if [ -z "${KEEP_TESTS}" ]; then
cat >> "${CGAL_BINARY_DIR}/localbuildscript" <<EOF
echo 'REMOVING COMPILATION TREE';
rm -rf '${CGAL_BINARY_DIR}/src'
EOF
fi
chmod ugo+x "${CGAL_BINARY_DIR}/localbuildscript"
if [ -n "${SHOW_PROGRESS}" ]; then
remote_command ${HOST} "${CGAL_BINARY_DIR}/localbuildscript" 2>&1 | tee "${ACTUAL_LOGFILE}.build.${PLATFORM}"
else
remote_command ${HOST} "${CGAL_BINARY_DIR}/localbuildscript" > "${ACTUAL_LOGFILE}.build.${PLATFORM}" 2>&1
fi
cp "${ACTUAL_LOGFILE}.build.${PLATFORM}" "${CGAL_BINARY_DIR}/installation.log"
fi
done
else
error "There are no platform directories under ${CGAL_BINARY_DIR_BASE} to test! "
fi
}
# ----------------------------------------------------------------------------------------
# builds cgal
# ----------------------------------------------------------------------------------------
build_cgal()
{
for HOST in ${BUILD_HOSTS}; do
build_cgal_on_host "${HOST}"
done
# NOTE: At this point PWD is in the last platform directory where CGAL was built
log_done "${ACTUAL_LOGFILE}"
cp "${ACTUAL_LOGFILE}" "${CGAL_BINARY_DIR_BASE}/installation.log"
${COMPRESSOR} -9f "${ACTUAL_LOGFILE}"
mv "${ACTUAL_LOGFILE}.gz" "${LOGS_DIR}/${CGAL_RELEASE_ID}-log`datestr`.gz"
}
# ----------------------------------------------------------------------------------------
# Runs the test on the host $1 under the platform folder $2
# the variable PROCESSORS_electra, where electra is the
# name of the machine, is used to specify the number of
# processors to use
# ----------------------------------------------------------------------------------------
run_test_on_host_and_platform()
{
HOST=${1}
PLATFORM=${2}
NUMBER_OF_PROCESSORS="`value_of PROCESSORS_${HOST}`"
CGAL_BINARY_DIR=${CGAL_BINARY_DIR_BASE}/${PLATFORM}
cd "${CGAL_BINARY_DIR}"
log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "Testing on host ${HOST} and platform ${PLATFORM}"
if [ "${NUMBER_OF_PROCESSORS}" = "1" ] ; then
MAKE_OPTS=""
else
MAKE_OPTS="-j ${NUMBER_OF_PROCESSORS}"
fi
if [ -f "${CGAL_BINARY_DIR}/localtestscript" ]; then
log "${ACTUAL_LOGFILE}" "WARNING! Already tested on platform ${PLATFORM}."
else
if [ -f "${CGAL_BINARY_DIR}/setup" ]; then
cp "${CGAL_BINARY_DIR}/setup" "${CGAL_BINARY_DIR}/localtestscript"
else
rm -f "${CGAL_BINARY_DIR}/localtestscript"
fi
for file in "${CGAL_BINARY_DIR}/localtestscript" "${CGAL_BINARY_DIR}/localtestscript-redo-results-collection"; do
cat >> "$file" <<EOF
CGAL_TESTER='${CGAL_TESTER}';
CGAL_TESTER_NAME='${CGAL_TESTER_NAME}';
CGAL_TESTER_ADDRESS='${CGAL_TESTER_ADDRESS}';
if [ -n "${IS_CYGWIN}" ]; then
CGAL_DIR=\$( cygpath -w "${CGAL_BINARY_DIR}" );
else
CGAL_DIR='${CGAL_BINARY_DIR}';
fi
CGAL_TEST_HOST='${HOST}';
CGAL_TEST_PLATFORM='${PLATFORM}';
MAKE_CMD='${MAKE_CMD}'
export CGAL_TESTER CGAL_TESTER_NAME CGAL_TESTER_ADDRESS;
export CGAL_DIR;
export CGAL_TEST_HOST CGAL_TEST_PLATFORM;
export MAKE_CMD;
EOF
done
cat >> "${CGAL_BINARY_DIR}/localtestscript" <<EOF
LIST_TEST_PACKAGES='${LIST_TEST_PACKAGES}'
CGAL_ROOT='${CGAL_ROOT}'
rm -rf '${CGAL_BINARY_DIR}/test';
if [ -f '${LIST_TEST_PACKAGES}' ]; then
mkdir '${CGAL_BINARY_DIR}/test'
cp '${CGAL_TEST_DIR}/collect_cgal_testresults_from_cmake' '${CGAL_BINARY_DIR}/test'
cp '${CGAL_TEST_DIR}/makefile2' '${CGAL_BINARY_DIR}/test'
cp '${CGAL_TEST_DIR}/run_testsuite_with_cmake' '${CGAL_BINARY_DIR}/test'
# list all packages in CGAL_TEST_DIR. If PACKAGE is found in LIST_TEST_PACKAGES,
# copy it, else prepare for the special "skipped" case in the table.
for PACKAGE in \$(ls "${CGAL_TEST_DIR}"); do
if [ -d "${CGAL_TEST_DIR}/\$PACKAGE" ]; then
if source '${LIST_TEST_PACKAGES}' '${CGAL_ROOT}' | grep -E -q \$PACKAGE; then
mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}"
cp -r "${CGAL_TEST_DIR}/\${PACKAGE}" '${CGAL_BINARY_DIR}/test'
elif [ "\$PACKAGE" = "resources" ]; then
mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}"
cp -r "${CGAL_TEST_DIR}/\${PACKAGE}" '${CGAL_BINARY_DIR}/test'
else
mkdir "${CGAL_BINARY_DIR}/test/\${PACKAGE}"
touch "${CGAL_BINARY_DIR}/test/\${PACKAGE}/skipped"
fi
fi
done
else
cp -r '${CGAL_TEST_DIR}' '${CGAL_BINARY_DIR}/test';
fi
cd '${CGAL_BINARY_DIR}/test';
if [ -n "\${ULIMIT_OPTIONS}" ]; then
eval ulimit \${ULIMIT_OPTIONS};
else
[ -n "${ULIMIT_OPTIONS}" ] && ulimit ${ULIMIT_OPTIONS};
fi
nice ${NICE_OPTIONS} make ${MAKE_OPTS} -k -fmakefile2;
EOF
for file in "${CGAL_BINARY_DIR}/localtestscript" "${CGAL_BINARY_DIR}/localtestscript-redo-results-collection"; do
cat >> "$file" <<EOF
echo 'COLLECTING RESULTS';
./collect_cgal_testresults_from_cmake;
if [ -n "\$COLLECT_DEMOS_BINARIES" ]; then
echo 'COLLECTING DEMOS BINARIES';
echo "cp ${CGAL_TEST_DIR}/../developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh ${CGAL_BINARY_DIR}/test"
cp "${CGAL_TEST_DIR}/../developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh" "${CGAL_BINARY_DIR}/test"
EOF
cat >> "$file" <<'EOF'
for demo_dir in *_Demo; do
echo "pushd ${demo_dir}"
pushd "${demo_dir}"
bash ../cgal_demo_copy_all_dlls_cygwin.sh "${demo_dir}_with_dlls" ""
mv "${demo_dir}_with_dlls" ..
popd
done
EOF
cat >> "$file" <<EOF
tar czvf "${CGAL_TEST_DIR}/demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" *_Demo_with_dlls/*
fi
echo 'COPYING RESULTS';
cp 'results_${CGAL_TESTER}_${PLATFORM}.tar.gz' 'results_${CGAL_TESTER}_${PLATFORM}.txt' '${CGAL_TEST_DIR}';
cd ..;
EOF
done
if [ -z "${KEEP_TESTS}" ]; then
cat >> "${CGAL_BINARY_DIR}/localtestscript" <<EOF
echo 'REMOVING LOCAL_TEST_DIR';
rm -rf '${CGAL_BINARY_DIR}/test'
EOF
fi
chmod ugo+x "${CGAL_BINARY_DIR}"/localtestscript*
if [ -n "${SHOW_PROGRESS}" ]; then
remote_command ${HOST} "${CGAL_BINARY_DIR}/localtestscript" 2>&1 | tee "${ACTUAL_LOGFILE}.test.${PLATFORM}"
else
remote_command ${HOST} "${CGAL_BINARY_DIR}/localtestscript" > "${ACTUAL_LOGFILE}.test.${PLATFORM}" 2>&1
fi
log_done "${ACTUAL_LOGFILE}.test.${PLATFORM}"
fi
}
publish_results()
{
HOST=${1}
PLATFORM=${2}
#
# collect results and put them on the web
#
cd "${CGAL_TEST_DIR}"
log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "COLLECTING RESULTS ${PLATFORM}-${HOST}"
# If this file does not exist results collection failed. Fake a results so this fact is itself reported
if [ ! -f "results_${CGAL_TESTER}_${PLATFORM}.txt" ]; then
log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "Results collection for tester ${CGAL_TESTER} and platform ${PLATFORM} failed!"
echo "Results collection failed!" >> "results_${CGAL_TESTER}_${PLATFORM}.txt"
${TAR} cf "results_${CGAL_TESTER}_${PLATFORM}.tar" "results_${CGAL_TESTER}_${PLATFORM}.txt"
${COMPRESSOR} -9f "results_${CGAL_TESTER}_${PLATFORM}.tar"
fi
${TAR} cf "test_results-${HOST}_${PLATFORM}.tar" "results_${CGAL_TESTER}_${PLATFORM}.tar.gz" "results_${CGAL_TESTER}_${PLATFORM}.txt"
${COMPRESSOR} -9f "test_results-${HOST}_${PLATFORM}.tar"
COMPILER=`printf "%s" "$2" | tr -c '[A-Za-z0-9]./[=-=]*_\'\''\":?() ' 'x'`
FILENAME="${CGAL_RELEASE_ID}_${CGAL_TESTER}-test`datestr`-${COMPILER}-cmake.tar.gz"
LOGFILENAME="${CGAL_RELEASE_ID}-log`datestr`-${HOST}.gz"
${COMPRESSOR} -9f "${ACTUAL_LOGFILE}.test.${PLATFORM}"
mv "${ACTUAL_LOGFILE}.test.${PLATFORM}.gz" "${LOGS_DIR}/${LOGFILENAME}"
log_done "${ACTUAL_LOGFILE}.test.${PLATFORM}"
log "${ACTUAL_LOGFILE}" "Test results: ${CGAL_TEST_DIR}/test_results-${HOST}_${PLATFORM}.tar.gz"
if [ -z "${DO_NOT_UPLOAD}" ]; then
log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "PUTTING RESULTS ON THE WEB"
put_on_web "test_results-${HOST}_${PLATFORM}.tar.gz" "${FILENAME}"
if [ -e "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" ]; then
put_on_web "demos_${CGAL_TESTER}_${PLATFORM}.tar.gz" "demos-${FILENAME}"
fi
log_done "${ACTUAL_LOGFILE}"
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
}
# ----------------------------------------------------------------------------------------
# Runs the test on the host $1
# ----------------------------------------------------------------------------------------
run_test_on_host()
{
HOST=${1}
PLATFORMS=`value_of COMPILERS_${HOST}`
if [ "${PLATFORMS}" = "all" ]; then
collect_all_current_platforms "${CGAL_BINARY_DIR_BASE}"
fi
for PLATFORM in ${PLATFORMS}; do
run_test_on_host_and_platform "${HOST}" "${PLATFORM}"
publish_results "${HOST}" "${PLATFORM}"
done
}
# ----------------------------------------------------------------------------------------
# run the testsuites
# ----------------------------------------------------------------------------------------
run_test()
{
log "${ACTUAL_LOGFILE}" "running the testsuites"
if [ -n "${CONSOLE_OUTPUT}" ]; then
printf "\n-------------------------------------------------------\n"
fi
for HOST in ${BUILD_HOSTS}; do
run_test_on_host ${HOST} &
done
}
# ----------------------------------------------------------------------------------------
# function to put result files on the web
# $1 = source filename (full path)
# $2 = target filename (basename only)
# ----------------------------------------------------------------------------------------
put_on_web()
{
log "${ACTUAL_LOGFILE}" "Uploading results ${1} to $UPLOAD_RESULT_DESTINATION/$2"
"$SCP" "${1}" "$UPLOAD_RESULT_DESTINATION/$2" >> "${ACTUAL_LOGFILE}"
}
# ----------------------------------------------------
# START OF MAIN BODY
# ----------------------------------------------------
# Parse command line arguments
for arg in "$@"
do
case "$arg" in
"-c")
echo "Using latest unzipped release instead of getting a new one from the server"
USE_LATEST_UNZIPPED="y"
;;
"-l")
echo "Not uploading results to dashboard"
DO_NOT_UPLOAD="y"
;;
"-n")
# echo "No testsuite will be launched. Installation only."
DO_NOT_TEST="y"
;;
"-s")
echo "Showing progress."
SHOW_PROGRESS="y"
;;
"-k")
echo "Compiled test/ directory will be kept."
KEEP_TESTS="y"
;;
*)
CGAL_LOCATION=$arg
esac
done
# Load settings
if [ -f "$HOME/.autocgal_with_cmake_rc" ]; then
. "$HOME/.autocgal_with_cmake_rc"
else
if [ -f "$HOME/.autocgalrc" ]; then
. "$HOME/.autocgalrc"
else
echo "CONFIGURATION FILE .autocgal_with_cmake_rc or .autocgalrc NOT FOUND" >&2;
exit 1
fi
fi
LOGS_DIR="${CGAL_ROOT}/AUTOTEST_LOGS"
LOCK_FILE="${CGAL_ROOT}/autotest_cgal_with_cmake.lock"
LIST_TEST_PACKAGES="${CGAL_ROOT}/list_test_packages"
# Setup logfile
ACTUAL_LOGFILE="${CGAL_ROOT}/`basename ${0}`.log"
rm -f "${ACTUAL_LOGFILE}"
echo "Running `basename ${0}` "'$Revision$' >> "${ACTUAL_LOGFILE}"
# Sanity checks
if [ "${REFERENCE_PLATFORMS_DIR}" = "must_be_set_in_.autocgalrc" ]; then
error "REFERENCE_PLATFORMS_DIR must be set in .autocaglrc"
fi
if [ "${BUILD_HOSTS}" = "must_be_set_in_.autocgalrc" ]; then
error "BUILD_HOSTS must be set in .autocgalrc"
else
for i in ${BUILD_HOSTS}; do
TEXT="`value_of COMPILERS_${i}`"
if [ -z "${TEXT}" -a "${i}" != "localhost" ]; then
error "COMPILERS_${i} must be defined in .autocgalrc"
else
TEXT="`value_of PROCESSORS_${i}`"
TEMPVAR="PROCESSORS_${i}"
if [ -z "${TEXT}" ]; then
log "${ACTUAL_LOGFILE}" "\ngiving default 1 values TO PROCESSORS_${i} ...";
eval $TEMPVAR="1";
fi
fi
done
fi
# Make that file writable (lockfile create read-only files
chmod u+w "$LOCK_FILE"
# Put the PID of current process in the lock file
echo $$ > "$LOCK_FILE"
fi
# that line makes the script remove the lock file in case of unwanted exit
trap "rm -f \"$LOCK_FILE\"" EXIT HUP INT TERM
# Notify test started
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
fi
cd "$CGAL_ROOT"
# Starts the process
if [ -z "${USE_LATEST_UNZIPPED}" ]; then
if [ -z "$CGAL_LOCATION" ]; then
download_latest
abort_if_latest_already_tested
fi
get_cgal
unzip_cgal
fi
setup_dirs
copy_old_stuff
build_cgal
if [ "${BUILD_HOSTS}" = "localhost" ]; then
TEXT="`value_of COMPILERS_localhost`"
if [ -z "${DO_NOT_TEST}" ]; then
if [ -z "${TEXT}" ]; then
printf "Skipping testing phase (use the -n option to remove this message).\n"
DO_NOT_TEST="y"
fi
fi
fi
if [ -z "${DO_NOT_TEST}" ]; then
run_test
fi
cd "${CGAL_ROOT}"
if [ -e "LATEST" ]; then
mv LATEST RELEASE_NR
fi
rm -f "$LOCK_FILE";
# EOF
## Local Variables:
## sh-basic-offset: 2
## End:
@@ -1,3 +0,0 @@
#!/bin/sh
exec ${0%_with_cmake} ${1+"$@"}
@@ -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
@@ -208,8 +208,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(
@@ -228,23 +227,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/*")
@@ -257,17 +239,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()
@@ -278,17 +249,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
-214
View File
@@ -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+"$@"}
@@ -1,650 +0,0 @@
#!/usr/bin/env perl
#this script generates the internal release
use warnings;
use Cwd;
use File::Find;
use Getopt::Std;
use File::Spec;
use File::Temp;
use Archive::Tar;
use Archive::Tar::File;
use File::Copy;
use File::Copy::Recursive qw(dircopy);
use File::Path qw(mkpath);
use POSIX qw(strftime);
$Getopt::Std::STANDARD_HELP_VERSION = 1;
package main;
local $VERSION='$Id$';
sub HELP_MESSAGE() {
usage()
}
sub usage() {
print STDERR<<"EOF";
usage:
$0 (-h|-r)
[-n version number]
[-d releasedir] [-a allpackagesdir]
[-c candidatesdir]
[-l lockfile]
Exactly one of the options -h or -r must be present.
-h show this message and quit
-r release version to be created
-n version number (CGAL_VERSION_NR)
-d releasedir, default releasedir is the current dir
-a allpackagesdir, default is releasedir/trunk
-c candidatesdir
-l lockfile, default is releasedir/release_creation.lock
The version number is stored in VERSION and include/CGAL/version.h.
The RELEASEDIR is the place where the new release will be created.
The ALLPACKAGESDIR is the directory that contains the checked out packages
from the SCM. Could be trunk or some branch.
The LOCKFILE is some file used by lockfile command as a mutex.
Example of how to use the script:
>svn co svn+ssh://scm.gforge.inria.fr/svn/cgal/trunk
>./create_internal_release -r CGAL-3.3-I-1
or
>./create_internal_release -r CGAL-3.3-I-7 -d \$HOME -a \$HOME/CGALSVN/trunk -l release_creation.lock
EOF
}
my $TEMPFILE="TEMPFILE.$$";
#----------------------------------------------------#
# initialization #
#----------------------------------------------------#
my (
$VERSION,
$VERSION_NR,
$LOCKFILE,
$ALLPACKAGESDIR,
$CANDIDATESDIR,
$RELEASEDIR,
$MAINDIR,
$SCRIPTSDIR,
$DEVELSCRIPTSDIR,
$LOCKCMD,
# 'files' is an associative array (hash table in perl language) that maps
# from files names (relative to CGAL_DIR) to the name of the package that
# provided it.
%files,
# 'LISTOFALLPACKAGES' is an associative array that maps from packages names
# to the full path of the working copy that provided it.
%LISTOFALLPACKAGES
);
%LISTOFALLPACKAGES = ();
sub termination_signal_handler {
unlink $LOCKFILE;
exit 1;
}
sub lock()
{
if (system("$LOCKCMD", "-r", '10', "$LOCKFILE") != 0) {
print STDERR <<"TOTHIER";
The script could not proceed because
it could not acquire the needed lock on file $LOCKFILE.
TOTHIER
exit 1;
}
$SIG{QUIT} = \&termination_signal_handler;
$SIG{HUP} = \&termination_signal_handler;
$SIG{INT} = \&termination_signal_handler;
$SIG{TERM} = \&termination_signal_handler;
}
sub unlock()
{
unlink $LOCKFILE;
$SIG{QUIT} = 'DEFAULT';
$SIG{HUP} = 'DEFAULT';
$SIG{INT} = 'DEFAULT';
$SIG{TERM} = 'DEFAULT';
}
sub add_one_package($) {
my ($package) = @_;
}
sub list_packages($) {
my ($packages_directory) = @_;
opendir PACKAGESDIR, $packages_directory or die;
while (defined($package_name = readdir(PACKAGESDIR))) {
my $package_full_path = File::Spec->catdir($packages_directory, $package_name);
next if $package_name =~ /^\..*$/;
next if (! -d $package_full_path );
next if ($package_full_path =~ /Maintenance$/); # skip Maintenance package
$LISTOFALLPACKAGES{$package_name} = $packages_directory;
}
closedir(PACKAGESDIR);
}
sub install_packages() {
my ($filename, $direc, $tmp_package_name);
print "Installing packages ...\n";
chdir $RELEASEDIR or die;
if( ! open(LOG_CONFLICTS, ">>&=3") ) {
open(LOG_CONFLICTS, ">&", STDOUT) or die;
}
foreach my $package_name (keys(%LISTOFALLPACKAGES)) {
my $package_comes_from = $LISTOFALLPACKAGES{$package_name};
my $package_full_path = File::Spec->catdir($package_comes_from, $package_name);
$dont_submit="$package_full_path/dont_submit";
chdir "$package_comes_from" or die;
@command = ('tar', '-cf', "$RELEASEDIR/temppack.tar", '--exclude=.svn');
# comment for later: once the tar version installed on
# cgal.geometryfactory.com knows the option --exclude-vcs, use that
# option instead of --exclude=.svn
# -- Laurent Rineau, 2009/12/04 (idea by Sylvain Pion)
if( -f $dont_submit ) {
@command = (@command, "--exclude-from=$dont_submit");
}
@command = (@command, @global_dont_submit_tar_options);
@command = (@command, "-C", "$package_name", ".");
foreach( @command ) {
print "$_ ";
}
print "\n";
system(@command);
# generate the list of header file per package that not in an internal subdirectory. Files start with CGAL
$tempdir = File::Temp->newdir();
if ( -d "$package_full_path/include" ) {
@filelistcmd = ('tar', '-tf', "$RELEASEDIR/temppack.tar", '--wildcards', "./include/\*\*.h",
"--transform=s/.\\\/include\\\///", '--show-transformed-names',
'--exclude=**/internal', "--index-file=$tempdir/$package_name.txt");
system(@filelistcmd);
}
move("$RELEASEDIR/temppack.tar", "$RELEASEDIR/$VERSION/");
chdir "$RELEASEDIR/$VERSION" or die;
my $tar = Archive::Tar->new;
open my $TARFILL, "$RELEASEDIR/$VERSION/temppack.tar" or die;
if(! $tar->read($TARFILL)) {
unlink 'temppack.tar';
next;
}
for( $tar->get_files() )
{
my $filename = $_->name();
if( ! $_->is_dir() )
{
if(exists($files{$_->name()}))
{
print LOG_CONFLICTS "File ", $_->name(), " from package ", $package_name;
print LOG_CONFLICTS " conflicts with one from package ", $files{$_->name()}. "\n";
}
else
{
$files{$_->name()} = $package_name;
}
}
else { # is_dir() returned true
next if ($filename !~ /^\.\/?$/) and ($filename =~ /^\.\.?\/?$/);
my $package_from_from = $LISTOFALLPACKAGES{$package_name};
mkpath($filename);
# system("svn info $package_comes_from/$package_name/$filename | grep URL >> $filename/.scm-urls\n");
}
}
system('tar', '-xf', "temppack.tar");
if ( -e "$tempdir/$package_name.txt" ) {
if ( -d "$RELEASEDIR/$VERSION/doc/$package_name/" ) {
system("mv", ,"$tempdir/$package_name.txt", "$RELEASEDIR/$VERSION/doc/$package_name/filelist.txt");
} else {
system("rm", ,"$tempdir/$package_name.txt");
}
}
# $tmp_package_name = "temp_${package_name}";
# system("mv", "$package_name", "$tmp_package_name");
# opendir packagename, "$tmp_package_name";
# @fichiers = readdir packagename;
# closedir packagename;
# #shift @fichiers; shift @fichiers;
# foreach $fichier (@fichiers){
# if ($fichier ne '.' && $fichier ne '..'){
# system('cp', '-r', "$tmp_package_name/$fichier", "$RELEASEDIR/$VERSION");
# }
# }
# system('rm', '-rf', "$tmp_package_name");
}
close(LOG_CONFLICTS);
unlink 'temppack.tar';
( -d "$ALLPACKAGESDIR/.git" ) && system("git --git-dir=$ALLPACKAGESDIR/.git --work-tree=$ALLPACKAGESDIR log -n1 '--format=format:SCM branch:%n%H %d%n%nShort log from master:%n' > .scm-branch");
( -d "$ALLPACKAGESDIR/.git" ) && system("git --git-dir=$ALLPACKAGESDIR/.git --work-tree=$ALLPACKAGESDIR log --first-parent --format='%h %s%n parents: %p%n' cgal/master.. >> .scm-branch");
# foreach my $file (sort keys(%files)) {
# print "$files{$file}: $file\n";
# }
}
#-----------------------------------------------------------------------#
# set the version information in VERSION and include/CGAL/version.h #
#-----------------------------------------------------------------------#
sub create_version_file()
{
#if VERSION starts with CGAL-, we remove "CGAL-" from version
#the $newver variable will store the right version
if ($VERSION =~ /CGAL-(.*)/) {
$newver = $1;
} else {
$newver = $VERSION;
}
# Create VERSION file
chdir "$RELEASEDIR/$VERSION" or die;
open(TEMPFILE, ">tempfile") or die;
print TEMPFILE "$newver";
close TEMPFILE || die "Error closing temporary file: $!\n";
move("tempfile", 'VERSION');
# Create include/CGAL/version.h file
chdir "$RELEASEDIR/$VERSION/include/CGAL" or die;
open(TEMPFILE, ">tempfile") or die;
my $RELEASE_DATE = strftime "%Y%m%d", localtime;
# TODO : add `svnversion` Revision.
print TEMPFILE << 'EOF';
// Copyright (c) 2006 Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// Author(s) : -
// This file is automatically created by create_internal_release.
// Do not edit manually.
#ifndef CGAL_VERSION_H
#define CGAL_VERSION_H
#define CGAL_xstr(s) #s
#define CGAL_str(s) CGAL_xstr(s)
EOF
print TEMPFILE "#define CGAL_VERSION $newver\n";
print TEMPFILE "#define CGAL_VERSION_NR $VERSION_NR\n";
print TEMPFILE "#define CGAL_SVN_REVISION 0\n";
print TEMPFILE "#define CGAL_GIT_HASH 0\n";
print TEMPFILE "#define CGAL_RELEASE_DATE $RELEASE_DATE\n";
print TEMPFILE << 'EOF';
#define CGAL_VERSION_STR CGAL_str(CGAL_VERSION)
#endif
EOF
close TEMPFILE || die "Error closing temporary file: $!\n";
move("tempfile", 'version.h');
chdir '../..' or die;
}
#---------------------------------------------------------------#
# CreateExampleTestDirs
#---------------------------------------------------------------#
sub CreateExampleTestDirs()
{
my $DIR;
chdir "$RELEASEDIR/$VERSION" or die;
chdir 'examples' or return;
print "Creating $VERSION/test/example directories ...\n";
foreach $DIR (glob("*")) {
if ( -d $DIR ) {
print "Creating test/${DIR}_Examples ...\n";
dircopy("$DIR", "../test/${DIR}_Examples");
}
}
chdir '..';
}
#---------------------------------------------------------------#
# CreateDemoTestDirs
#---------------------------------------------------------------#
sub CreateDemoTestDirs()
{
my $DIR;
chdir "$RELEASEDIR/$VERSION" or die;
chdir 'demo' or return;
print "Creating $VERSION/test/demo directories ...\n";
foreach $DIR (glob("*")) {
if ( -d $DIR) {
if( ("$DIR" ne "icons") && ("$DIR" ne "resources") ) {
print "Creating test/${DIR}_Demo ...\n";
dircopy("$DIR", "../test/${DIR}_Demo");
}
else {
print "Creating test/${DIR}...\n";
dircopy("$DIR", "../test/${DIR}");
}
}
}
chdir '..';
}
#---------------------------------------------------------------#
# make_testscripts and generate makefiles in test and examples
#---------------------------------------------------------------#
sub make_testscripts()
{
my ($DIR, $BASEDIR);
chdir "$RELEASEDIR/$VERSION" or die;
$BASEDIR = cwd();
print "Creating and checking makefiles ...\n";
chdir 'test';
foreach $DIR (glob("*")) {
if ( (-d $DIR) && ("$DIR" ne "icons") && ("$DIR" ne "resources") ) {
chdir $DIR;
if ( -f 'Makefile') {
rename 'Makefile', 'makefile';
}
if ( -f 'makefile' ) {
open MAKEFILE, "makefile";
open NEW_MAKEFILE, ">makefile.new";
while (<MAKEFILE>) {
s/\.o\b/\$(OBJ_EXT)/g;
s/-g\b/\$(DEBUG_OPT)/g;
print NEW_MAKEFILE $_;
}
close NEW_MAKEFILE;
close MAKEFILE;
rename("makefile.new","makefile");
} else {
my $options = '-t';
if ( -f 'cgal_create_makefile_options') {
if (open(OPTIONS, "<cgal_create_makefile_options")) {
$_ = <OPTIONS>;
chomp;
if (/^[\w\s-]+$/) { $options = $_;
} else {
print STDERR "Rejected cgal_create_makefile_options in $DIR\n";
}
close OPTIONS;
}
}
system("$SCRIPTSDIR/cgal_create_makefile", $options) == 0 or die "Execution of $SCRIPTSDIR/cgal_create_makefile failed";
}
if ( ! -f 'cgal_test' ) {
$_ = $DIR;
# chomp;
if (/_Demo$/) {
system("$DEVELSCRIPTSDIR/create_cgal_test", "--no-run") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test --no-run failed";
} else {
system("$DEVELSCRIPTSDIR/create_cgal_test") == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test failed";
}
}
chdir '..';
}
}
chdir $BASEDIR;
chdir 'examples';
print "Creating makefiles in examples\n";
foreach $DIR (glob("*")) {
if ( -d $DIR ) {
chdir $DIR;
if ( -f 'Makefile') {
rename 'Makefile', 'makefile';
}
if ( -f 'makefile' ) {
open MAKEFILE, "makefile";
open NEW_MAKEFILE, ">makefile.new";
while (<MAKEFILE>) {
s/\.o\b/\$(OBJ_EXT)/g;
s/-g\b/\$(DEBUG_OPT)/g;
print NEW_MAKEFILE $_;
}
close NEW_MAKEFILE;
close MAKEFILE;
rename("makefile.new","makefile");
} else {
my $options = '-d';
if ( -f 'cgal_create_makefile_options') {
if (open(OPTIONS, "<cgal_create_makefile_options")) {
$_ = <OPTIONS>;
chomp;
if (/^[\w\s-]+$/) { $options = $_;
} else {
print STDERR "Rejected cgal_create_makefile_options in $DIR\n";
}
close OPTIONS;
}
}
system("$SCRIPTSDIR/cgal_create_makefile", $options) == 0 or die "Execution of $SCRIPTSDIR/cgal_create_makefile failed";
}
chdir '..';
}
}
chdir $BASEDIR;
}
#---------------------------------------------------------------#
# Generates a CMakeLists.txt in every subdirectory
# of the current directory if none already exists
#---------------------------------------------------------------#
sub generate_cmake_scripts
{
my $options = $_[0];
foreach $DIR (glob("*"))
{
if ( (-d $DIR) && ("$DIR" ne "icons") && ("$DIR" ne "resources") )
{
chdir $DIR;
if ( ! -f 'CMakeLists.txt' )
{
$_ = $DIR;
if ( -f 'cgal_create_cmake_script_options')
{
if (open(OPTIONS, "<cgal_create_cmake_script_options"))
{
$_ = <OPTIONS>;
chomp;
if (/^[\w\s-]+$/)
{
$options = $_;
}
else
{
print STDERR "Rejected cgal_create_cmake_script_options in $DIR\n";
}
close OPTIONS;
}
}
system("\"$SCRIPTSDIR/cgal_create_cmake_script\" $options") == 0 or die "Execution of \"$SCRIPTSDIR/cgal_create_cmake_script $options\" failed";
}
chdir '..';
}
}
}
sub generate_cgal_test_with_cmake
{
foreach $DIR (glob("*"))
{
if ( (-d $DIR) && ("$DIR" ne "icons") && ("$DIR" ne "resources") )
{
chdir $DIR;
if ( ! -f 'cgal_test_with_cmake' )
{
$_ = $DIR;
my $options = (/_Demo$/) ? '--no-run' : '' ;
system("$DEVELSCRIPTSDIR/create_cgal_test_with_cmake", $options) == 0 or die "Execution of $DEVELSCRIPTSDIR/create_cgal_test_with_cmake $options failed in directory $DIR";
}
chdir '..';
}
}
}
sub make_testscripts_for_cmake
{
my ($DIR, $BASEDIR);
chdir "$RELEASEDIR/$VERSION" or die;
$BASEDIR = cwd();
chdir 'test';
print "Creating test scripts\n";
generate_cgal_test_with_cmake();
print "Creating cmake scripts in test\n";
generate_cmake_scripts('test');
chdir $BASEDIR;
chdir 'examples';
print "Creating cmake scripts in examples\n";
generate_cmake_scripts('example');
chdir $BASEDIR;
chdir 'demo';
print "Creating cmake scripts in demo\n";
generate_cmake_scripts('demo');
chdir $BASEDIR;
}
#----------------------------------------------------#
# Main entry point #
#----------------------------------------------------#
sub main(){
$RELEASEDIR=cwd();
$ALLPACKAGESDIR="$RELEASEDIR/trunk";
$LOCKFILE="$RELEASEDIR/release_creation.lock";
$LOCKCMD='lockfile';
our ($opt_h, $opt_r, $opt_a, $opt_c, $opt_d, $opt_l, $opt_p, $opt_s, $opt_n);
if(! getopts('hr:a:c:d:l:p:s:n:') || $::opt_h ) {
usage();
die "\n";
}
if ($::opt_d){
$RELEASEDIR = $::opt_d;
$ALLPACKAGESDIR = "$RELEASEDIR/trunk";
$LOCKFILE="$RELEASEDIR/release_creation.lock";
}
if ($::opt_r){
$VERSION = $::opt_r;
if ($::opt_n){
$VERSION_NR = $::opt_n;
} else {
$VERSION_NR = $VERSION;
}
} else {
usage();
die "\n";
}
if ($::opt_a){
$ALLPACKAGESDIR = File::Spec->rel2abs( $::opt_a ) ;
}
if ($::opt_c){
$CANDIDATESDIR = File::Spec->rel2abs( $::opt_c ) ;
}
if ($::opt_l){
$LOCKFILE = $::opt_l;
}
$SCRIPTSDIR="$ALLPACKAGESDIR/Scripts/scripts";
$DEVELSCRIPTSDIR="$ALLPACKAGESDIR/Scripts/developer_scripts";
$global_dont_submit="$ALLPACKAGESDIR/Maintenance/release_building/global_dont_submit";
@global_dont_submit_tar_options = ();
if (open(GLOBAL_DONT_SUBMIT, "<", $global_dont_submit) ) {
while(<GLOBAL_DONT_SUBMIT>) {
chomp;
@global_dont_submit_tar_options = (@global_dont_submit_tar_options, "--exclude=$_");
}
close(GLOBAL_DONT_SUBMIT);
}
print "Initializing variables ...\n";
print " Release dir: $RELEASEDIR\n";
print " All packages dir: $ALLPACKAGESDIR\n";
if($CANDIDATESDIR) {
print " Candidates packages dir: $CANDIDATESDIR\n";
}
print " Scripts dir: $SCRIPTSDIR\n";
print " Developer Scripts dir: $DEVELSCRIPTSDIR\n";
print " Lockfile: $LOCKFILE\n";
umask(002);
chdir $RELEASEDIR or die;
if (! -d $VERSION){
print "Creating release directory ${VERSION} ...\n";
mkdir($VERSION, 0775);
} else {
print "$VERSION already exists in $RELEASEDIR\n";
print "Please remove it first\n";
exit 1;
}
lock;
list_packages($ALLPACKAGESDIR);
if($CANDIDATESDIR) {
list_packages($CANDIDATESDIR);
}
install_packages();
CreateDemoTestDirs();
CreateExampleTestDirs();
create_version_file();
#make_testscripts();
make_testscripts_for_cmake();
unlock;
}
main();
# Set the indent level of perl-mode, in Emacs.
# For that file it is mostly 2, so let's choose 2.
### Local Variables:
### perl-indent-level: 2
### End:
@@ -4,14 +4,6 @@
#
# Radu Ursu, Sylvain Pion, 2004-2006.
# TODO :
# - Cleanup the public/internal separation:
# - have CGAL_VERSION_NR be not affected by the internal version
# - have CGAL_REVISION be the revision (replacing the internal number)
# - The public release case should pass the info to create_internal_release.
# [new] : create_internal_release should not know about internal/public mode.
# - Merge [some parts] into ./create_internal_release ?
DO_PUBLIC="" # Also build the public versions
DO_IT="" # Real mode (copy to HTTP server), versus local testing
DO_NOT_TAG="" # If set, do not call tag
@@ -1,77 +0,0 @@
#!/bin/bash
#To run: $1 = name of the user
# $2 = name of the branch
# $3 = base ref name (master, 5.1.x, 5.2.x, etc...)
# $4 = number of the PR
if uname | grep -q -i cygwin; then
#Is supposed to ignore \r as eol character.
export SHELLOPTS
set -o igncr
fi
source ~/.autofilterrc
(
USER_REPO=$1
BRANCH_NAME=$2
BASE_NAME=$3
PR_NUMBER=$4
cd ${CGAL_GIT_DIR}
if [ ! -d cgal ]; then
git clone https://github.com/CGAL/cgal.git
cd cgal
git remote rename origin cgal
cd ..
fi
cd cgal
git fetch cgal
git remote add $USER_REPO https://github.com/$USER_REPO/cgal.git
git fetch $USER_REPO
git checkout $BRANCH_NAME
git reset --hard $USER_REPO/$BRANCH_NAME
#setup the list_test_packages
TMP_LIST=$(git diff --name-only cgal/$BASE_NAME...HEAD |grep -E -v /doc |grep -E "\.h"\|"\.cpp" |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |grep -E -v Installation||true)
LIST_OF_PKGS=""
for PKG in $(ls) ; do
if [ -f $PKG/package_info/$PKG/dependencies ]; then
if [ -n "$(comm -12 <(echo "$TMP_LIST"|sort) <(cat $PKG/package_info/$PKG/dependencies|sort))" ]; then
LIST_OF_PKGS="$LIST_OF_PKGS $PKG"
fi
fi
done
if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi
if [ "$LIST_OF_PKGS" != "" ]; then
for f in $LIST_OF_PKGS
do
echo "echo \"$f\"" >> ${CGAL_ROOT}/list_test_packages
echo "echo \"${f}_Examples\"" >> ${CGAL_ROOT}/list_test_packages
echo "echo \"${f}_Demo\"" >> ${CGAL_ROOT}/list_test_packages
done
fi
#create the release from the branch
echo " Create release..."
CGAL_VERSION="$(sed -E 's/#define CGAL_VERSION (.*\..*)-dev/\1/' <(grep "#define CGAL_VERSION " Installation/include/CGAL/version.h))-Ic-${PR_NUMBER}"
cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=${CGAL_VERSION} -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log
echo "done."
DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log);
cd ${CGAL_ROOT}
if [ -L CGAL-I ]; then rm CGAL-I; fi
ln -s $PWD/CGAL-TEST/$DEST CGAL-I
if [ -d CGAL-I/cmake/platforms ]; then
rm -rf CGAL-I/cmake/platforms/*
fi
echo "starting testsuite..."
./autotest_cgal -c
echo "finished."
)>${CGAL_ROOT}/autotest.log2 2>&1 &
echo "exit."
exit 0