Commit 049a4820 authored by Sebastien Barre's avatar Sebastien Barre

More tests + coverage

parent df5131ad
......@@ -21,3 +21,14 @@ CACHE_TEST_VAR2:FILEPATH=bar
//A var.
CACHE_TEST_VAR3:BOOL=1
//A var.
CACHE_TEST_VAR_EXCLUDED:BOOL=1
########################
# INTERNAL cache entries
########################
//A var.
CACHE_TEST_VAR_INTERNAL:INTERNAL=bar
......@@ -19,7 +19,11 @@ IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
LOAD_CACHE(${Complex_SOURCE_DIR})
LOAD_CACHE(${Complex_SOURCE_DIR}
EXCLUDE
CACHE_TEST_VAR_EXCLUDED
INCLUDE_INTERNALS
CACHE_TEST_VAR_INTERNAL)
#
# Configure file
......@@ -31,13 +35,17 @@ CONFIGURE_FILE(
#
# Specify include and lib dirs
# (BEFORE is for coverage)
#
INCLUDE_DIRECTORIES(
${Complex_BINARY_DIR}
${Complex_SOURCE_DIR}/Library
${Complex_SOURCE_DIR}/../../Source
)
INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
LINK_DIRECTORIES(
......@@ -65,6 +73,7 @@ SUBDIR_DEPENDS(Executable Library)
# Exec program (TODO: test a result)
# Increase coverage.
#
MESSAGE("Trying to increase coverage...")
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
IF (NOT NO_EXEC_PROGRAM)
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
......
......@@ -19,6 +19,14 @@ FIND_LIBRARY(CMAKE_LIB
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
#
# Output the files required by 'complex' to a file.
# The 'complex' executable will then test if this file exists and remove it.
# The contents of this file is not tested (absolute paths).
#
#OUTPUT_REQUIRED_FILES(${Complex_SOURCE_DIR}/Executable/complex.cxx
# ${Complex_BINARY_DIR}/Executable/complex-required.txt)
#
# Extra coverage.Not used.
#
......@@ -26,3 +34,4 @@ INSTALL_TARGETS(/tmp complex)
INSTALL_PROGRAMS(/tmp complex)
SOURCE_GROUP(A_GROUP ".cxx")
This diff is collapsed.
......@@ -54,4 +54,5 @@ ABSTRACT_FILES(
)
INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
......@@ -40,6 +40,12 @@ ELSE(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES)
ENDIF(STRING_VAR MATCHES "^CMake")
IF(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND)
ELSE(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND)
ENDIF(COMMAND "IF")
#
# Test FOREACH
#
......@@ -58,5 +64,5 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME)
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE)
FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR})
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
......@@ -25,6 +25,8 @@
#define CACHE_TEST_VAR1 "${CACHE_TEST_VAR1}"
#define CACHE_TEST_VAR2 "${CACHE_TEST_VAR2}"
#define CACHE_TEST_VAR3 "${CACHE_TEST_VAR3}"
#cmakedefine CACHE_TEST_VAR_EXCLUDED
#define CACHE_TEST_VAR_INTERNAL "${CACHE_TEST_VAR_INTERNAL}"
// Test internal CMake vars from C++ flags
......
......@@ -21,3 +21,14 @@ CACHE_TEST_VAR2:FILEPATH=bar
//A var.
CACHE_TEST_VAR3:BOOL=1
//A var.
CACHE_TEST_VAR_EXCLUDED:BOOL=1
########################
# INTERNAL cache entries
########################
//A var.
CACHE_TEST_VAR_INTERNAL:INTERNAL=bar
......@@ -19,7 +19,11 @@ IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
LOAD_CACHE(${Complex_SOURCE_DIR})
LOAD_CACHE(${Complex_SOURCE_DIR}
EXCLUDE
CACHE_TEST_VAR_EXCLUDED
INCLUDE_INTERNALS
CACHE_TEST_VAR_INTERNAL)
#
# Configure file
......@@ -31,13 +35,17 @@ CONFIGURE_FILE(
#
# Specify include and lib dirs
# (BEFORE is for coverage)
#
INCLUDE_DIRECTORIES(
${Complex_BINARY_DIR}
${Complex_SOURCE_DIR}/Library
${Complex_SOURCE_DIR}/../../Source
)
INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
LINK_DIRECTORIES(
......@@ -65,6 +73,7 @@ SUBDIR_DEPENDS(Executable Library)
# Exec program (TODO: test a result)
# Increase coverage.
#
MESSAGE("Trying to increase coverage...")
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
IF (NOT NO_EXEC_PROGRAM)
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
......
......@@ -19,6 +19,14 @@ FIND_LIBRARY(CMAKE_LIB
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
#
# Output the files required by 'complex' to a file.
# The 'complex' executable will then test if this file exists and remove it.
# The contents of this file is not tested (absolute paths).
#
#OUTPUT_REQUIRED_FILES(${Complex_SOURCE_DIR}/Executable/complex.cxx
# ${Complex_BINARY_DIR}/Executable/complex-required.txt)
#
# Extra coverage.Not used.
#
......@@ -26,3 +34,4 @@ INSTALL_TARGETS(/tmp complex)
INSTALL_PROGRAMS(/tmp complex)
SOURCE_GROUP(A_GROUP ".cxx")
......@@ -54,4 +54,5 @@ ABSTRACT_FILES(
)
INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
......@@ -40,6 +40,12 @@ ELSE(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES)
ENDIF(STRING_VAR MATCHES "^CMake")
IF(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND)
ELSE(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND)
ENDIF(COMMAND "IF")
#
# Test FOREACH
#
......@@ -58,5 +64,5 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME)
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE)
FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR})
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
......@@ -25,6 +25,8 @@
#define CACHE_TEST_VAR1 "${CACHE_TEST_VAR1}"
#define CACHE_TEST_VAR2 "${CACHE_TEST_VAR2}"
#define CACHE_TEST_VAR3 "${CACHE_TEST_VAR3}"
#cmakedefine CACHE_TEST_VAR_EXCLUDED
#define CACHE_TEST_VAR_INTERNAL "${CACHE_TEST_VAR_INTERNAL}"
// Test internal CMake vars from C++ flags
......
......@@ -21,3 +21,14 @@ CACHE_TEST_VAR2:FILEPATH=bar
//A var.
CACHE_TEST_VAR3:BOOL=1
//A var.
CACHE_TEST_VAR_EXCLUDED:BOOL=1
########################
# INTERNAL cache entries
########################
//A var.
CACHE_TEST_VAR_INTERNAL:INTERNAL=bar
......@@ -19,7 +19,11 @@ IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
LOAD_CACHE(${Complex_SOURCE_DIR})
LOAD_CACHE(${Complex_SOURCE_DIR}
EXCLUDE
CACHE_TEST_VAR_EXCLUDED
INCLUDE_INTERNALS
CACHE_TEST_VAR_INTERNAL)
#
# Configure file
......@@ -31,13 +35,17 @@ CONFIGURE_FILE(
#
# Specify include and lib dirs
# (BEFORE is for coverage)
#
INCLUDE_DIRECTORIES(
${Complex_BINARY_DIR}
${Complex_SOURCE_DIR}/Library
${Complex_SOURCE_DIR}/../../Source
)
INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$")
LINK_DIRECTORIES(
......@@ -65,6 +73,7 @@ SUBDIR_DEPENDS(Executable Library)
# Exec program (TODO: test a result)
# Increase coverage.
#
MESSAGE("Trying to increase coverage...")
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
IF (NOT NO_EXEC_PROGRAM)
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
......
......@@ -19,6 +19,14 @@ FIND_LIBRARY(CMAKE_LIB
TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB})
#
# Output the files required by 'complex' to a file.
# The 'complex' executable will then test if this file exists and remove it.
# The contents of this file is not tested (absolute paths).
#
#OUTPUT_REQUIRED_FILES(${Complex_SOURCE_DIR}/Executable/complex.cxx
# ${Complex_BINARY_DIR}/Executable/complex-required.txt)
#
# Extra coverage.Not used.
#
......@@ -26,3 +34,4 @@ INSTALL_TARGETS(/tmp complex)
INSTALL_PROGRAMS(/tmp complex)
SOURCE_GROUP(A_GROUP ".cxx")
......@@ -54,4 +54,5 @@ ABSTRACT_FILES(
)
INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
......@@ -40,6 +40,12 @@ ELSE(STRING_VAR MATCHES "^CMake")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES)
ENDIF(STRING_VAR MATCHES "^CMake")
IF(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND)
ELSE(COMMAND "IF")
ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND)
ENDIF(COMMAND "IF")
#
# Test FOREACH
#
......@@ -58,5 +64,5 @@ GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME)
GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT)
GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE)
FIND_PATH(PATH_VAR "VarTests.cmake" ${Complex_SOURCE_DIR})
FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR})
GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME)
......@@ -25,6 +25,8 @@
#define CACHE_TEST_VAR1 "${CACHE_TEST_VAR1}"
#define CACHE_TEST_VAR2 "${CACHE_TEST_VAR2}"
#define CACHE_TEST_VAR3 "${CACHE_TEST_VAR3}"
#cmakedefine CACHE_TEST_VAR_EXCLUDED
#define CACHE_TEST_VAR_INTERNAL "${CACHE_TEST_VAR_INTERNAL}"
// Test internal CMake vars from C++ flags
......
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