File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -124,4 +124,24 @@ if(CONFIG_NETUTILS_MQTTC)
124124 mqttc)
125125 endif ()
126126 endif ()
127+
128+ if (CONFIG_NETUTILS_MQTTC_TEST)
129+ set (MQTT_TEST_CFLAGS ${CFLAGS} -Dopen_nb_socket=test_open_nb_socket
130+ -Dpublish_callback=test_publish_callback)
131+
132+ nuttx_add_application(
133+ NAME
134+ cmocka_mqttc_test
135+ STACKSIZE
136+ ${CONFIG_NETUTILS_MQTTC_TEST_STACKSIZE}
137+ PRIORITY
138+ ${SCHED_PRIORITY_DEFAULT}
139+ SRCS
140+ ${MQTTC_DIR} /tests.c
141+ COMPILE_FLAGS
142+ ${MQTT_TEST_CFLAGS}
143+ DEPENDS
144+ cmocka
145+ mqttc)
146+ endif ()
127147endif ()
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ config NETUTILS_MQTTC_EXAMPLE
1717 ---help---
1818 Enable MQTT-C example
1919
20+ config NETUTILS_MQTTC_TEST
21+ tristate "Enable MQTT-C test"
22+ default n
23+
2024if NETUTILS_MQTTC_EXAMPLE
2125
2226config NETUTILS_MQTTC_EXAMPLE_STACKSIZE
@@ -25,6 +29,14 @@ config NETUTILS_MQTTC_EXAMPLE_STACKSIZE
2529
2630endif
2731
32+ if NETUTILS_MQTTC_TEST
33+
34+ config NETUTILS_MQTTC_TEST_STACKSIZE
35+ int "Task's stack size"
36+ default 8192
37+
38+ endif
39+
2840config NETUTILS_MQTTC_WITH_MBEDTLS
2941 bool "Enable MQTT-C with mbedtls"
3042 default n
Original file line number Diff line number Diff line change 8383
8484endif
8585
86+ ifneq ($(CONFIG_NETUTILS_MQTTC_TEST ) ,)
87+ $(MQTTC_UNPACK)$(DELIM)tests.c_CFLAGS += \
88+ -I$(APPDIR )$(DELIM ) testing$(DELIM ) cmocka$(DELIM ) cmocka$(DELIM ) include \
89+ -Dopen_nb_socket=test_open_nb_socket \
90+ -Dpublish_callback=test_publish_callback
91+
92+ PRIORITY = SCHED_PRIORITY_DEFAULT
93+ STACKSIZE = $(CONFIG_NETUTILS_MQTTC_TEST_STACKSIZE )
94+ MODULE = $(CONFIG_NETUTILS_MQTTC_TEST )
95+ MAINSRC += $(MQTTC_UNPACK )$(DELIM ) tests.c
96+ PROGNAME += cmocka_mqttc_test
97+ endif
98+
8699include $(APPDIR ) /Application.mk
You can’t perform that action at this time.
0 commit comments