Commit f0d7d683 authored by Brian Panneton's avatar Brian Panneton

ENH: Updated the Testing Suite for Test Dependencies. Also fixed Test Option...

ENH: Updated the Testing Suite for Test Dependencies. Also fixed Test Option 'dup' to not delete the rest of the arguments.
parent 20bd7a42
INCLUDE(TestingSetup)
INCLUDE(TestingSetup)
# We should have one place that points to the cxx source directory and the cxx
# binary directory
SET(cxx_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
SET(cxx_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
# We should have one place that points to the cxx source directory and the cxx
# binary directory
SET(cxx_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
SET(cxx_binary_dir ${CMAKE_CURRENT_BINARY_DIR})
# CXX Add Dependencies Macro
# Author: Brian Panneton
# Description: This macro adds the cxx test dependencies.
# Note: The tests already depend on their own file
# Parameters:
# dependencies = any dependencies needed for cxx tests
MACRO(ADD_TEST_CXX_DEPENDENCIES dependencies)
IF(NOT ("${dependencies}" STREQUAL ""))
SET_PROPERTY(GLOBAL APPEND PROPERTY CXX_TEST_DEPENDENCIES
"${dependencies}"
)
ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_CXX_DEPENDENCIES dependencies)
# CXX Add Dependencies Macro
# Author: Brian Panneton
# Description: This macro adds the cxx test dependencies.
# Note: The tests already depend on their own file
# Parameters:
# dependencies = any dependencies needed for cxx tests
MACRO(ADD_TEST_CXX_DEPENDENCIES dependencies)
IF(NOT ("${dependencies}" STREQUAL ""))
SET_PROPERTY(GLOBAL APPEND PROPERTY CXX_TEST_DEPENDENCIES
"${dependencies}"
)
ENDIF(NOT ("${dependencies}" STREQUAL ""))
ENDMACRO(ADD_TEST_CXX_DEPENDENCIES dependencies)
# Cxx Add LDPath Macro
# Author: Brian Panneton
......@@ -47,43 +47,44 @@ MACRO(ADD_TEST_CXX_PATH p)
ENDIF("${p}" STRGREATER "")
ENDMACRO(ADD_TEST_CXX_PATH p)
# CXX Test Macro
# Author: Brian Panneton
# Description: This macro builds and add the cxx test in one shot.
# Parameters:
# executable = executable name
# ${ARGN} = any arguments for the executable
MACRO(ADD_TEST_CXX executable)
PARSE_TEST_ARGS("${ARGN}")
IF(EXISTS ${cxx_source_dir}/${executable}.cpp)
ADD_EXECUTABLE(${executable}${dup} ${cxx_source_dir}/${executable}.cpp)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cpp)
# CXX Test Macro
# Author: Brian Panneton
# Description: This macro builds and add the cxx test in one shot.
# Parameters:
# executable = executable name
# dup = duplicate number
# tdep = test dependency (Full Test Name with Prefix)
# ${ARGN} = any arguments for the executable
MACRO(ADD_TEST_CXX executable)
PARSE_TEST_ARGS("${ARGN}")
IF(EXISTS ${cxx_source_dir}/${executable}.cpp)
ADD_EXECUTABLE(${executable}${dup} ${cxx_source_dir}/${executable}.cpp)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cpp)
IF(EXISTS ${cxx_source_dir}/${executable}.cxx)
ADD_EXECUTABLE(${executable}${dup} ${cxx_source_dir}/${executable}.cxx)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx)
IF(EXISTS ${cxx_source_dir}/${executable}.cxx)
ADD_EXECUTABLE(${executable}${dup} ${cxx_source_dir}/${executable}.cxx)
ENDIF(EXISTS ${cxx_source_dir}/${executable}.cxx)
GET_PROPERTY(cxx_dependencies GLOBAL PROPERTY CXX_TEST_DEPENDENCIES)
GET_PROPERTY(cxx_dependencies GLOBAL PROPERTY CXX_TEST_DEPENDENCIES)
GET_PROPERTY(cxx_ldpath GLOBAL PROPERTY CXX_TEST_LDPATH)
GET_PROPERTY(cxx_path GLOBAL PROPERTY CXX_TEST_PATH)
TARGET_LINK_LIBRARIES(${executable}${dup} ${cxx_dependencies})
TARGET_LINK_LIBRARIES(${executable}${dup} ${cxx_dependencies})
# Take care of windowisims
IF(WIN32)
SET_TARGET_PROPERTIES(${executable}${dup} PROPERTIES
PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${cxx_binary_dir}
LIBRARY_OUTPUT_DIRECTORY ${cxx_binary_dir}
ARCHIVE_OUTPUT_DIRECTORY ${cxx_binary_dir})
PREFIX ../
RUNTIME_OUTPUT_DIRECTORY ${cxx_binary_dir}
LIBRARY_OUTPUT_DIRECTORY ${cxx_binary_dir}
ARCHIVE_OUTPUT_DIRECTORY ${cxx_binary_dir})
IF("${cxx_path}" STREQUAL "")
SET(cxx_path ${cxx_ldpath})
ENDIF("${cxx_path}" STREQUAL "")
ENDIF(WIN32)
SET_CORE("${cxx_binary_dir}")
SET_CORE("${cxx_binary_dir}")
ADD_TEST(Cxx${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}"
......@@ -91,20 +92,24 @@ ENDMACRO(ADD_TEST_CXX_PATH p)
-D "PATH=${cxx_path}"
-D "SEPARATOR=${sep}"
-P "${cxx_binary_dir}/TestDriverCxx.cmake"
)
ENDMACRO(ADD_TEST_CXX executable)
)
IF(NOT "${tdep}" STREQUAL "")
SET_TESTS_PROPERTIES(Cxx${is_core}_${executable}${dup}
PROPERTIES DEPENDS ${tdep})
ENDIF(NOT "${tdep}" STREQUAL "")
ENDMACRO(ADD_TEST_CXX executable)
# CXX Clean Macro
# Author: Brian Panneton
# Description: This macro sets up the cxx test for a make clean.
# Parameters:
# executable = executable name
# ${ARGN} = files that the executable created
MACRO(CLEAN_TEST_CXX executable)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES ${ARGN}
)
ENDMACRO(CLEAN_TEST_CXX executable)
# CXX Clean Macro
# Author: Brian Panneton
# Description: This macro sets up the cxx test for a make clean.
# Parameters:
# executable = executable name
# ${ARGN} = files that the executable created
MACRO(CLEAN_TEST_CXX executable)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES ${ARGN}
)
ENDMACRO(CLEAN_TEST_CXX executable)
# Configure the cxx 'driver' file
CONFIGURE_FILE(${TESTING_SUITE_DIR}/TestingSuite/TestDriverCxx.cmake.in ${cxx_binary_dir}/TestDriverCxx.cmake @ONLY)
......
......@@ -122,6 +122,10 @@ MACRO(ADD_TEST_JAVA executable)
-D "SEPARATOR=${sep}"
-P "${java_binary_dir}/TestDriverJava.cmake"
)
IF(NOT "${tdep}" STREQUAL "")
SET_TESTS_PROPERTIES(Java${is_core}_${executable}${dup}
PROPERTIES DEPENDS ${tdep})
ENDIF(NOT "${tdep}" STREQUAL "")
ENDMACRO(ADD_TEST_JAVA executable)
# Java Clean Macro
......
......@@ -126,6 +126,10 @@ MACRO(ADD_TEST_PYTHON executable)
-D "SEPARATOR=${sep}"
-P "${python_binary_dir}/TestDriverPython.cmake"
)
IF(NOT "${tdep}" STREQUAL "")
SET_TESTS_PROPERTIES(Python${is_core}_${executable}${dup}
PROPERTIES DEPENDS ${tdep})
ENDIF(NOT "${tdep}" STREQUAL "")
ENDMACRO(ADD_TEST_PYTHON executable)
......
# List of global variables needed by tests
SET(defines
JAVA_TEST_DEPENDENCIES
JAVA_TEST_FILE_DEPENDENCIES
JAVA_TEST_DEPENDENCIES
JAVA_TEST_FILE_DEPENDENCIES
JAVA_TEST_CLASSPATH
JAVA_TEST_LDPATH
JAVA_TEST_LDPATH
JAVA_TEST_PATH
JAVA_TEST_TARGETS
PYTHON_TEST_DEPENDENCIES
JAVA_TEST_TARGETS
PYTHON_TEST_DEPENDENCIES
PYTHON_TEST_FILE_DEPENDENCIES
PYTHON_TEST_PYTHONPATH
PYTHON_TEST_PYTHONPATH
PYTHON_TEST_LDPATH
PYTHON_TEST_PATH
CXX_TEST_DEPENDENCIES
......@@ -25,17 +25,18 @@ ENDIF(WIN32)
# Make sure they are defined
FOREACH(def IN LISTS defines)
GET_PROPERTY(is_defined GLOBAL PROPERTY ${def} DEFINED)
IF(NOT is_defined)
DEFINE_PROPERTY(GLOBAL PROPERTY ${def}
GET_PROPERTY(is_defined GLOBAL PROPERTY ${def} DEFINED)
IF(NOT is_defined)
DEFINE_PROPERTY(GLOBAL PROPERTY ${def}
BRIEF_DOCS "${def}"
FULL_DOCS "${def} No Documentation"
)
ENDIF()
)
ENDIF()
ENDFOREACH()
# Set the testing suite dir
SET(TESTING_SUITE_DIR "${CMAKE_SOURCE_DIR}/CMake" CACHE PATH "Testing Suite CMake Dir")
SET(TESTING_SUITE_DIR "${CMAKE_SOURCE_DIR}/CMake" CACHE PATH
"Testing Suite CMake Dir")
MARK_AS_ADVANCED(TESTING_SUITE_DIR)
# Argument Parsing Macro
......@@ -46,22 +47,28 @@ MARK_AS_ADVANCED(TESTING_SUITE_DIR)
# Output:
# ${arguments} = whatever is left after stripping the arguments
# ${dup} = number or string to append to a duplicate test
#
# ${tdep} = test dependencies (comma seperated list)
MACRO(PARSE_TEST_ARGS test_args)
STRING(COMPARE NOTEQUAL "${test_args}" "" check)
IF(${check})
SET(arguments "${test_args}")
# Here we strip out any arguments for the testing suite
# ${dup}
STRING(REGEX MATCH "dup=.*;" dup "${test_args}")
STRING(REGEX REPLACE "dup=" "" dup "${dup}")
STRING(REGEX REPLACE ";" "" dup "${dup}")
STRING(REGEX REPLACE "dup=.*;" "" arguments "${arguments}")
ELSE(${check})
SET(arguments "") # Sanity Check
ENDIF(${check})
STRING(COMPARE NOTEQUAL "${test_args}" "" check)
IF(${check})
SET(arguments "${test_args}")
# Here we strip out any arguments for the testing suite
# ${dup}
STRING(REGEX MATCH "dup=([^ ;])+" dup "${test_args}")
STRING(REGEX REPLACE "dup=" "" dup "${dup}")
STRING(REGEX REPLACE ";" "" dup "${dup}")
STRING(REGEX REPLACE "dup=([^ ;])+" "" arguments "${arguments}")
# ${tdep}
STRING(REGEX MATCH "tdep=([^ ;])+" tdep "${test_args}")
STRING(REGEX REPLACE "tdep=" "" tdep "${tdep}")
STRING(REGEX REPLACE ";" "" tdep "${tdep}")
STRING(REGEX REPLACE "tdep=([^ ;])+" "" arguments "${arguments}")
STRING(REGEX REPLACE "," ";" tdep "${tdep}")
ELSE(${check})
SET(arguments "") # Sanity Check
ENDIF(${check})
ENDMACRO(PARSE_TEST_ARGS test_args)
# Set Core Macro
......@@ -72,8 +79,8 @@ ENDMACRO(PARSE_TEST_ARGS test_args)
# Output:
# is_core = variable is set to 'Core' is core was found in dir
MACRO(SET_CORE dir)
STRING(REGEX MATCH "core" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Core")
ENDIF(EXISTS ${is_core})
STRING(REGEX MATCH "core" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Core")
ENDIF(EXISTS ${is_core})
ENDMACRO(SET_CORE dir)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment