diff --git a/components/mqtt/.build-test-rules.yml b/components/mqtt/.build-test-rules.yml new file mode 100644 index 0000000000..5a5f690987 --- /dev/null +++ b/components/mqtt/.build-test-rules.yml @@ -0,0 +1,7 @@ +# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps + +components/mqtt/test_apps: + disable_test: + - if: IDF_TARGET not in ["esp32", "esp32c2"] + temporary: false + reason: Not needed to test on all targets (chosen two, one for each architecture) diff --git a/components/mqtt/test_apps/common/CMakeLists.txt b/components/mqtt/test_apps/common/CMakeLists.txt new file mode 100644 index 0000000000..97ab3b53bc --- /dev/null +++ b/components/mqtt/test_apps/common/CMakeLists.txt @@ -0,0 +1,4 @@ + +idf_component_register(SRCS test_mqtt_connection.c + INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/include + PRIV_REQUIRES unity esp_event esp_netif esp_eth) diff --git a/components/mqtt/test/test_mqtt_connection.h b/components/mqtt/test_apps/common/include/test_mqtt_connection.h similarity index 80% rename from components/mqtt/test/test_mqtt_connection.h rename to components/mqtt/test_apps/common/include/test_mqtt_connection.h index 5322ddf579..460beccfe6 100644 --- a/components/mqtt/test/test_mqtt_connection.h +++ b/components/mqtt/test_apps/common/include/test_mqtt_connection.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/mqtt/test/test_mqtt_connection.c b/components/mqtt/test_apps/common/test_mqtt_connection.c similarity index 100% rename from components/mqtt/test/test_mqtt_connection.c rename to components/mqtt/test_apps/common/test_mqtt_connection.c diff --git a/components/mqtt/test_apps/test_mqtt/CMakeLists.txt b/components/mqtt/test_apps/test_mqtt/CMakeLists.txt new file mode 100644 index 0000000000..bc86bdba3e --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt/CMakeLists.txt @@ -0,0 +1,9 @@ +#This is the project CMakeLists.txt file for the test subproject +cmake_minimum_required(VERSION 3.16) + +set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components" + "../common") + +set(COMPONENTS main) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(esp_mqtt_client_test) diff --git a/components/mqtt/test_apps/test_mqtt/README.md b/components/mqtt/test_apps/test_mqtt/README.md new file mode 100644 index 0000000000..a8b7833fa3 --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt/README.md @@ -0,0 +1,2 @@ +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | diff --git a/components/mqtt/test/CMakeLists.txt b/components/mqtt/test_apps/test_mqtt/main/CMakeLists.txt similarity index 70% rename from components/mqtt/test/CMakeLists.txt rename to components/mqtt/test_apps/test_mqtt/main/CMakeLists.txt index 3261bec86f..e7499a2e46 100644 --- a/components/mqtt/test/CMakeLists.txt +++ b/components/mqtt/test_apps/test_mqtt/main/CMakeLists.txt @@ -1,9 +1,9 @@ -set(srcs test_mqtt_client_broker.c test_mqtt_connection.c test_mqtt.c) +set(srcs test_mqtt_client_broker.c test_mqtt.c) if(CONFIG_MQTT_PROTOCOL_5) list(APPEND srcs test_mqtt5_client_broker.c test_mqtt5.c) endif() idf_component_register(SRCS "${srcs}" - PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update esp_eth esp_netif spi_flash) + PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update esp_eth esp_netif spi_flash common) target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/mqtt/test/Kconfig b/components/mqtt/test_apps/test_mqtt/main/Kconfig.projbuild similarity index 100% rename from components/mqtt/test/Kconfig rename to components/mqtt/test_apps/test_mqtt/main/Kconfig.projbuild diff --git a/components/mqtt/test/test_mqtt.c b/components/mqtt/test_apps/test_mqtt/main/test_mqtt.c similarity index 72% rename from components/mqtt/test/test_mqtt.c rename to components/mqtt/test_apps/test_mqtt/main/test_mqtt.c index 41a5516f7d..cb56a5e063 100644 --- a/components/mqtt/test/test_mqtt.c +++ b/components/mqtt/test_apps/test_mqtt/main/test_mqtt.c @@ -11,33 +11,30 @@ */ #include -#include "freertos/FreeRTOS.h" -#include "freertos/event_groups.h" -#include "unity.h" +#include "unity_fixture.h" +#include "unity_fixture_extras.h" #include "test_utils.h" #include "memory_checks.h" #include "mqtt_client.h" -#include "nvs_flash.h" #include "esp_ota_ops.h" -#include "sdkconfig.h" #include "test_mqtt_client_broker.h" #include "test_mqtt_connection.h" -#include "esp_mac.h" #include "esp_partition.h" -static void test_leak_setup(const char * file, long line) -{ - uint8_t mac[6]; - struct timeval te; - gettimeofday(&te, NULL); // get current time - esp_read_mac(mac, ESP_MAC_WIFI_STA); - printf("%s:%ld: time=%jd.%lds, mac:" MACSTR "\n", file, line, (intmax_t)te.tv_sec, te.tv_usec, MAC2STR(mac)); +TEST_GROUP(mqtt); + +TEST_SETUP(mqtt){ test_utils_record_free_mem(); + TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL)); } -TEST_CASE("mqtt init with invalid url", "[mqtt][leaks=0]") +TEST_TEAR_DOWN(mqtt){ + test_utils_finish_and_evaluate_leaks(test_utils_get_leak_level(ESP_LEAK_TYPE_WARNING, ESP_COMP_LEAK_ALL), + test_utils_get_leak_level(ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_ALL)); +} + +TEST(mqtt, init_with_invalid_url) { - test_leak_setup(__FILE__, __LINE__); const esp_mqtt_client_config_t mqtt_cfg = { .broker.address.uri = "INVALID", }; @@ -45,9 +42,8 @@ TEST_CASE("mqtt init with invalid url", "[mqtt][leaks=0]") TEST_ASSERT_EQUAL(NULL, client ); } -TEST_CASE("mqtt init and deinit", "[mqtt][leaks=0]") +TEST(mqtt, init_and_deinit) { - test_leak_setup(__FILE__, __LINE__); const esp_mqtt_client_config_t mqtt_cfg = { // no connection takes place, but the uri has to be valid for init() to succeed .broker.address.uri = "mqtts://localhost:8883", @@ -66,10 +62,13 @@ static const char* this_bin_addr(void) return binary_address; } -TEST_CASE("mqtt enqueue and destroy outbox", "[mqtt][leaks=0]") +TEST(mqtt, enqueue_and_destroy_outbox) { const char * bin_addr = this_bin_addr(); - test_leak_setup(__FILE__, __LINE__); + + // Reseting leak detection since this_bin_addr adds to allocated memory. + test_utils_record_free_mem(); + TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL)); const int messages = 20; const int size = 2000; const esp_mqtt_client_config_t mqtt_cfg = { @@ -93,7 +92,7 @@ TEST_CASE("mqtt enqueue and destroy outbox", "[mqtt][leaks=0]") /** * This test cases uses ethernet kit, so build and use it only if EMAC supported */ -TEST_CASE("mqtt broker tests", "[mqtt][test_env=UT_T2_Ethernet]") +TEST(mqtt, broker_tests) { test_case_uses_tcpip(); connect_test_fixture_setup(); @@ -105,5 +104,19 @@ TEST_CASE("mqtt broker tests", "[mqtt][test_env=UT_T2_Ethernet]") connect_test_fixture_teardown(); } - #endif // SOC_EMAC_SUPPORTED + + +TEST_GROUP_RUNNER(mqtt) { +RUN_TEST_CASE(mqtt, init_with_invalid_url); +RUN_TEST_CASE(mqtt, init_and_deinit); +RUN_TEST_CASE(mqtt, enqueue_and_destroy_outbox); + +#if SOC_EMAC_SUPPORTED +RUN_TEST_CASE(mqtt, broker_tests); +#endif // SOC_EMAC_SUPPORTED +} + +void app_main(void){ + UNITY_MAIN(mqtt); +} diff --git a/components/mqtt/test/test_mqtt_client_broker.c b/components/mqtt/test_apps/test_mqtt/main/test_mqtt_client_broker.c similarity index 100% rename from components/mqtt/test/test_mqtt_client_broker.c rename to components/mqtt/test_apps/test_mqtt/main/test_mqtt_client_broker.c diff --git a/components/mqtt/test/test_mqtt_client_broker.h b/components/mqtt/test_apps/test_mqtt/main/test_mqtt_client_broker.h similarity index 95% rename from components/mqtt/test/test_mqtt_client_broker.h rename to components/mqtt/test_apps/test_mqtt/main/test_mqtt_client_broker.h index 6bfd5d8a25..63e7856f70 100644 --- a/components/mqtt/test/test_mqtt_client_broker.h +++ b/components/mqtt/test_apps/test_mqtt/main/test_mqtt_client_broker.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/mqtt/test_apps/test_mqtt/pytest_mqtt_ut.py b/components/mqtt/test_apps/test_mqtt/pytest_mqtt_ut.py new file mode 100644 index 0000000000..f3333fae45 --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt/pytest_mqtt_ut.py @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c2 +@pytest.mark.ethernet +def test_mqtt_client(dut: Dut) -> None: + dut.expect_unity_test_output() diff --git a/components/mqtt/test_apps/test_mqtt/sdkconfig.defaults b/components/mqtt/test_apps/test_mqtt/sdkconfig.defaults new file mode 100644 index 0000000000..2bcae3f3bc --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt/sdkconfig.defaults @@ -0,0 +1,3 @@ +# General options for additional checks +CONFIG_ESP_TASK_WDT_EN=n +CONFIG_UNITY_ENABLE_FIXTURE=y diff --git a/components/mqtt/test_apps/test_mqtt5/CMakeLists.txt b/components/mqtt/test_apps/test_mqtt5/CMakeLists.txt new file mode 100644 index 0000000000..1c7881c5ad --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt5/CMakeLists.txt @@ -0,0 +1,9 @@ +#This is the project CMakeLists.txt file for the test subproject +cmake_minimum_required(VERSION 3.16) + +set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components" + "../common") + +set(COMPONENTS main) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(esp_mqtt5_client_test) diff --git a/components/mqtt/test_apps/test_mqtt5/README.md b/components/mqtt/test_apps/test_mqtt5/README.md new file mode 100644 index 0000000000..a8b7833fa3 --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt5/README.md @@ -0,0 +1,2 @@ +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | diff --git a/components/mqtt/test_apps/test_mqtt5/main/CMakeLists.txt b/components/mqtt/test_apps/test_mqtt5/main/CMakeLists.txt new file mode 100644 index 0000000000..326b8fa300 --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt5/main/CMakeLists.txt @@ -0,0 +1,5 @@ +set(srcs test_mqtt5_client_broker.c test_mqtt5.c) + +idf_component_register(SRCS "${srcs}" + PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update esp_eth esp_netif spi_flash common) + target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/mqtt/test_apps/test_mqtt5/main/Kconfig.projbuild b/components/mqtt/test_apps/test_mqtt5/main/Kconfig.projbuild new file mode 100644 index 0000000000..30b2c1087a --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt5/main/Kconfig.projbuild @@ -0,0 +1,14 @@ +menu "ESP-MQTT Unit Test Config" + + config MQTT_TEST_BROKER_URI + string "URI of the test broker" + default "mqtt://mqtt.eclipseprojects.io" + help + URL of an mqtt broker which this test connects to. + + config MQTT5_TEST_BROKER_URI + string "URI of the test broker" + default "mqtt://mqtt.eclipseprojects.io" + help + URL of an mqtt broker which this test connects to. +endmenu diff --git a/components/mqtt/test/test_mqtt5.c b/components/mqtt/test_apps/test_mqtt5/main/test_mqtt5.c similarity index 62% rename from components/mqtt/test/test_mqtt5.c rename to components/mqtt/test_apps/test_mqtt5/main/test_mqtt5.c index d9bfe82e7c..9d8705d83f 100644 --- a/components/mqtt/test/test_mqtt5.c +++ b/components/mqtt/test_apps/test_mqtt5/main/test_mqtt5.c @@ -5,62 +5,60 @@ */ #include -#include "freertos/FreeRTOS.h" -#include "freertos/event_groups.h" -#include "unity.h" +#include "unity_fixture.h" +#include "unity_fixture_extras.h" #include "test_utils.h" #include "memory_checks.h" #include "mqtt_client.h" -#include "nvs_flash.h" #include "esp_ota_ops.h" -#include "sdkconfig.h" #include "test_mqtt5_client_broker.h" #include "test_mqtt_connection.h" -#include "esp_mac.h" #include "esp_partition.h" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C6, ESP32H2) + +TEST_GROUP(mqtt5); + +TEST_SETUP(mqtt5) +{ + test_utils_record_free_mem(); + TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL)); +} + +TEST_TEAR_DOWN(mqtt5) +{ + test_utils_finish_and_evaluate_leaks(test_utils_get_leak_level(ESP_LEAK_TYPE_WARNING, ESP_COMP_LEAK_ALL), + test_utils_get_leak_level(ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_ALL)); +} + static esp_mqtt5_user_property_item_t user_property_arr[3] = { {"board", "esp32"}, {"u", "user"}, {"p", "password"} }; -static void test_leak_setup(const char * file, long line) +TEST(mqtt5, init_with_invalid_url) { - uint8_t mac[6]; - struct timeval te; - gettimeofday(&te, NULL); // get current time - esp_read_mac(mac, ESP_MAC_WIFI_STA); - printf("%s:%ld: time=%ld.%lds, mac:" MACSTR "\n", file, line, te.tv_sec, te.tv_usec, MAC2STR(mac)); - test_utils_record_free_mem(); -} - -TEST_CASE("mqtt5 init with invalid url", "[mqtt5][leaks=0]") -{ - test_leak_setup(__FILE__, __LINE__); const esp_mqtt_client_config_t mqtt5_cfg = { - .broker.address.uri = "INVALID", - .session.protocol_ver = MQTT_PROTOCOL_V_5, + .broker.address.uri = "INVALID", + .session.protocol_ver = MQTT_PROTOCOL_V_5, }; esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt5_cfg); TEST_ASSERT_EQUAL(NULL, client ); } -TEST_CASE("mqtt5 init and deinit", "[mqtt5][leaks=0]") +TEST(mqtt5, init_and_deinit) { - test_leak_setup(__FILE__, __LINE__); const esp_mqtt_client_config_t mqtt5_cfg = { - // no connection takes place, but the uri has to be valid for init() to succeed - .broker.address.uri = "mqtts://localhost:8883", - .session.protocol_ver = MQTT_PROTOCOL_V_5, - .credentials.username = "123", - .credentials.authentication.password = "456", - .session.last_will.topic = "/topic/will", - .session.last_will.msg = "i will leave", - .session.last_will.msg_len = 12, - .session.last_will.qos = 1, - .session.last_will.retain = true, + // no connection takes place, but the uri has to be valid for init() to succeed + .broker.address.uri = "mqtts://localhost:8883", + .session.protocol_ver = MQTT_PROTOCOL_V_5, + .credentials.username = "123", + .credentials.authentication.password = "456", + .session.last_will.topic = "/topic/will", + .session.last_will.msg = "i will leave", + .session.last_will.msg_len = 12, + .session.last_will.qos = 1, + .session.last_will.retain = true, }; esp_mqtt5_connection_property_config_t connect_property = { .session_expiry_interval = 10, @@ -88,25 +86,27 @@ TEST_CASE("mqtt5 init and deinit", "[mqtt5][leaks=0]") esp_mqtt_client_destroy(client); } -static const char* this_bin_addr(void) +static const char *this_bin_addr(void) { esp_partition_mmap_handle_t out_handle; const void *binary_address; - const esp_partition_t* partition = esp_ota_get_running_partition(); + const esp_partition_t *partition = esp_ota_get_running_partition(); esp_partition_mmap(partition, 0, partition->size, ESP_PARTITION_MMAP_DATA, &binary_address, &out_handle); return binary_address; } -TEST_CASE("mqtt5 enqueue and destroy outbox", "[mqtt5][leaks=0]") +TEST(mqtt5, enqueue_and_destroy_outbox) { - const char * bin_addr = this_bin_addr(); - test_leak_setup(__FILE__, __LINE__); + const char *bin_addr = this_bin_addr(); + // Reseting leak detection since this_bin_addr adds to allocated memory. + test_utils_record_free_mem(); + TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL)); const int messages = 20; const int size = 2000; const esp_mqtt_client_config_t mqtt5_cfg = { - // no connection takes place, but the uri has to be valid for init() to succeed - .broker.address.uri = "mqtts://localhost:8883", - .session.protocol_ver = MQTT_PROTOCOL_V_5, + // no connection takes place, but the uri has to be valid for init() to succeed + .broker.address.uri = "mqtts://localhost:8883", + .session.protocol_ver = MQTT_PROTOCOL_V_5, }; esp_mqtt5_publish_property_config_t publish_property = { .payload_format_indicator = 1, @@ -129,7 +129,7 @@ TEST_CASE("mqtt5 enqueue and destroy outbox", "[mqtt5][leaks=0]") } int bytes_after = esp_get_free_heap_size(); // check that outbox allocated all messages on heap - TEST_ASSERT_GREATER_OR_EQUAL(messages*size, bytes_before - bytes_after); + TEST_ASSERT_GREATER_OR_EQUAL(messages * size, bytes_before - bytes_after); esp_mqtt_client_destroy(client); } @@ -138,7 +138,7 @@ TEST_CASE("mqtt5 enqueue and destroy outbox", "[mqtt5][leaks=0]") /** * This test cases uses ethernet kit, so build and use it only if EMAC supported */ -TEST_CASE("mqtt5 broker tests", "[mqtt5][test_env=UT_T2_Ethernet]") +TEST(mqtt5, broker_tests) { test_case_uses_tcpip(); connect_test_fixture_setup(); @@ -151,4 +151,22 @@ TEST_CASE("mqtt5 broker tests", "[mqtt5][test_env=UT_T2_Ethernet]") connect_test_fixture_teardown(); } #endif // SOC_EMAC_SUPPORTED -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C6, ESP32H2) + +TEST_GROUP_RUNNER(mqtt5) +{ +#if !DISABLED_FOR_TARGETS(ESP32H2) + RUN_TEST_CASE(mqtt5, init_with_invalid_url); + RUN_TEST_CASE(mqtt5, init_and_deinit); + RUN_TEST_CASE(mqtt5, enqueue_and_destroy_outbox); + +#if SOC_EMAC_SUPPORTED + RUN_TEST_CASE(mqtt5, broker_tests); +#endif // SOC_EMAC_SUPPORTED +#endif //!DISABLED_FOR_TARGETS(ESP32H2) +} + + +void app_main(void) +{ + UNITY_MAIN(mqtt5); +} diff --git a/components/mqtt/test/test_mqtt5_client_broker.c b/components/mqtt/test_apps/test_mqtt5/main/test_mqtt5_client_broker.c similarity index 99% rename from components/mqtt/test/test_mqtt5_client_broker.c rename to components/mqtt/test_apps/test_mqtt5/main/test_mqtt5_client_broker.c index ced44e911d..0ac4c3dd01 100644 --- a/components/mqtt/test/test_mqtt5_client_broker.c +++ b/components/mqtt/test_apps/test_mqtt5/main/test_mqtt5_client_broker.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/mqtt/test/test_mqtt5_client_broker.h b/components/mqtt/test_apps/test_mqtt5/main/test_mqtt5_client_broker.h similarity index 95% rename from components/mqtt/test/test_mqtt5_client_broker.h rename to components/mqtt/test_apps/test_mqtt5/main/test_mqtt5_client_broker.h index 52b6ab88c6..a181dd8e06 100644 --- a/components/mqtt/test/test_mqtt5_client_broker.h +++ b/components/mqtt/test_apps/test_mqtt5/main/test_mqtt5_client_broker.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py b/components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py new file mode 100644 index 0000000000..35766cbc7f --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt5/pytest_mqtt5_ut.py @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 +import pytest +from pytest_embedded import Dut + + +@pytest.mark.esp32 +@pytest.mark.esp32c2 +@pytest.mark.ethernet +def test_mqtt5_client(dut: Dut) -> None: + dut.expect_unity_test_output() diff --git a/components/mqtt/test_apps/test_mqtt5/sdkconfig.defaults b/components/mqtt/test_apps/test_mqtt5/sdkconfig.defaults new file mode 100644 index 0000000000..06c58d7b6a --- /dev/null +++ b/components/mqtt/test_apps/test_mqtt5/sdkconfig.defaults @@ -0,0 +1,4 @@ +# General options for additional checks +CONFIG_ESP_TASK_WDT_EN=n +CONFIG_MQTT_PROTOCOL_5=y +CONFIG_UNITY_ENABLE_FIXTURE=y diff --git a/tools/unit-test-app/configs/default_2_c2 b/tools/unit-test-app/configs/default_2_c2 index 056621de32..0b38204811 100644 --- a/tools/unit-test-app/configs/default_2_c2 +++ b/tools/unit-test-app/configs/default_2_c2 @@ -1,6 +1,6 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" -TEST_COMPONENTS=app_trace esp_eth esp_hid esp_phy esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc +TEST_COMPONENTS=app_trace esp_eth esp_hid esp_phy esp_wifi espcoredump hal lwip mdns newlib nvs_flash partition_table sdmmc CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE=n CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT=y CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC=n diff --git a/tools/unit-test-app/configs/default_2_c6 b/tools/unit-test-app/configs/default_2_c6 index 628b4d9da4..82947f4f7d 100644 --- a/tools/unit-test-app/configs/default_2_c6 +++ b/tools/unit-test-app/configs/default_2_c6 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c6" -TEST_COMPONENTS=app_trace esp_eth esp_hid esp_phy esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc +TEST_COMPONENTS=app_trace esp_eth esp_hid esp_phy esp_wifi espcoredump hal lwip mdns newlib nvs_flash partition_table sdmmc diff --git a/tools/unit-test-app/configs/default_2_h2 b/tools/unit-test-app/configs/default_2_h2 index 4984e54f90..97d2d59fae 100644 --- a/tools/unit-test-app/configs/default_2_h2 +++ b/tools/unit-test-app/configs/default_2_h2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32h2" -TEST_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc +TEST_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_wifi espcoredump hal lwip mdns newlib nvs_flash partition_table sdmmc diff --git a/tools/unit-test-app/configs/default_3_c2 b/tools/unit-test-app/configs/default_3_c2 index ca88bd6f87..f611140920 100644 --- a/tools/unit-test-app/configs/default_3_c2 +++ b/tools/unit-test-app/configs/default_3_c2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" -TEST_EXCLUDE_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc driver soc spi_flash vfs +TEST_EXCLUDE_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns newlib nvs_flash partition_table sdmmc driver soc spi_flash vfs diff --git a/tools/unit-test-app/configs/default_3_c6 b/tools/unit-test-app/configs/default_3_c6 index 2bf8fc3d78..9f7a34ebf4 100644 --- a/tools/unit-test-app/configs/default_3_c6 +++ b/tools/unit-test-app/configs/default_3_c6 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c6" -TEST_EXCLUDE_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc driver soc spi_flash vfs +TEST_EXCLUDE_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns newlib nvs_flash partition_table sdmmc driver soc spi_flash vfs diff --git a/tools/unit-test-app/configs/default_3_h2 b/tools/unit-test-app/configs/default_3_h2 index 6e140c89ef..6768e9bbda 100644 --- a/tools/unit-test-app/configs/default_3_h2 +++ b/tools/unit-test-app/configs/default_3_h2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32h2" -TEST_EXCLUDE_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc driver soc spi_flash vfs +TEST_EXCLUDE_COMPONENTS=app_trace esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns newlib nvs_flash partition_table sdmmc driver soc spi_flash vfs diff --git a/tools/unit-test-app/configs/mqtt b/tools/unit-test-app/configs/mqtt deleted file mode 100644 index 7ba01ae76b..0000000000 --- a/tools/unit-test-app/configs/mqtt +++ /dev/null @@ -1,5 +0,0 @@ -TEST_COMPONENTS=mqtt -CONFIG_MQTT_PROTOCOL_5=y -CONFIG_MQTT5_TEST_BROKER_URI="mqtt://${EXAMPLE_MQTTV5_BROKER_TCP}" -CONFIG_LWIP_TCPIP_CORE_LOCKING=y -CONFIG_LWIP_CHECK_THREAD_SAFETY=y