Skip to content

Trigger unit test CMake build failure with error message if unifdefall command is not present #1254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 45 additions & 39 deletions test/unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,46 +176,52 @@ foreach( file ${TCP_INCLUDES} )
endif()



# Use this tool to process all conditional declarations.
if(${MODIFIED_FILE} STREQUAL "FreeRTOS_Routing" OR ${MODIFIED_FILE} STREQUAL "FreeRTOS_IP_Private" )
execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT
-UipTRUE_BOOL
-UipFALSE_BOOL
-UFreeRTOS_htonl
-D__COVERITY__
-DTEST
-DipconfigIS_ENABLED
-DipconfigUSE_IPv6
-DipconfigUSE_RA
-I ${MODULE_ROOT_DIR}/tools/CMock/vendor/unity/src
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
-I ${UNIT_TEST_DIR}/ConfigFiles
-I ${MODULE_ROOT_DIR}/source/include
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}_tmp.h
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_FILE ${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}.h
OUTPUT_QUIET
ERROR_QUIET )
# Find the unifdefall executable
find_program(UNIFDEFALL_EXECUTABLE unifdefall)

if (UNIFDEFALL_EXECUTABLE)
# Use this tool to process all conditional declarations.
if(${MODIFIED_FILE} STREQUAL "FreeRTOS_Routing" OR ${MODIFIED_FILE} STREQUAL "FreeRTOS_IP_Private" )
execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT
-UipTRUE_BOOL
-UipFALSE_BOOL
-UFreeRTOS_htonl
-D__COVERITY__
-DTEST
-DipconfigIS_ENABLED
-DipconfigUSE_IPv6
-DipconfigUSE_RA
-I ${MODULE_ROOT_DIR}/tools/CMock/vendor/unity/src
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
-I ${UNIT_TEST_DIR}/ConfigFiles
-I ${MODULE_ROOT_DIR}/source/include
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}_tmp.h
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_FILE ${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}.h
OUTPUT_QUIET
ERROR_QUIET )
else()
execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT
-UipTRUE_BOOL
-UipFALSE_BOOL
-UFreeRTOS_htonl
-D__COVERITY__
-DTEST
-DipconfigIS_ENABLED
-I ${MODULE_ROOT_DIR}/tools/CMock/vendor/unity/src
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
-I ${UNIT_TEST_DIR}/ConfigFiles
-I ${MODULE_ROOT_DIR}/source/include
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}_tmp.h
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_FILE ${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}.h
OUTPUT_QUIET
ERROR_QUIET )
endif()
else()
execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT
-UipTRUE_BOOL
-UipFALSE_BOOL
-UFreeRTOS_htonl
-D__COVERITY__
-DTEST
-DipconfigIS_ENABLED
-I ${MODULE_ROOT_DIR}/tools/CMock/vendor/unity/src
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
-I ${UNIT_TEST_DIR}/ConfigFiles
-I ${MODULE_ROOT_DIR}/source/include
-I ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}_tmp.h
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_FILE ${CMAKE_BINARY_DIR}/Annexed_TCP/${MODIFIED_FILE}.h
OUTPUT_QUIET
ERROR_QUIET )
message(FATAL_ERROR "Error: unifdefall command not found.")
endif()

# Remove the temporary files
Expand Down