diff --git a/components/esp_netif/test_app/CMakeLists.txt b/components/esp_netif/test_app/CMakeLists.txt index 46cdffa89e..03a8cad939 100644 --- a/components/esp_netif/test_app/CMakeLists.txt +++ b/components/esp_netif/test_app/CMakeLists.txt @@ -1,5 +1,7 @@ # This is the project CMakeLists.txt file for the test subproject cmake_minimum_required(VERSION 3.5) +set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components") + include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp_netif_test) diff --git a/components/esp_netif/test_app/main/CMakeLists.txt b/components/esp_netif/test_app/main/CMakeLists.txt index 3f50694172..472bc34f63 100644 --- a/components/esp_netif/test_app/main/CMakeLists.txt +++ b/components/esp_netif/test_app/main/CMakeLists.txt @@ -1,4 +1,5 @@ idf_component_register(SRCS "esp_netif_test.c" + REQUIRES test_utils INCLUDE_DIRS "." - PRIV_INCLUDE_DIRS "../../private_include" "." + PRIV_INCLUDE_DIRS "$ENV{IDF_PATH}/components/esp_netif/private_include" "." PRIV_REQUIRES unity esp_netif nvs_flash) diff --git a/components/esp_netif/test_app/main/esp_netif_test.c b/components/esp_netif/test_app/main/esp_netif_test.c index bb635e6629..264435507b 100644 --- a/components/esp_netif/test_app/main/esp_netif_test.c +++ b/components/esp_netif/test_app/main/esp_netif_test.c @@ -6,9 +6,9 @@ #include "esp_wifi.h" #include "nvs_flash.h" #include "esp_wifi_netif.h" - -/* Fixme: re-add test_utils.h */ -static void test_case_uses_tcpip(void) {} +#include "sdkconfig.h" +#include "lwip/sockets.h" +#include "test_utils.h" TEST_GROUP(esp_netif); @@ -276,6 +276,7 @@ TEST_GROUP_RUNNER(esp_netif) RUN_TEST_CASE(esp_netif, create_delete_multiple_netifs) RUN_TEST_CASE(esp_netif, dhcp_client_state_transitions_wifi_sta) RUN_TEST_CASE(esp_netif, dhcp_server_state_transitions_wifi_ap) + RUN_TEST_CASE(esp_netif, dhcp_server_state_transitions_mesh) RUN_TEST_CASE(esp_netif, create_custom_wifi_interfaces) RUN_TEST_CASE(esp_netif, get_set_hostname) } diff --git a/components/unity/include/unity_fixture_extras.h b/components/unity/include/unity_fixture_extras.h index c799e12891..2eeaec2e3a 100644 --- a/components/unity/include/unity_fixture_extras.h +++ b/components/unity/include/unity_fixture_extras.h @@ -1,6 +1,8 @@ /* IDF-specific additions to "Unity Fixture" */ #pragma once +#ifndef CONFIG_IDF_TARGET + /* A shorthand for running one test group from the main function */ #define UNITY_MAIN(group_) do { \ const char* argv[] = { "test", "-v" }; \ @@ -9,3 +11,15 @@ printf("\nTests finished, rc=%d\n", rc); \ exit(rc); \ } while(0) + +#else // CONFIG_IDF_TARGET + +/* A shorthand for running one test group from the main function */ +#define UNITY_MAIN(group_) do { \ + const char* argv[] = { "test", "-v" }; \ + const int argc = sizeof(argv)/sizeof(argv[0]); \ + int rc = UnityMain(argc, argv, TEST_ ## group_ ## _GROUP_RUNNER); \ + printf("\nTests finished, rc=%d\n", rc); \ +} while(0) + +#endif // CONFIG_IDF_TARGET diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 9f0fe97b10..fa765e4888 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -82,6 +82,8 @@ components/libsodium/ components/spiffs/include/spiffs_config.h components/unity/unity/src/unity_internals.h +components/unity/unity/extras/ +components/unity/include/unity_fixture_extras.h components/unity/include/unity_config.h components/unity/include/unity_test_runner.h diff --git a/tools/unit-test-app/components/test_utils/test_runner.c b/tools/unit-test-app/components/test_utils/test_runner.c index 6c17a0640f..daa64d5295 100644 --- a/tools/unit-test-app/components/test_utils/test_runner.c +++ b/tools/unit-test-app/components/test_utils/test_runner.c @@ -18,6 +18,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "unity.h" +#include "unity_test_runner.h" #include "test_utils.h" #include "esp_newlib.h"