xref: /FreeRTOS-Plus-TCP-v3.1.0/test/unit-test/FreeRTOS_ARP/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_ARP" )
6
7message( STATUS "${project_name}" )
8
9# =====================  Create your mock here  (edit)  ========================
10
11# list the files to mock here
12list(APPEND mock_list
13            "${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include/task.h"
14            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP.h"
15            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Timers.h"
16            "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Private.h"
17            "${CMAKE_BINARY_DIR}/Annexed_TCP/NetworkBufferManagement.h"
18        )
19# list the directories your mocks need
20list(APPEND mock_include_list
21            .
22            ${TCP_INCLUDE_DIRS}
23            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
24            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
25            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
26        )
27
28#list the definitions of your mocks to control what to be included
29list(APPEND mock_define_list
30            ""
31       )
32
33# ================= Create the library under test here (edit) ==================
34
35# list the files you would like to test here
36list(APPEND real_source_files
37            ${MODULE_ROOT_DIR}/source/FreeRTOS_ARP.c
38	)
39# list the directories the module under test includes
40list(APPEND real_include_directories
41            .
42            ${TCP_INCLUDE_DIRS}
43            ${MODULE_ROOT_DIR}/test/unit-test/ConfigFiles
44            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/include
45            ${MODULE_ROOT_DIR}/test/FreeRTOS-Kernel/portable/ThirdParty/GCC/Posix
46            ${CMOCK_DIR}/vendor/unity/src
47	)
48
49# =====================  Create UnitTest Code here (edit)  =====================
50
51# list the directories your test needs to include
52list(APPEND test_include_directories
53            .
54            ${CMOCK_DIR}/vendor/unity/src
55            ${TCP_INCLUDE_DIRS}
56        )
57
58# =============================  (end edit)  ===================================
59
60set(mock_name "${project_name}_mock")
61set(real_name "${project_name}_real")
62
63create_mock_list(${mock_name}
64                "${mock_list}"
65                "${MODULE_ROOT_DIR}/test/unit-test/cmock/project.yml"
66                "${mock_include_list}"
67                "${mock_define_list}"
68        )
69
70create_real_library(${real_name}
71                    "${real_source_files}"
72                    "${real_include_directories}"
73                    "${mock_name}"
74        )
75
76list(APPEND utest_link_list
77            -l${mock_name}
78            lib${real_name}.a
79        )
80
81list(APPEND utest_dep_list
82            ${real_name}
83        )
84
85set(utest_name "${project_name}_utest")
86set(utest_source "${project_name}/${project_name}_utest.c")
87
88create_test(${utest_name}
89            ${utest_source}
90            "${utest_link_list}"
91            "${utest_dep_list}"
92            "${test_include_directories}"
93        )
94