mirror of https://github.com/CGAL/cgal
Merge pull request #3759 from maxGimeno/Cross_compilation-Update_scripts-GF
Testsuite : Use ctest
This commit is contained in:
commit
330c6ec9b1
|
|
@ -194,24 +194,10 @@ function(run_test_alt name datafile)
|
||||||
endif()
|
endif()
|
||||||
cgal_debug_message(STATUS "# run_test_alt(${ARGN})")
|
cgal_debug_message(STATUS "# run_test_alt(${ARGN})")
|
||||||
cgal_debug_message(STATUS "# -> ./${name} ${datafile} ${ARGN}")
|
cgal_debug_message(STATUS "# -> ./${name} ${datafile} ${ARGN}")
|
||||||
set(command ${name} ${datafile} ${ARGN})
|
|
||||||
string(MAKE_C_IDENTIFIER "${name} ${ARGV4} ${ARGV5}" test_name)
|
string(MAKE_C_IDENTIFIER "${name} ${ARGV4} ${ARGV5}" test_name)
|
||||||
add_test(NAME ${test_name} COMMAND ${command}
|
cgal_add_test(${name}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
TEST_NAME ${test_name}
|
||||||
set_property(TEST "${test_name}"
|
ARGUMENTS ${datafile} ${ARGN})
|
||||||
APPEND PROPERTY DEPENDS "compilation_of__${name}")
|
|
||||||
if(POLICY CMP0066) # CMake 3.7 or later
|
|
||||||
set_tests_properties("${test_name}"
|
|
||||||
PROPERTIES
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir
|
|
||||||
FIXTURES_REQUIRED ${PROJECT_NAME})
|
|
||||||
endif()
|
|
||||||
cgal_debug_message(STATUS "# .. depends on compilation_of__${name}")
|
|
||||||
|
|
||||||
# message(" successful execution of ${name} ${ARGV4} ${ARGV5}")
|
|
||||||
set_property(TEST "${test_name}"
|
|
||||||
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
|
||||||
cgal_debug_message(STATUS "add test \"${test_name}\": ${name} ${datafile} ${ARGN}")
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(run_trapped_test name datafile)
|
function(run_trapped_test name datafile)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,9 @@ function(CGAL_setup_CGAL_dependencies target)
|
||||||
else()
|
else()
|
||||||
set(keyword PUBLIC)
|
set(keyword PUBLIC)
|
||||||
endif()
|
endif()
|
||||||
if(NOT CGAL_DISABLE_GMP)
|
if(CGAL_DISABLE_GMP)
|
||||||
|
target_compile_definitions(${target} ${keyword} CGAL_DISABLE_GMP=1)
|
||||||
|
else()
|
||||||
use_CGAL_GMP_support(${target} ${keyword})
|
use_CGAL_GMP_support(${target} ${keyword})
|
||||||
set(CGAL_USE_GMP TRUE CACHE INTERNAL "CGAL library is configured to use GMP")
|
set(CGAL_USE_GMP TRUE CACHE INTERNAL "CGAL library is configured to use GMP")
|
||||||
set(CGAL_USE_MPFR TRUE CACHE INTERNAL "CGAL library is configured to use MPFR")
|
set(CGAL_USE_MPFR TRUE CACHE INTERNAL "CGAL library is configured to use MPFR")
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ if(NOT CGAL_Qt5_MISSING_DEPS)
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Qt5_moc_and_resource_files.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_Qt5_moc_and_resource_files.cmake)
|
||||||
|
|
||||||
if(CGAL_HEADER_ONLY AND (WITH_demos OR WITH_examples OR NOT CGAL_BUILDING_LIBS) AND NOT TARGET CGAL_Qt5_moc_and_resources)
|
if(CGAL_HEADER_ONLY AND (WITH_demos OR WITH_examples OR WITH_tests OR NOT CGAL_BUILDING_LIBS) AND NOT TARGET CGAL_Qt5_moc_and_resources)
|
||||||
add_library(CGAL_Qt5_moc_and_resources STATIC
|
add_library(CGAL_Qt5_moc_and_resources STATIC
|
||||||
${_CGAL_Qt5_MOC_FILES_private}
|
${_CGAL_Qt5_MOC_FILES_private}
|
||||||
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
|
${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/GraphicsViewNavigation.h
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,14 @@ if(CGAL_CTEST_DISPLAY_MEM_AND_TIME)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
set(ANDROID_DIR_PREFIX /data/local/tmp/)
|
set(CGAL_REMOTE_TEST_DIR_PREFIX /data/local/tmp/ CACHE PATH "Path to the directory where the tests will be executed in a remote testsuite.")
|
||||||
find_program(adb_executable adb)
|
find_program(adb_executable adb)
|
||||||
endif()
|
endif()
|
||||||
|
if(CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
|
set(CGAL_REMOTE_TEST_DIR_PREFIX /home/pi/CGAL/ CACHE PATH "Path to the directory where the tests will be executed in a remote testsuite.")
|
||||||
|
find_program(ssh_executable ssh)
|
||||||
|
find_program(scp_executable scp)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Process a list, and replace items contains a file pattern (like
|
# Process a list, and replace items contains a file pattern (like
|
||||||
# `*.off`) by the sublist that corresponds to the globbing of the
|
# `*.off`) by the sublist that corresponds to the globbing of the
|
||||||
|
|
@ -116,18 +121,25 @@ function(cgal_setup_test_properties test_name)
|
||||||
COMMAND
|
COMMAND
|
||||||
${adb_executable} push
|
${adb_executable} push
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${ANDROID_DIR_PREFIX}${PROJECT_NAME}
|
${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
add_test(NAME ${PROJECT_NAME}_copy_GMP_MPFR
|
add_test(NAME ${PROJECT_NAME}_copy_GMP_MPFR
|
||||||
COMMAND
|
COMMAND
|
||||||
${adb_executable} push
|
${adb_executable} push
|
||||||
${GMP_LIBRARIES} ${MPFR_LIBRARIES}
|
${GMP_LIBRARIES} ${MPFR_LIBRARIES}
|
||||||
${ANDROID_DIR_PREFIX}${PROJECT_NAME}
|
${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
set_property(TEST ${PROJECT_NAME}_copy_GMP_MPFR
|
set_property(TEST ${PROJECT_NAME}_copy_GMP_MPFR
|
||||||
APPEND PROPERTY DEPENDS ${PROJECT_NAME}_SetupFixture)
|
APPEND PROPERTY DEPENDS ${PROJECT_NAME}_SetupFixture)
|
||||||
set_property(TEST ${PROJECT_NAME}_copy_GMP_MPFR
|
set_property(TEST ${PROJECT_NAME}_copy_GMP_MPFR
|
||||||
PROPERTY FIXTURES_SETUP ${PROJECT_NAME})
|
PROPERTY FIXTURES_SETUP ${PROJECT_NAME})
|
||||||
|
elseif(CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
|
add_test(NAME ${PROJECT_NAME}_SetupFixture
|
||||||
|
COMMAND
|
||||||
|
${scp_executable} -r
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${SSH_HOST}:${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
add_test(NAME ${PROJECT_NAME}_SetupFixture
|
add_test(NAME ${PROJECT_NAME}_SetupFixture
|
||||||
COMMAND
|
COMMAND
|
||||||
|
|
@ -143,7 +155,13 @@ function(cgal_setup_test_properties test_name)
|
||||||
add_test(NAME ${PROJECT_NAME}_CleanupFixture
|
add_test(NAME ${PROJECT_NAME}_CleanupFixture
|
||||||
COMMAND
|
COMMAND
|
||||||
${adb_executable} shell rm -rf
|
${adb_executable} shell rm -rf
|
||||||
${ANDROID_DIR_PREFIX}${PROJECT_NAME}
|
${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
elseif(CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
|
add_test(NAME ${PROJECT_NAME}_CleanupFixture
|
||||||
|
COMMAND
|
||||||
|
${ssh_executable} ${SSH_HOST} rm -rf
|
||||||
|
${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
add_test(NAME ${PROJECT_NAME}_CleanupFixture
|
add_test(NAME ${PROJECT_NAME}_CleanupFixture
|
||||||
|
|
@ -159,11 +177,12 @@ function(cgal_setup_test_properties test_name)
|
||||||
${PROJECT_NAME}_CleanupFixture ${PROJECT_NAME}_SetupFixture
|
${PROJECT_NAME}_CleanupFixture ${PROJECT_NAME}_SetupFixture
|
||||||
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
||||||
endif()
|
endif()
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID AND NOT CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
set_property(TEST "${test_name}"
|
set_property(TEST "${test_name}"
|
||||||
PROPERTY
|
PROPERTY
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/__exec_test_dir)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_property(TEST "${test_name}"
|
set_property(TEST "${test_name}"
|
||||||
APPEND PROPERTY FIXTURES_REQUIRED "${PROJECT_NAME}")
|
APPEND PROPERTY FIXTURES_REQUIRED "${PROJECT_NAME}")
|
||||||
if(exe_name)
|
if(exe_name)
|
||||||
|
|
@ -171,13 +190,22 @@ function(cgal_setup_test_properties test_name)
|
||||||
APPEND PROPERTY FIXTURES_REQUIRED "${exe_name}")
|
APPEND PROPERTY FIXTURES_REQUIRED "${exe_name}")
|
||||||
set_property(TEST "compilation_of__${exe_name}"
|
set_property(TEST "compilation_of__${exe_name}"
|
||||||
PROPERTY FIXTURES_SETUP "${exe_name}")
|
PROPERTY FIXTURES_SETUP "${exe_name}")
|
||||||
if(ANDROID)
|
if((ANDROID OR CGAL_RUN_TESTS_THROUGH_SSH) AND NOT TEST push_of__${exe_name})
|
||||||
add_test(NAME "push_of__${exe_name}"
|
if(ANDROID)
|
||||||
COMMAND ${adb_executable} push $<TARGET_FILE:${exe_name}> ${ANDROID_DIR_PREFIX}${PROJECT_NAME}/${exe_name})
|
add_test(NAME "push_of__${exe_name}"
|
||||||
|
COMMAND ${adb_executable} push $<TARGET_FILE:${exe_name}> ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}/${exe_name})
|
||||||
|
elseif(CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
|
add_test(NAME "push_of__${exe_name}"
|
||||||
|
COMMAND ${scp_executable} $<TARGET_FILE:${exe_name}> ${SSH_HOST}:${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}/)
|
||||||
|
endif()
|
||||||
|
set_property(TEST "push_of__${exe_name}"
|
||||||
|
APPEND PROPERTY DEPENDS "compilation_of__${exe_name}")
|
||||||
set_property(TEST "push_of__${exe_name}"
|
set_property(TEST "push_of__${exe_name}"
|
||||||
APPEND PROPERTY FIXTURES_SETUP "${exe_name}")
|
APPEND PROPERTY FIXTURES_SETUP "${exe_name}")
|
||||||
set_property(TEST "push_of__${exe_name}"
|
set_property(TEST "push_of__${exe_name}"
|
||||||
APPEND PROPERTY DEPENDS "compilation_of__${exe_name}")
|
APPEND PROPERTY FIXTURES_REQUIRED "${PROJECT_NAME}")
|
||||||
|
set_property(TEST "push_of__${exe_name}"
|
||||||
|
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif() # end CMake 3.7 or later
|
endif() # end CMake 3.7 or later
|
||||||
|
|
@ -204,11 +232,19 @@ function(cgal_add_test exe_name)
|
||||||
# message("Add test ${test_name}")
|
# message("Add test ${test_name}")
|
||||||
set(cin_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin")
|
set(cin_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin")
|
||||||
if(NOT ARGS AND EXISTS ${cin_file})
|
if(NOT ARGS AND EXISTS ${cin_file})
|
||||||
|
if(ANDROID OR CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
|
set(cmd ${exe_name})
|
||||||
|
else()
|
||||||
|
set(cmd $<TARGET_FILE:${exe_name}>)
|
||||||
|
endif()
|
||||||
add_test(NAME ${test_name}
|
add_test(NAME ${test_name}
|
||||||
COMMAND ${TIME_COMMAND} ${CMAKE_COMMAND}
|
COMMAND ${TIME_COMMAND} ${CMAKE_COMMAND}
|
||||||
-DCMD:STRING=$<TARGET_FILE:${exe_name}>
|
-DCMD:STRING=${cmd}
|
||||||
-DCIN:STRING=${cin_file}
|
-DCIN:STRING=${cin_file}
|
||||||
-DANDROID_DIR_PREFIX=${ANDROID_DIR_PREFIX}
|
-DCGAL_REMOTE_TEST_DIR_PREFIX=${CGAL_REMOTE_TEST_DIR_PREFIX}
|
||||||
|
-DSSH=${SSH}
|
||||||
|
-DSSH_HOST=${SSH_HOST}
|
||||||
|
-DCGAL_REMOTE_TEST_DIR_PREFIX=${CGAL_REMOTE_TEST_DIR_PREFIX}
|
||||||
-DPROJECT_NAME=${PROJECT_NAME}
|
-DPROJECT_NAME=${PROJECT_NAME}
|
||||||
-P "${CGAL_MODULES_DIR}/run_test_with_cin.cmake")
|
-P "${CGAL_MODULES_DIR}/run_test_with_cin.cmake")
|
||||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
|
@ -241,34 +277,15 @@ function(cgal_add_test exe_name)
|
||||||
endif()
|
endif()
|
||||||
# message(STATUS "add test: ${exe_name} ${ARGS}")
|
# message(STATUS "add test: ${exe_name} ${ARGS}")
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} ${adb_executable} shell cd ${ANDROID_DIR_PREFIX}${PROJECT_NAME} && LD_LIBRARY_PATH=${ANDROID_DIR_PREFIX}${PROJECT_NAME} ${ANDROID_DIR_PREFIX}${PROJECT_NAME}/${exe_name} ${ARGS})
|
add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} ${adb_executable} shell cd ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME} && LD_LIBRARY_PATH=${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME} ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}/${exe_name} ${ARGS})
|
||||||
|
elseif(CGAL_RUN_TESTS_THROUGH_SSH)
|
||||||
|
STRING(REPLACE ";" " " arg_str "${ARGS}")
|
||||||
|
add_test(NAME ${test_name} COMMAND bash -c "${TIME_COMMAND} ${ssh_executable} ${SSH_HOST} \"cd ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME} && ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}/${exe_name} ${arg_str} 3< <(cat; kill -INT 0)\" <&1")
|
||||||
else()
|
else()
|
||||||
add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} $<TARGET_FILE:${exe_name}> ${ARGS})
|
add_test(NAME ${test_name} COMMAND ${TIME_COMMAND} $<TARGET_FILE:${exe_name}> ${ARGS})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
cgal_setup_test_properties(${test_name} ${exe_name})
|
cgal_setup_test_properties(${test_name} ${exe_name})
|
||||||
return()
|
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin")
|
|
||||||
set(ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin")
|
|
||||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV2}.cmd")
|
|
||||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV2}.cmd"
|
|
||||||
ARGS LIMIT_COUNT 1)
|
|
||||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1}.cmd")
|
|
||||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1}.cmd"
|
|
||||||
ARGS LIMIT_COUNT 1)
|
|
||||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd")
|
|
||||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd"
|
|
||||||
ARGS LIMIT_COUNT 1)
|
|
||||||
# TODO: handle multi-lines .cmd files
|
|
||||||
# see https://github.com/CGAL/cgal/pull/1295/files/c65d3abe17bb3e677b8077996cdaf8672f9c4c6f#r71705451
|
|
||||||
endif()
|
|
||||||
string(REPLACE ";" " " args_str "${ARGS}")
|
|
||||||
add_test(NAME ${test_name}
|
|
||||||
COMMAND ${TIME_COMMAND} $<TARGET_FILE:${exe_name}> ${ARGS}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
set_property(TEST "${test_name}"
|
|
||||||
APPEND PROPERTY LABELS "${PROJECT_NAME}")
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(CGAL_add_compilation_tests_for_all_targets)
|
function(CGAL_add_compilation_tests_for_all_targets)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
if(NOT CMD OR NOT EXISTS ${CMD})
|
if(NOT CMD OR (NOT ANDROID AND NOT SSH AND NOT EXISTS ${CMD}))
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"The variable `CMD` should be defined to the test program to run!")
|
"The variable `CMD` should be defined to the test program to run!")
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -10,7 +10,12 @@ endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND adb shell "cd ${ANDROID_DIR_PREFIX}${PROJECT_NAME} && ${ANDROID_DIR_PREFIX}${CMD}"
|
COMMAND adb shell "cd ${ANDROID_DIR_PREFIX}${PROJECT_NAME} && ${ANDROID_DIR_PREFIX}${PROJECT_NAME}/${CMD}"
|
||||||
|
INPUT_FILE ${CIN}
|
||||||
|
RESULT_VARIABLE error_result)
|
||||||
|
elseif(SSH)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ssh ${SSH_HOST} "cd ${SSH_DIR_PREFIX}${PROJECT_NAME} && LD_LIBRARY_PATH=${SSH_DIR_PREFIX}/lib ${SSH_DIR_PREFIX}${PROJECT_NAME}/${CMD}"
|
||||||
INPUT_FILE ${CIN}
|
INPUT_FILE ${CIN}
|
||||||
RESULT_VARIABLE error_result)
|
RESULT_VARIABLE error_result)
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,271 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
#usage : script [-c -l -n -s -k] testsuite_dir
|
||||||
|
|
||||||
|
##########################
|
||||||
|
#### LAUNCH CTEST ####
|
||||||
|
##########################
|
||||||
|
|
||||||
|
export SHOW_PROGRESS=""
|
||||||
|
export KEEP_TESTS=""
|
||||||
|
export DO_NOT_UPLOAD=""
|
||||||
|
export DO_NOT_TEST=""
|
||||||
|
export SCP="scp"
|
||||||
|
export WGET="wget"
|
||||||
|
export WGET_OPTS="--no-check-certificate --no-verbose"
|
||||||
|
export CURL="curl"
|
||||||
|
export CURL_OPTS="-k --remote-name --silent --location-trusted"
|
||||||
|
export CGAL_URL="https://cgal.geometryfactory.com/CGAL/Members/Releases"
|
||||||
|
export UPLOAD_RESULT_DESTINATION="cgaltest@cgaltest.geometryfactory.com:incoming"
|
||||||
|
export LATEST_LOCATION="${CGAL_URL}/LATEST"
|
||||||
|
export TAR="tar"
|
||||||
|
export GUNZIP="gunzip"
|
||||||
|
export COMPRESSOR="gzip"
|
||||||
|
export CONSOLE_OUTPUT="y"
|
||||||
|
export CGAL_ROOT=`pwd`
|
||||||
|
export USE_TARGZ="n"
|
||||||
|
export USE_TARBZ="n"
|
||||||
|
export CGAL_RELEASE=""
|
||||||
|
export LOGS_DIR=""
|
||||||
|
export LOCK_FILE=""
|
||||||
|
export LIST_TEST_PACKAGES=""
|
||||||
|
export ACTUAL_LOGFILE=""
|
||||||
|
export CGAL_DIR=""
|
||||||
|
USE_LATEST_UNZIPPED=""
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------------
|
||||||
|
# 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//"`
|
||||||
|
echo ${CGAL_RELEASE_ID} > last_release_id
|
||||||
|
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}" > /dev/null
|
||||||
|
${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}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 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 "$CGAL_ROOT/.autocgalrc" ]; then
|
||||||
|
. "$CGAL_ROOT/.autocgalrc"
|
||||||
|
else
|
||||||
|
echo "CONFIGURATION FILE .autocgalrc NOT FOUND" >&2;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-I"`
|
||||||
|
source "${CGAL_DIR}/developer_scripts/log.sh"
|
||||||
|
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}"
|
||||||
|
|
||||||
|
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
|
||||||
|
#reset CGAL-DIR with the updated CGAL-I
|
||||||
|
CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-I"`
|
||||||
|
CGAL_RELEASE_ID=$(cat last_release_id)
|
||||||
|
|
||||||
|
PLATFORMS=`value_of COMPILERS_${HOST}`
|
||||||
|
#setup dir
|
||||||
|
setup_dirs
|
||||||
|
for HOST in ${BUILD_HOSTS}; do
|
||||||
|
if [ "$HOST" != "localhost" ]; then
|
||||||
|
#launch docker container
|
||||||
|
echo "export SHOW_PROGRESS=$SHOW_PROGRESS"> env.sh
|
||||||
|
echo "export KEEP_TESTS=$KEEP_TESTS">> env.sh
|
||||||
|
echo "export DO_NOT_UPLOAD=$DO_NOT_UPLOAD">> env.sh
|
||||||
|
echo "export DO_NOT_TEST=$DO_NOT_TEST">> env.sh
|
||||||
|
echo "export SCP=$SCP">> env.sh
|
||||||
|
echo "export WGET=$WGET">> env.sh
|
||||||
|
echo "export WGET_OPTS=\"$WGET_OPTS\"">> env.sh
|
||||||
|
echo "export CURL=$CURL">> env.sh
|
||||||
|
echo "export CURL_OPTS=\"$CURL_OPTS\"">> env.sh
|
||||||
|
echo "export CGAL_URL=$CGAL_URL">> env.sh
|
||||||
|
echo "export UPLOAD_RESULT_DESTINATION=$UPLOAD_RESULT_DESTINATION">> env.sh
|
||||||
|
echo "export LATEST_LOCATION=$LATEST_LOCATION">> env.sh
|
||||||
|
echo "export TAR=$TAR">> env.sh
|
||||||
|
echo "export GUNZIP=$GUNZIP">> env.sh
|
||||||
|
echo "export COMPRESSOR=$COMPRESSOR">> env.sh
|
||||||
|
echo "export CONSOLE_OUTPUT=$CONSOLE_OUTPUT">> env.sh
|
||||||
|
echo "export CGAL_ROOT=/cgal_root">> env.sh
|
||||||
|
echo "export USE_TARGZ=$USE_TARGZ">> env.sh
|
||||||
|
echo "export USE_TARBZ=$USE_TARBZ">> env.sh
|
||||||
|
echo "export CGAL_RELEASE=$CGAL_RELEASE">> env.sh
|
||||||
|
echo "export CGAL_DIR=/cgal_root/\${CGAL_LAST}">>env.sh
|
||||||
|
echo "export LIST_TEST_PACKAGES=/cgal_root/list_test_packages">> env.sh
|
||||||
|
echo "export LOGS_DIR=/cgal_root/AUTOTEST_LOGS">> env.sh
|
||||||
|
echo "export LOCK_FILE=/cgal_root/autotest_cgal_with_cmake.lock">> env.sh
|
||||||
|
echo "export ACTUAL_LOGFILE=/cgal_root/\`basename \${0}\`.log">> env.sh
|
||||||
|
echo "export REFERENCE_PLATFORMS_DIR=$REFERENCE_PLATFORMS_DIR">>env.sh
|
||||||
|
|
||||||
|
docker pull cgal/testsuite-docker:debian-stable-cross-compilation-for-arm
|
||||||
|
docker run --rm -t -e CGAL_LAST="${CGAL_RELEASE_ID}" -e HOST="${HOST}" -v ${CGAL_ROOT}/ssh:/tmp_ssh -v ${DEPS_DIR}:/deps -v ${CGAL_ROOT}:/cgal_root cgal/testsuite-docker:debian-stable-cross-compilation-for-arm
|
||||||
|
else
|
||||||
|
HOST=$HOST bash ${CGAL_DIR}/developer_scripts/run_testsuite_with_cmake
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cd "${CGAL_ROOT}"
|
||||||
|
if [ -e "LATEST" ]; then
|
||||||
|
mv LATEST RELEASE_NR
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
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}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,348 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#usage : script [-c -l -n -s -k] testsuite_dir
|
||||||
|
|
||||||
|
##########################
|
||||||
|
#### LAUNCH CTEST ####
|
||||||
|
##########################
|
||||||
|
|
||||||
|
source "${CGAL_DIR}/developer_scripts/log.sh"
|
||||||
|
# Load settings
|
||||||
|
if [ -f "$CGAL_ROOT/.autocgalrc" ]; then
|
||||||
|
. "$CGAL_ROOT/.autocgalrc"
|
||||||
|
else
|
||||||
|
echo "CONFIGURATION FILE .autocgalrc NOT FOUND" >&2;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------------
|
||||||
|
# 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_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=""
|
||||||
|
build_platforms_list "`value_of BUILD_ON_${HOST}`"
|
||||||
|
build_platforms_list "`value_of COMPILERS_${HOST}`"
|
||||||
|
|
||||||
|
if [ -n "${USE_REFERENCE_PLATFORMS}" ]; then
|
||||||
|
collect_all_reference_platforms
|
||||||
|
fi
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
PLATFORM=${1}
|
||||||
|
#
|
||||||
|
# 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_platform()
|
||||||
|
{
|
||||||
|
PLATFORM=${1}
|
||||||
|
|
||||||
|
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}"
|
||||||
|
INIT_FILE="${CGAL_ROOT}/${REFERENCE_PLATFORMS_DIR}/${PLATFORM}.cmake"
|
||||||
|
if [ ! -f "${INIT_FILE}" ]; then
|
||||||
|
echo "error NEED A INIT FILE !"
|
||||||
|
fi
|
||||||
|
|
||||||
|
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 2>&1
|
||||||
|
rm CMakeCache.txt
|
||||||
|
if [ -z "${SHOW_PROGRESS}" ]; then
|
||||||
|
cmake ${INIT_FILE:+"-C${INIT_FILE}"} '${CMAKE_GENERATOR}' VERBOSE=1 $CGAL_DIR >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
cmake ${INIT_FILE:+"-C${INIT_FILE}"} '${CMAKE_GENERATOR}' VERBOSE=1 $CGAL_DIR
|
||||||
|
fi
|
||||||
|
LIST_TEST_FILE="${CGAL_ROOT}/list_test_packages"
|
||||||
|
if [ -f ${LIST_TEST_FILE} ]; then
|
||||||
|
LIST_TEST_PACKAGES=$(source ${LIST_TEST_FILE})
|
||||||
|
fi
|
||||||
|
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
|
||||||
|
|
||||||
|
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)
|
||||||
|
rm 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 ${CGAL_DIR}/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()
|
||||||
|
{
|
||||||
|
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_platform "${PLATFORM}"
|
||||||
|
publish_results "${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
|
||||||
|
run_test_on_host
|
||||||
|
|
@ -2,23 +2,31 @@ from __future__ import print_function
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import os
|
import os
|
||||||
|
import io
|
||||||
import errno
|
import errno
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
import base64
|
||||||
|
import zlib
|
||||||
|
import gzip
|
||||||
|
|
||||||
result_file_name='{dir}/results_{tester}_{platform}.txt'
|
result_file_name='{dir}/results_{tester}_{platform}.txt'
|
||||||
result_info_file_name='{dir}/results_{tester}_{platform}.info'
|
result_info_file_name='{dir}/results_{tester}_{platform}.info'
|
||||||
test_report_filename='{dir}/TestReport_{tester}_{platform}'
|
test_report_filename='{dir}/TestReport_{tester}_{platform}'
|
||||||
|
|
||||||
xml = open("Test.xml", 'rb').read();
|
xml = open("Test.xml", 'rb').read()
|
||||||
|
|
||||||
def open_file_create_dir(filename, mode):
|
def open_file_create_dir(filename, mode, *args, **kwargs):
|
||||||
if not os.path.exists(os.path.dirname(filename)):
|
if not os.path.exists(os.path.dirname(filename)):
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.dirname(filename))
|
os.makedirs(os.path.dirname(filename))
|
||||||
except OSError as exc: # Guard against race condition
|
except OSError as exc: # Guard against race condition
|
||||||
if exc.errno != errno.EEXIST:
|
if exc.errno != errno.EEXIST:
|
||||||
raise
|
raise
|
||||||
return open(filename, mode)
|
if kwargs.get('gzip', None) == True:
|
||||||
|
return gzip.open(filename, mode)
|
||||||
|
else:
|
||||||
|
return open(filename, mode)
|
||||||
|
|
||||||
root=ET.fromstring(xml)
|
root=ET.fromstring(xml)
|
||||||
testing = root.find('Testing')
|
testing = root.find('Testing')
|
||||||
|
|
@ -31,42 +39,35 @@ for t in testlist:
|
||||||
|
|
||||||
tests = {}
|
tests = {}
|
||||||
labels = set()
|
labels = set()
|
||||||
|
tester_name=sys.argv[1]
|
||||||
|
platform_name=sys.argv[2]
|
||||||
for t in testing.findall('Test'):
|
for t in testing.findall('Test'):
|
||||||
|
t_output = t.find('Results').find('Measurement').find('Value')
|
||||||
|
t_output_value = t_output.text
|
||||||
|
if t_output_value != None:
|
||||||
|
if 'encoding' in t_output.attrib and t_output.attrib['encoding'] == 'base64':
|
||||||
|
t_output_value = base64.standard_b64decode(t_output_value)
|
||||||
|
if 'compression' in t_output.attrib and t_output.attrib['compression'] == 'gzip':
|
||||||
|
t_output_value = zlib.decompress(t_output_value).decode("utf-8")
|
||||||
tests[tests_ids[t.find('FullName').text]] = \
|
tests[tests_ids[t.find('FullName').text]] = \
|
||||||
{ \
|
{ \
|
||||||
"Name": t.find('Name').text, \
|
"Name": t.find('Name').text, \
|
||||||
"Status": t.attrib['Status'], \
|
"Status": t.attrib['Status'], \
|
||||||
"Output": t.find('Results').find('Measurement').find('Value').text, \
|
"Output": t_output_value, \
|
||||||
"Labels": [l.text for l in t.find('Labels').findall('Label')] if t.find('Labels') is not None else ['UNKNOWN_LABEL'], \
|
"Labels": [l.text for l in t.find('Labels').findall('Label')] if t.find('Labels') is not None else ['UNKNOWN_LABEL'], \
|
||||||
}
|
}
|
||||||
|
|
||||||
print("""
|
|
||||||
1
|
|
||||||
2
|
|
||||||
3
|
|
||||||
4
|
|
||||||
5
|
|
||||||
6
|
|
||||||
7
|
|
||||||
8
|
|
||||||
9
|
|
||||||
10
|
|
||||||
11
|
|
||||||
12
|
|
||||||
""", file=open(result_info_file_name.format(dir=os.getcwd(),
|
|
||||||
tester="me",
|
|
||||||
platform="Mon Linux"), 'w'))
|
|
||||||
|
|
||||||
tests_per_label = defaultdict(list)
|
tests_per_label = defaultdict(list)
|
||||||
for t_id in range(0, len(tests)):
|
for t_id in range(0, len(tests)):
|
||||||
t = tests[t_id]
|
t = tests[t_id]
|
||||||
for label in t['Labels']:
|
for l in t['Labels']:
|
||||||
|
label = l.replace("_Tests","")
|
||||||
labels.add(label)
|
labels.add(label)
|
||||||
tests_per_label[label].append(t)
|
tests_per_label[label].append(t)
|
||||||
|
|
||||||
with open_file_create_dir(result_file_name.format(dir=os.getcwd(),
|
with open_file_create_dir(result_file_name.format(dir=os.getcwd(),
|
||||||
tester="me",
|
tester=tester_name,
|
||||||
platform="Mon Linux"), 'w') as results:
|
platform=platform_name), 'a+') as results:
|
||||||
for label, tests in tests_per_label.items():
|
for label, tests in tests_per_label.items():
|
||||||
result_for_label='y'
|
result_for_label='y'
|
||||||
with open_file_create_dir("{}/error.txt".format(label), 'w') as error:
|
with open_file_create_dir("{}/error.txt".format(label), 'w') as error:
|
||||||
|
|
@ -74,10 +75,11 @@ with open_file_create_dir(result_file_name.format(dir=os.getcwd(),
|
||||||
print(" {} {}".format("successful " if (t['Status'] == 'passed') else "ERROR: ", t['Name']), file=error)
|
print(" {} {}".format("successful " if (t['Status'] == 'passed') else "ERROR: ", t['Name']), file=error)
|
||||||
if t['Status'] != 'passed':
|
if t['Status'] != 'passed':
|
||||||
result_for_label='n'
|
result_for_label='n'
|
||||||
elif t['Output'] != None and re.match(r'(^|[^a-zA-Z_,:-])warning', t['Output']):
|
elif t['Output'] != None and re.search(r'(^|[^a-zA-Z_,:-])warning', t['Output'], flags=re.IGNORECASE):
|
||||||
result_for_label='y'
|
result_for_label='w'
|
||||||
|
|
||||||
with open("{}/ProgramOutput.{}".format(label, t['Name']), 'w') as f:
|
with io.open("{}/ProgramOutput.{}".format(label, t['Name']), mode="w", encoding="utf-8") as f:
|
||||||
|
print("{}/ProgramOutput.{}".format(label, t['Name']))
|
||||||
f.write(t['Output'] if t['Output'] != None else "")
|
f.write(t['Output'] if t['Output'] != None else "")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -86,15 +88,15 @@ with open_file_create_dir(result_file_name.format(dir=os.getcwd(),
|
||||||
|
|
||||||
for label, tests in tests_per_label.items():
|
for label, tests in tests_per_label.items():
|
||||||
with open_file_create_dir(test_report_filename.format(dir=label,
|
with open_file_create_dir(test_report_filename.format(dir=label,
|
||||||
tester="me",
|
tester=tester_name,
|
||||||
platform="Mon Linux"), 'w') as label_report:
|
platform=platform_name), 'w') as label_report:
|
||||||
print("""
|
print("""
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
- Error output from platform {platform}
|
- Error output from platform {platform}
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
|
|
||||||
{error_txt}
|
{error_txt}
|
||||||
""" .format(platform="Mon Linux",
|
""" .format(platform=platform_name,
|
||||||
error_txt=open("{}/error.txt".format(label), 'r').read()), file=label_report)
|
error_txt=open("{}/error.txt".format(label), 'r').read()), file=label_report)
|
||||||
for t in tests:
|
for t in tests:
|
||||||
filename="{}/ProgramOutput.{}".format(label, t['Name'])
|
filename="{}/ProgramOutput.{}".format(label, t['Name'])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue