xref: /FreeRTOS-Plus-TCP-v3.1.0/test/unit-test/FreeRTOS_ICMP_wo_assert/ut.cmake (revision a4124602cc584fa0658448c229f48a459a84fbb1)
1# Include filepaths for source and include.
2include( ${MODULE_ROOT_DIR}/test/unit-test/TCPFilePaths.cmake )
3
4# ====================  Define your project name (edit) ========================
5set( project_name "FreeRTOS_ICMP_wo_assert" )
6message( STATUS "${project_name}" )
7
8# =====================  Create your mock here  (edit)  ========================
9set(mock_list "")
10
11# list the files to mock here
12list(APPEND mock_list
13            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/task.h"
14            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/list.h"
15            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/queue.h"
16            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/event_groups.h"
17            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Timers.h"
18            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Utils.h"
19            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_ARP.h"
20            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP.h"
21            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_DNS.h"
22            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_Sockets.h"
23            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_DHCP.h"
24            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_Stream_Buffer.h"
25            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_TCP_WIN.h"
26            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_TCP_IP.h"
27            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_UDP_IP.h"
28            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Private.h"
29            "${CMAKE_BINARY_DIR}/Annexed_TCP/NetworkBufferManagement.h"
30            "${CMAKE_BINARY_DIR}/Annexed_TCP/NetworkInterface.h"
31        )
32
33set(mock_include_list "")
34# list the directories your mocks need
35list(APPEND mock_include_list
36            .
37            ${TCP_INCLUDE_DIRS}
38            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
39            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
40            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
41            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
42        )
43
44set(mock_define_list "")
45#list the definitions of your mocks to control what to be included
46list(APPEND mock_define_list
47            ""
48       )
49
50# ================= Create the library under test here (edit) ==================
51
52set(real_source_files "")
53
54# list the files you would like to test here
55list(APPEND real_source_files
56            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources/FreeRTOS_ICMP.c
57            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}/${project_name}_stubs.c
58	)
59
60set(real_include_directories "")
61# list the directories the module under test includes
62list(APPEND real_include_directories
63            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
64            .
65            ${TCP_INCLUDE_DIRS}
66            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
67            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
68            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
69            ${CMOCK_DIR}/vendor/unity/src
70	)
71
72# =====================  Create UnitTest Code here (edit)  =====================
73set(test_include_directories "")
74# list the directories your test needs to include
75list(APPEND test_include_directories
76            ${MODULE_ROOT_DIR}/test/unit-test/${project_name}
77            .
78            ${CMOCK_DIR}/vendor/unity/src
79            ${TCP_INCLUDE_DIRS}
80            ${CMAKE_BINARY_DIR}/Annexed_TCP_Sources
81        )
82
83# =============================  (end edit)  ===================================
84
85set(mock_name "${project_name}_mock")
86set(real_name "${project_name}_real")
87
88create_mock_list(${mock_name}
89                "${mock_list}"
90                "${MODULE_ROOT_DIR}/test/unit-test/cmock/project.yml"
91                "${mock_include_list}"
92                "${mock_define_list}"
93        )
94
95create_real_library(${real_name}
96                    "${real_source_files}"
97                    "${real_include_directories}"
98                    "${mock_name}"
99        )
100
101set( utest_link_list "" )
102list(APPEND utest_link_list
103            -l${mock_name}
104            lib${real_name}.a
105        )
106
107list(APPEND utest_dep_list
108            ${real_name}
109        )
110
111set(utest_name "${project_name}_utest")
112set(utest_source "${project_name}/${project_name}_utest.c")
113
114create_test(${utest_name}
115            ${utest_source}
116            "${utest_link_list}"
117            "${utest_dep_list}"
118            "${test_include_directories}"
119        )
120