Skip to content
Merged
Show file tree
Hide file tree
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
42 changes: 31 additions & 11 deletions netutils/mqttc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
############################################################################
# ##############################################################################
# apps/netutils/mqttc/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# License for the specific language governing permissions and limitations under
# the License.
#
############################################################################
# ##############################################################################

if(CONFIG_NETUTILS_MQTTC)

Expand Down Expand Up @@ -124,4 +124,24 @@ if(CONFIG_NETUTILS_MQTTC)
mqttc)
endif()
endif()

if(CONFIG_NETUTILS_MQTTC_TEST)
set(MQTT_TEST_CFLAGS ${CFLAGS} -Dopen_nb_socket=test_open_nb_socket
-Dpublish_callback=test_publish_callback)

nuttx_add_application(
NAME
cmocka_mqttc_test
STACKSIZE
${CONFIG_NETUTILS_MQTTC_TEST_STACKSIZE}
PRIORITY
${SCHED_PRIORITY_DEFAULT}
SRCS
${MQTTC_DIR}/tests.c
COMPILE_FLAGS
${MQTT_TEST_CFLAGS}
DEPENDS
cmocka
mqttc)
endif()
endif()
12 changes: 12 additions & 0 deletions netutils/mqttc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ config NETUTILS_MQTTC_EXAMPLE
---help---
Enable MQTT-C example

config NETUTILS_MQTTC_TEST
tristate "Enable MQTT-C test"
default n

if NETUTILS_MQTTC_EXAMPLE

config NETUTILS_MQTTC_EXAMPLE_STACKSIZE
Expand All @@ -25,6 +29,14 @@ config NETUTILS_MQTTC_EXAMPLE_STACKSIZE

endif

if NETUTILS_MQTTC_TEST

config NETUTILS_MQTTC_TEST_STACKSIZE
int "Task's stack size"
default 8192

endif

config NETUTILS_MQTTC_WITH_MBEDTLS
bool "Enable MQTT-C with mbedtls"
default n
Expand Down
13 changes: 13 additions & 0 deletions netutils/mqttc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,17 @@ endif

endif

ifneq ($(CONFIG_NETUTILS_MQTTC_TEST),)
$(MQTTC_UNPACK)$(DELIM)tests.c_CFLAGS += \
-I$(APPDIR)$(DELIM)testing$(DELIM)cmocka$(DELIM)cmocka$(DELIM)include \
-Dopen_nb_socket=test_open_nb_socket \
-Dpublish_callback=test_publish_callback

PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = $(CONFIG_NETUTILS_MQTTC_TEST_STACKSIZE)
MODULE = $(CONFIG_NETUTILS_MQTTC_TEST)
MAINSRC += $(MQTTC_UNPACK)$(DELIM)tests.c
PROGNAME += cmocka_mqttc_test
endif

include $(APPDIR)/Application.mk
Loading