mirror of https://github.com/CGAL/cgal
WIP
This commit is contained in:
parent
17079b0d53
commit
3430223a9a
|
|
@ -0,0 +1,350 @@
|
|||
#!/bin/bash
|
||||
#usage : script [-c -l -n -s -k] testsuite_dir
|
||||
|
||||
##########################
|
||||
#### LAUNCH CTEST ####
|
||||
##########################
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# function to print the value of variable $1
|
||||
# ----------------------------------------------------------------------------------------
|
||||
value_of()
|
||||
{
|
||||
_value=`eval "printf '$'${1}"`
|
||||
eval "printf \"${_value}\""
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# produce a string containing the actual date/time
|
||||
# (used to identify files)
|
||||
# ----------------------------------------------------------------------------------------
|
||||
datestr()
|
||||
{
|
||||
date +%d%m%Y%H%M
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# 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
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
CGAL_RELEASE_DIR="${CGAL_DIR}"
|
||||
|
||||
CGAL_RELEASE_ID=`basename "${CGAL_RELEASE_DIR}"`
|
||||
|
||||
#todo : too complicated for nothing. Take a simpler outsource build 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
|
||||
|
||||
#todo
|
||||
PLATFORMS="raspberry"
|
||||
for PLATFORM in ${PLATFORMS}; do
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# 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}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
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}
|
||||
if [ -d "${REFERENCE_PLATFORMS_DIR}/${PLATFORM}" ] ; then
|
||||
if [ -f "${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/init.cmake" ]; then
|
||||
INIT_FILE="${REFERENCE_PLATFORMS_DIR}/${PLATFORM}/init.cmake"
|
||||
fi
|
||||
fi
|
||||
cd "${CGAL_BINARY_DIR}"
|
||||
log "${ACTUAL_LOGFILE}.test.${PLATFORM}" "Testing on host ${HOST} and platform ${PLATFORM}"
|
||||
#todo : check if that still works
|
||||
cmake ${INIT_FILE:+"-C${INIT_FILE}"} '${CMAKE_GENERATOR}' -DBUILD_TESTING=OFF -DWITH_tests=OFF -DWITH_CGAL_Qt5=OFF -DCGAL_HEADER_ONLY=ON $CGAL_DIR > installation.log
|
||||
cmake ${INIT_FILE:+"-C${INIT_FILE}"} '${CMAKE_GENERATOR}' VERBOSE=1 $CGAL_DIR
|
||||
LIST_TEST_FILE="${CGAL_ROOT}/list_test_packages"
|
||||
LIST_TEST_PACKAGES=$(source ${LIST_TEST_FILE})
|
||||
TO_TEST=""
|
||||
INIT=""
|
||||
for pkg in $LIST_TEST_PACKAGES; do
|
||||
if [ -z "$INIT" ]; then
|
||||
TO_TEST=$pkg
|
||||
INIT="y"
|
||||
else
|
||||
TO_TEST="${TO_TEST}|$pkg"
|
||||
fi
|
||||
done
|
||||
NUMBER_OF_PROCESSORS="`value_of PROCESSORS_localhost`"
|
||||
|
||||
CTEST_OPTS="-T Start -T Test -j${NUMBER_OF_PROCESSORS} ${DO_NOT_TEST:+-E execution___of__} --timeout 1200"
|
||||
if [ -z "${SHOW_PROGRESS}" ]; then
|
||||
ctest ${CTEST_OPTS} ${TO_TEST:+-L ${TO_TEST} } ${KEEP_TESTS:+-FC .}> tmp.txt
|
||||
else
|
||||
ctest ${CTEST_OPTS} ${TO_TEST:+-L ${TO_TEST}} ${KEEP_TESTS:+-FC .}|tee tmp.txt
|
||||
fi
|
||||
#####################
|
||||
## GET RESULTS ##
|
||||
#####################
|
||||
TAG_DIR=$(awk '/^Create new tag: /{print $4F}' tmp.txt)
|
||||
cd Testing/${TAG_DIR}
|
||||
#python $CGAL_DIR/test/parse-ctest-dashboard-xml.py $CGAL_TESTER $PLATFORM
|
||||
RESULT_FILE=./"results_${CGAL_TESTER}_${PLATFORM}.txt"
|
||||
rm -f "$RESULT_FILE"
|
||||
touch "$RESULT_FILE"
|
||||
sed -n '/CGAL_VERSION /s/#define //p' < "$CGAL_DIR/include/CGAL/version.h" >> "$RESULT_FILE"
|
||||
echo "TESTER ${CGAL_TESTER}" >> "$RESULT_FILE"
|
||||
echo "TESTER_NAME ${CGAL_TESTER_NAME}" >> "$RESULT_FILE"
|
||||
echo "TESTER_ADDRESS ${TESTER_ADDRESS}" >> "$RESULT_FILE"
|
||||
echo "CGAL_TEST_PLATFORM ${PLATFORM}" >> "$RESULT_FILE"
|
||||
#echo "General installation log file: ${GENERAL_BUILD_LOGFILE}" >> "$RESULT_FILE"
|
||||
#echo "Host-specific installation log file: ../installation.log" >> "$RESULT_FILE"
|
||||
grep -e "^-- USING " "${CGAL_BINARY_DIR}/installation.log" >> $RESULT_FILE
|
||||
echo "------------" >> "$RESULT_FILE"
|
||||
python3 /home/gimeno/CGAL/Testsuite/test/parse-ctest-dashboard-xml.py $CGAL_TESTER $PLATFORM
|
||||
|
||||
for file in $(ls|grep _Tests); do
|
||||
mv $file "$(echo "$file" | sed 's/_Tests//g')"
|
||||
done
|
||||
OUTPUT_FILE=results_${CGAL_TESTER}_${PLATFORM}.tar
|
||||
TEST_REPORT="TestReport_${CGAL_TESTER}_${PLATFORM}"
|
||||
rm -f $OUTPUT_FILE $OUTPUT_FILE.gz
|
||||
tar cf $OUTPUT_FILE results_${CGAL_TESTER}_${PLATFORM}.txt */"$TEST_REPORT"
|
||||
echo
|
||||
gzip -9f $OUTPUT_FILE
|
||||
cp "${OUTPUT_FILE}.gz" "results_${CGAL_TESTER}_${PLATFORM}.txt" "${CGAL_TEST_DIR}"
|
||||
}
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# Runs the test on the host $1
|
||||
# ----------------------------------------------------------------------------------------
|
||||
run_test_on_host()
|
||||
{
|
||||
HOST=${1}
|
||||
|
||||
#todo
|
||||
PLATFORMS=`value_of COMPILERS_${HOST}`
|
||||
PLATFORMS="raspberry"
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
#setup dir
|
||||
setup_dirs
|
||||
|
||||
|
||||
# Setup cmake
|
||||
if uname | grep -q "CYGWIN"; then
|
||||
JOM="`which jom`"
|
||||
if [ -e "$JOM" ]; then
|
||||
CMAKE_GENERATOR='-GNMake Makefiles JOM'
|
||||
MAKE_CMD='jom'
|
||||
else
|
||||
CMAKE_GENERATOR='-GNMake Makefiles'
|
||||
MAKE_CMD='nmake'
|
||||
fi
|
||||
IS_CYGWIN='y'
|
||||
else
|
||||
MAKE_CMD='make'
|
||||
fi
|
||||
|
||||
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
|
||||
Loading…
Reference in New Issue