forked from jcfr/ResEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 4 tests : closes jcfr#4 - ResEditNoCommand - ResEditCommandHelp - ResEditCommandList - ResEditCommandUpdateIco Add CTestConfig.cmake, closes jcfr#3
- Loading branch information
unknown
authored and
unknown
committed
Apr 12, 2012
1 parent
e17eeae
commit 06ab401
Showing
12 changed files
with
935 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
# | ||
# Included from a dashboard script, this cmake file will drive the configure and build | ||
# steps of ResEdit | ||
# | ||
|
||
#----------------------------------------------------------------------------- | ||
# The following variable are expected to be define in the top-level script: | ||
set(expected_variables | ||
ADDITIONNAL_CMAKECACHE_OPTION | ||
CTEST_NOTES_FILES | ||
CTEST_SITE | ||
CTEST_DASHBOARD_ROOT | ||
CTEST_CMAKE_COMMAND | ||
CTEST_CMAKE_GENERATOR | ||
WITH_MEMCHECK | ||
WITH_COVERAGE | ||
WITH_DOCUMENTATION | ||
CTEST_BUILD_CONFIGURATION | ||
CTEST_TEST_TIMEOUT | ||
CTEST_BUILD_FLAGS | ||
TEST_TO_EXCLUDE_REGEX | ||
CTEST_PROJECT_NAME | ||
CTEST_SOURCE_DIRECTORY | ||
CTEST_BINARY_DIRECTORY | ||
CTEST_BUILD_NAME | ||
SCRIPT_MODE | ||
CTEST_COVERAGE_COMMAND | ||
CTEST_MEMORYCHECK_COMMAND | ||
CTEST_GIT_COMMAND | ||
QT_QMAKE_EXECUTABLE | ||
) | ||
if(WITH_DOCUMENTATION) | ||
list(APPEND expected_variables DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY) | ||
endif() | ||
|
||
foreach(var ${expected_variables}) | ||
if(NOT DEFINED ${var}) | ||
message(FATAL_ERROR "Variable ${var} should be defined in top-level script !") | ||
endif() | ||
endforeach() | ||
|
||
# If the dashscript doesn't define a GIT_REPOSITORY variable, let's define it here. | ||
if (NOT DEFINED GIT_REPOSITORY OR GIT_REPOSITORY STREQUAL "") | ||
set(GIT_REPOSITORY git://github.com/benjaminlong/ResEdit.git) | ||
endif() | ||
|
||
# Should binary directory be cleaned? | ||
set(empty_binary_directory FALSE) | ||
|
||
# Attempt to build and test also if 'ctest_update' returned an error | ||
set(force_build FALSE) | ||
|
||
# Set model options | ||
set(model "") | ||
if (SCRIPT_MODE STREQUAL "experimental") | ||
set(empty_binary_directory FALSE) | ||
set(force_build TRUE) | ||
set(model Experimental) | ||
elseif (SCRIPT_MODE STREQUAL "continuous") | ||
set(empty_binary_directory TRUE) | ||
set(force_build FALSE) | ||
set(model Continuous) | ||
elseif (SCRIPT_MODE STREQUAL "nightly") | ||
set(empty_binary_directory TRUE) | ||
set(force_build TRUE) | ||
set(model Nightly) | ||
else() | ||
message(FATAL_ERROR "Unknown script mode: '${SCRIPT_MODE}'. Script mode should be either 'experimental', 'continuous' or 'nightly'") | ||
endif() | ||
|
||
#message("script_mode:${SCRIPT_MODE}") | ||
#message("model:${model}") | ||
#message("empty_binary_directory:${empty_binary_directory}") | ||
#message("force_build:${force_build}") | ||
|
||
set(track ${model}) | ||
if(WITH_PACKAGES) | ||
set(track "${track}-Packages") | ||
endif() | ||
set(track ${CTEST_TRACK_PREFIX}${track}${CTEST_TRACK_SUFFIX}) | ||
|
||
# For more details, see http://www.kitware.com/blog/home/post/11 | ||
set(CTEST_USE_LAUNCHERS 0) | ||
#if (NOT ${CTEST_CMAKE_GENERATOR} MATCHES "Visual Studio") | ||
# set(CTEST_USE_LAUNCHERS 1) | ||
#endif() | ||
|
||
if(empty_binary_directory) | ||
message("Directory ${CTEST_BINARY_DIRECTORY} cleaned !") | ||
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) | ||
endif() | ||
|
||
if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") | ||
set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone ${GIT_REPOSITORY} ${CTEST_SOURCE_DIRECTORY}") | ||
endif() | ||
|
||
set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") | ||
set(CTEST_SOURCE_DIRECTORY "${CTEST_SOURCE_DIRECTORY}") | ||
|
||
# | ||
# run_ctest macro | ||
# | ||
macro(run_ctest) | ||
ctest_start(${model} TRACK ${track}) | ||
ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE FILES_UPDATED) | ||
|
||
# force a build if this is the first run and the build dir is empty | ||
if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt") | ||
message("First time build - Initialize CMakeCache.txt") | ||
set(force_build 1) | ||
|
||
if(WITH_EXTENSIONS) | ||
set(ADDITIONAL_CMAKECACHE_OPTION | ||
"${ADDITIONAL_CMAKECACHE_OPTION} CTEST_MODEL:STRING=${model}") | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Write initial cache. | ||
#----------------------------------------------------------------------------- | ||
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " | ||
QT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} | ||
GIT_EXECUTABLE:FILEPATH=${CTEST_GIT_COMMAND} | ||
WITH_COVERAGE:BOOL=${WITH_COVERAGE} | ||
DOCUMENTATION_TARGET_IN_ALL:BOOL=${WITH_DOCUMENTATION} | ||
DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY:PATH=${DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY} | ||
${ADDITIONAL_CMAKECACHE_OPTION} | ||
") | ||
endif() | ||
|
||
if(FILES_UPDATED GREATER 0 OR force_build) | ||
|
||
set(force_build 0) | ||
|
||
#----------------------------------------------------------------------------- | ||
# The following variable can be used while testing the driver scripts | ||
#----------------------------------------------------------------------------- | ||
set(run_ctest_submit TRUE) | ||
set(run_ctest_with_update TRUE) | ||
set(run_ctest_with_configure TRUE) | ||
set(run_ctest_with_build TRUE) | ||
set(run_ctest_with_test TRUE) | ||
set(run_ctest_with_coverage TRUE) | ||
set(run_ctest_with_memcheck TRUE) | ||
set(run_ctest_with_packages TRUE) | ||
set(run_ctest_with_notes TRUE) | ||
|
||
#----------------------------------------------------------------------------- | ||
# Update | ||
#----------------------------------------------------------------------------- | ||
if(run_ctest_with_update AND run_ctest_submit) | ||
ctest_submit(PARTS Update) | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Configure | ||
#----------------------------------------------------------------------------- | ||
if(run_ctest_with_configure) | ||
message("----------- [ Configure ${CTEST_PROJECT_NAME} ] -----------") | ||
|
||
set(label ResEdit) | ||
|
||
set_property(GLOBAL PROPERTY SubProject ${label}) | ||
set_property(GLOBAL PROPERTY Label ${label}) | ||
|
||
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}") | ||
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}") | ||
if(run_ctest_submit) | ||
ctest_submit(PARTS Configure) | ||
endif() | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Build top level | ||
#----------------------------------------------------------------------------- | ||
set(build_errors) | ||
if(run_ctest_with_build) | ||
message("----------- [ Build ${CTEST_PROJECT_NAME} ] -----------") | ||
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" NUMBER_ERRORS build_errors APPEND) | ||
if(run_ctest_submit) | ||
ctest_submit(PARTS Build) | ||
endif() | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Inner build directory | ||
#----------------------------------------------------------------------------- | ||
set(resedit_build_dir "${CTEST_BINARY_DIRECTORY}") | ||
|
||
#----------------------------------------------------------------------------- | ||
# Test | ||
#----------------------------------------------------------------------------- | ||
if(run_ctest_with_test) | ||
message("----------- [ Test ${CTEST_PROJECT_NAME} ] -----------") | ||
ctest_test( | ||
BUILD "${resedit_build_dir}" | ||
INCLUDE_LABEL ${label} | ||
PARALLEL_LEVEL ${CTEST_PARALLEL_LEVEL} | ||
EXCLUDE ${TEST_TO_EXCLUDE_REGEX}) | ||
# runs only tests that have a LABELS property matching "${label}" | ||
if(run_ctest_submit) | ||
ctest_submit(PARTS Test) | ||
endif() | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Global coverage ... | ||
#----------------------------------------------------------------------------- | ||
if(run_ctest_with_coverage) | ||
# HACK Unfortunately ctest_coverage ignores the BUILD argument, try to force it... | ||
file(READ ${resedit_build_dir}/CMakeFiles/TargetDirectories.txt resedit_build_coverage_dirs) | ||
file(APPEND "${CTEST_BINARY_DIRECTORY}/CMakeFiles/TargetDirectories.txt" "${resedit_build_coverage_dirs}") | ||
|
||
if(WITH_COVERAGE AND CTEST_COVERAGE_COMMAND) | ||
message("----------- [ Global coverage ] -----------") | ||
ctest_coverage(BUILD "${resedit_build_dir}") | ||
if(run_ctest_submit) | ||
ctest_submit(PARTS Coverage) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Global dynamic analysis ... | ||
#----------------------------------------------------------------------------- | ||
if(WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND AND run_ctest_with_memcheck) | ||
message("----------- [ Global memcheck ] -----------") | ||
ctest_memcheck(BUILD "${resedit_build_dir}") | ||
if(run_ctest_submit) | ||
ctest_submit(PARTS MemCheck) | ||
endif() | ||
endif() | ||
|
||
#----------------------------------------------------------------------------- | ||
# Note should be at the end | ||
#----------------------------------------------------------------------------- | ||
if(run_ctest_with_notes AND run_ctest_submit) | ||
ctest_submit(PARTS Notes) | ||
endif() | ||
|
||
endif() | ||
endmacro() | ||
|
||
if(SCRIPT_MODE STREQUAL "continuous") | ||
while(${CTEST_ELAPSED_TIME} LESS 68400) | ||
set(START_TIME ${CTEST_ELAPSED_TIME}) | ||
run_ctest() | ||
# Loop no faster than once every 5 minutes | ||
message("Wait for 5 minutes ...") | ||
ctest_sleep(${START_TIME} 300 ${CTEST_ELAPSED_TIME}) | ||
endwhile() | ||
else() | ||
run_ctest() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# | ||
# OS: Ubuntu 9.04 2.6.28-18-generic | ||
# Hardware: x86_64 GNU/Linux | ||
# GPU: NA | ||
# | ||
|
||
# Note: The specific version and processor type of this machine should be reported in the | ||
# header above. Indeed, this file will be send to the dashboard as a NOTE file. | ||
|
||
cmake_minimum_required(VERSION 2.8) | ||
|
||
# | ||
# For additional information, see http://www.commontk.org/index.php/Dashboard_setup | ||
# | ||
|
||
# | ||
# Dashboard properties | ||
# | ||
set(MY_OPERATING_SYSTEM "Windows7") # Windows, Linux, Darwin... | ||
set(MY_COMPILER "VS2010express") | ||
set(MY_QT_VERSION "4.7.3") | ||
set(QT_QMAKE_EXECUTABLE "C:/work/Qt/qt-everywhere-opensource-src-4.7.3/bin/qmake.exe") | ||
set(CTEST_SITE "Alienware.kitware") # for example: mymachine.kitware, mymachine.dkfz, ... | ||
set(CTEST_DASHBOARD_ROOT "C:/work/ResEdit/Dashboards") | ||
|
||
# | ||
# Dashboard options | ||
# | ||
set(WITH_KWSTYLE FALSE) | ||
set(WITH_MEMCHECK FALSE) | ||
set(WITH_COVERAGE FALSE) | ||
set(WITH_DOCUMENTATION FALSE) | ||
#set(DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY ) # for example: $ENV{HOME}/Projects/Doxygen | ||
set(CTEST_BUILD_CONFIGURATION "Debug") | ||
set(CTEST_TEST_TIMEOUT 500) | ||
set(CTEST_BUILD_FLAGS "") # Use multiple CPU cores to build | ||
|
||
# experimental: | ||
# - run_ctest() macro will be called *ONE* time | ||
# - binary directory will *NOT* be cleaned | ||
# continuous: | ||
# - run_ctest() macro will be called EVERY 5 minutes ... | ||
# - binary directory will *NOT* be cleaned | ||
# - configure/build will be executed *ONLY* if the repository has been updated | ||
# nightly: | ||
# - run_ctest() macro will be called *ONE* time | ||
# - binary directory *WILL BE* cleaned | ||
set(SCRIPT_MODE "experimental") # "experimental", "continuous", "nightly" | ||
|
||
# | ||
# Project specific properties | ||
# | ||
set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/ResEdit") | ||
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/ResEdit-build-${CTEST_BUILD_CONFIGURATION}-${SCRIPT_MODE}") | ||
|
||
# Additionnal CMakeCache options - For example: | ||
# CTK_LIB_Widgets:BOOL=ON | ||
# CTK_APP_ctkDICOM:BOOL=ON | ||
|
||
set(ADDITIONNAL_CMAKECACHE_OPTION " | ||
#CTK_LIB_Scripting/Python/Widgets:BOOL=ON | ||
") | ||
|
||
# List of test that should be explicitly disabled on this machine | ||
set(TEST_TO_EXCLUDE_REGEX "") | ||
|
||
# set any extra environment variables here | ||
set(ENV{DISPLAY} ":0") | ||
|
||
find_program(CTEST_COVERAGE_COMMAND NAMES gcov) | ||
find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind) | ||
find_program(CTEST_GIT_COMMAND NAMES git) | ||
|
||
# | ||
# Git repository - Overwrite the default value provided by the driver script | ||
# | ||
# set(GIT_REPOSITORY http://github.com/YOURUSERNAME/CTK.git) | ||
|
||
########################################## | ||
# WARNING: DO NOT EDIT BEYOND THIS POINT # | ||
########################################## | ||
|
||
set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") | ||
|
||
# | ||
# Project specific properties | ||
# | ||
set(CTEST_PROJECT_NAME "ResEdit") | ||
set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM}-${MY_COMPILER}-QT${MY_QT_VERSION}-${CTEST_BUILD_CONFIGURATION}") | ||
|
||
# | ||
# Display build info | ||
# | ||
message("site name: ${CTEST_SITE}") | ||
message("build name: ${CTEST_BUILD_NAME}") | ||
message("script mode: ${SCRIPT_MODE}") | ||
message("coverage: ${WITH_COVERAGE}, memcheck: ${WITH_MEMCHECK}") | ||
|
||
# | ||
# Convenient macro allowing to download a file | ||
# | ||
macro(downloadFile url dest) | ||
file(DOWNLOAD ${url} ${dest} STATUS status) | ||
list(GET status 0 error_code) | ||
list(GET status 1 error_msg) | ||
if(error_code) | ||
message(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}") | ||
endif() | ||
endmacro() | ||
|
||
# | ||
# Download and include dashboard driver script | ||
# | ||
#set(url https://github.com/benjaminlong/ResEdit/blob/master/CMake/reseditDashboardDriverScript.cmake) | ||
set(dest ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}.driver) | ||
#downloadfile(${url} ${dest}) | ||
message("CTEST_SCRIPT_DIRECTORY : ${CTEST_SCRIPT_DIRECTORY}") | ||
message("CTEST_SCRIPT_NAME : ${CTEST_SCRIPT_NAME}") | ||
include(${dest}) | ||
|
Oops, something went wrong.