diff --git a/components/protocomm/test_apps/CMakeLists.txt b/components/protocomm/test_apps/CMakeLists.txt new file mode 100644 index 0000000000..a5df5df3af --- /dev/null +++ b/components/protocomm/test_apps/CMakeLists.txt @@ -0,0 +1,7 @@ +#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") + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(protocomm_test) diff --git a/components/protocomm/test_apps/README.md b/components/protocomm/test_apps/README.md new file mode 100644 index 0000000000..b5be4985c5 --- /dev/null +++ b/components/protocomm/test_apps/README.md @@ -0,0 +1,2 @@ +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | diff --git a/components/protocomm/test/CMakeLists.txt b/components/protocomm/test_apps/main/CMakeLists.txt similarity index 51% rename from components/protocomm/test/CMakeLists.txt rename to components/protocomm/test_apps/main/CMakeLists.txt index 1e618a976e..bf687e286b 100644 --- a/components/protocomm/test/CMakeLists.txt +++ b/components/protocomm/test_apps/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." - PRIV_INCLUDE_DIRS "../proto-c/" - PRIV_REQUIRES cmock mbedtls protocomm protobuf-c test_utils) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") + PRIV_INCLUDE_DIRS "../../proto-c/" + PRIV_REQUIRES cmock mbedtls protocomm protobuf-c test_utils unity) diff --git a/components/protocomm/test/test_protocomm.c b/components/protocomm/test_apps/main/test_protocomm.c similarity index 99% rename from components/protocomm/test/test_protocomm.c rename to components/protocomm/test_apps/main/test_protocomm.c index 8fab4d1181..dbf7ea4057 100644 --- a/components/protocomm/test/test_protocomm.c +++ b/components/protocomm/test_apps/main/test_protocomm.c @@ -1183,3 +1183,8 @@ TEST_CASE("security 1 weak session test", "[PROTOCOMM]") { TEST_ASSERT(test_security1_weak_session() == ESP_OK); } + +void app_main(void) +{ + unity_run_menu(); +} diff --git a/components/protocomm/test_apps/pytest_protocomm_ut.py b/components/protocomm/test_apps/pytest_protocomm_ut.py new file mode 100644 index 0000000000..bedefba978 --- /dev/null +++ b/components/protocomm/test_apps/pytest_protocomm_ut.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: CC0-1.0 + +import pytest +from pytest_embedded import Dut + + +@pytest.mark.supported_targets +@pytest.mark.generic +def test_protocomm(dut: Dut) -> None: + dut.expect_exact('Press ENTER to see the list of tests') + dut.write('*') + dut.expect_unity_test_output() diff --git a/components/protocomm/test_apps/sdkconfig.defaults b/components/protocomm/test_apps/sdkconfig.defaults new file mode 100644 index 0000000000..ec826a5a16 --- /dev/null +++ b/components/protocomm/test_apps/sdkconfig.defaults @@ -0,0 +1,9 @@ +# General options for additional checks +CONFIG_HEAP_POISONING_COMPREHENSIVE=y +CONFIG_COMPILER_WARN_WRITE_STRINGS=y +CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y +CONFIG_COMPILER_STACK_CHECK=y + +CONFIG_ESP_TASK_WDT=n diff --git a/tools/unit-test-app/configs/default_2_c2 b/tools/unit-test-app/configs/default_2_c2 index b5b89f39c6..546bcb4353 100644 --- a/tools/unit-test-app/configs/default_2_c2 +++ b/tools/unit-test-app/configs/default_2_c2 @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included CONFIG_IDF_TARGET="esp32c2" -TEST_COMPONENTS=app_trace bootloader_support console efuse esp_common esp_eth esp_event esp_hid esp_http_client esp_http_server esp_netif esp_phy esp_ringbuf esp_rom esp_wifi espcoredump hal lwip mbedtls mdns mqtt newlib nvs_flash partition_table protocomm sdmmc spiffs +TEST_COMPONENTS=app_trace bootloader_support console efuse esp_common esp_eth esp_event esp_hid esp_http_client esp_http_server esp_netif esp_phy esp_ringbuf esp_rom esp_wifi espcoredump hal lwip mbedtls mdns mqtt newlib nvs_flash partition_table sdmmc spiffs diff --git a/tools/unit-test-app/configs/default_3_c2 b/tools/unit-test-app/configs/default_3_c2 index af8e5fbf11..28f4dae1fa 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 bootloader_support console efuse esp_common esp_eth esp_event esp_hid esp_http_client esp_http_server esp_netif esp_phy esp_ringbuf esp_rom esp_wifi espcoredump hal lwip mbedtls mdns mqtt newlib nvs_flash partition_table protocomm sdmmc spiffs freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs +TEST_EXCLUDE_COMPONENTS=app_trace bootloader_support console efuse esp_common esp_eth esp_event esp_hid esp_http_client esp_http_server esp_netif esp_phy esp_ringbuf esp_rom esp_wifi espcoredump hal lwip mbedtls mdns mqtt newlib nvs_flash partition_table sdmmc spiffs freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs