TestingSetup.cmake 2.9 KB
Newer Older
1 2
# List of global variables needed by tests
SET(defines 
3 4
    JAVA_TEST_DEPENDENCIES
    JAVA_TEST_FILE_DEPENDENCIES
5
    JAVA_TEST_CLASSPATH
6
    JAVA_TEST_LDPATH
7
    JAVA_TEST_PATH
8 9
    JAVA_TEST_TARGETS
    PYTHON_TEST_DEPENDENCIES
10
    PYTHON_TEST_FILE_DEPENDENCIES
11
    PYTHON_TEST_PYTHONPATH
12 13 14
    PYTHON_TEST_LDPATH
    PYTHON_TEST_PATH
    CXX_TEST_DEPENDENCIES
15 16
    CXX_TEST_LDPATH
    CXX_TEST_PATH
17 18
)

19 20 21
# Take care of Windows Path Seperators
IF(WIN32)
    SET(sep ";")
22
ELSE()
23
    SET(sep ":")
24
ENDIF()
25

26 27
# Make sure they are defined
FOREACH(def IN LISTS defines)
28 29 30
    GET_PROPERTY(is_defined GLOBAL PROPERTY ${def} DEFINED)
    IF(NOT is_defined)
        DEFINE_PROPERTY(GLOBAL PROPERTY ${def}
31 32
			BRIEF_DOCS "${def}"
			FULL_DOCS "${def} No Documentation"
33 34
        )
    ENDIF()
35 36 37
ENDFOREACH()

# Set the testing suite dir
38 39
SET(TESTING_SUITE_DIR "${CMAKE_SOURCE_DIR}/CMake" CACHE PATH 
    "Testing Suite CMake Dir")
40 41 42 43 44 45 46 47 48 49
MARK_AS_ADVANCED(TESTING_SUITE_DIR)

# Argument Parsing Macro
# Author: Brian Panneton
# Description: This macro parses the provided argument string and sets the vars
# Parameters:         
#        	${test_args}    = the argument string for the test
# Output:	
#		${arguments}	= whatever is left after stripping the arguments
#		${dup}		= number or string to append to a duplicate test
50
#		${tdep}		= test dependencies (comma seperated list)
51
MACRO(PARSE_TEST_ARGS test_args)
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    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}")
69
    ELSE()
70
        SET(arguments "") # Sanity Check	
71 72
    ENDIF()
ENDMACRO()
73 74 75 76 77 78 79 80 81

# Set Core Macro
# Author: Brian Panneton
# Description: This macro checks the directory provided to see if it is a core
# Parameters:         
#               dir    	= the directory to be checked
# Output:     
#		is_core	= variable is set to 'Core' is core was found in dir
MACRO(SET_CORE dir)
82 83 84 85
    IF(NOT "${XDMF_SUBSECTION}" STREQUAL "")
      set(is_core ${XDMF_SUBSECTION})
    ELSE()
      STRING(REGEX MATCH "core" is_core "${dir}")
86
      IF(EXISTS ${is_core})
87 88 89 90 91 92
          SET(is_core "Core")
      ELSE(EXISTS ${is_core})
        STRING(REGEX MATCH "utils" is_core "${dir}")
        IF(EXISTS ${is_core})
            SET(is_core "Util")
        ENDIF(EXISTS ${is_core})
93
      ENDIF(EXISTS ${is_core})
94
    ENDIF(NOT "${XDMF_SUBSECTION}" STREQUAL "")
95
ENDMACRO(SET_CORE dir)