From b52182e14f34a64e6607d09395bcf2d585055a85 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 28 Nov 2023 18:24:30 +0100 Subject: [PATCH] ci(tcp_transport): upgrade to Catch2 as a component --- components/tcp_transport/host_test/main/CMakeLists.txt | 7 +++++-- components/tcp_transport/host_test/main/catch_main.cpp | 7 ------- components/tcp_transport/host_test/main/idf_component.yml | 3 +-- .../tcp_transport/host_test/main/test_socks_transport.cpp | 3 ++- 4 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 components/tcp_transport/host_test/main/catch_main.cpp diff --git a/components/tcp_transport/host_test/main/CMakeLists.txt b/components/tcp_transport/host_test/main/CMakeLists.txt index acceea9548..561a14335b 100644 --- a/components/tcp_transport/host_test/main/CMakeLists.txt +++ b/components/tcp_transport/host_test/main/CMakeLists.txt @@ -1,4 +1,4 @@ -idf_component_register(SRCS "test_socks_transport.cpp" "catch_main.cpp" +idf_component_register(SRCS "test_socks_transport.cpp" REQUIRES tcp_transport mocked_transport INCLUDE_DIRS "$ENV{IDF_PATH}/tools" WHOLE_ARCHIVE) @@ -9,4 +9,7 @@ idf_component_get_property(tcp_transport_component tcp_transport COMPONENT_LIB) target_link_libraries(${tcp_transport_component} PUBLIC ${lwip_component} ${esp_timer_component}) target_compile_options(${COMPONENT_LIB} PUBLIC -fsanitize=address -fconcepts) target_link_options(${COMPONENT_LIB} PUBLIC -fsanitize=address) -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 20) + +# Currently 'main' for IDF_TARGET=linux is defined in freertos component. +# Since we are using a freertos mock here, need to let Catch2 provide 'main'. +target_link_libraries(${COMPONENT_LIB} PRIVATE Catch2WithMain) diff --git a/components/tcp_transport/host_test/main/catch_main.cpp b/components/tcp_transport/host_test/main/catch_main.cpp deleted file mode 100644 index eda0c3afe6..0000000000 --- a/components/tcp_transport/host_test/main/catch_main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#define CATCH_CONFIG_MAIN -#include "catch/catch.hpp" diff --git a/components/tcp_transport/host_test/main/idf_component.yml b/components/tcp_transport/host_test/main/idf_component.yml index 7bad6ab6b4..77ad273fe3 100644 --- a/components/tcp_transport/host_test/main/idf_component.yml +++ b/components/tcp_transport/host_test/main/idf_component.yml @@ -1,4 +1,3 @@ dependencies: espressif/fmt: "^9.1.0" - idf: - version: ">=4.1.0" + espressif/catch2: "^3.4.0" diff --git a/components/tcp_transport/host_test/main/test_socks_transport.cpp b/components/tcp_transport/host_test/main/test_socks_transport.cpp index fbd7f15128..c2a09b2d16 100644 --- a/components/tcp_transport/host_test/main/test_socks_transport.cpp +++ b/components/tcp_transport/host_test/main/test_socks_transport.cpp @@ -16,7 +16,8 @@ #include #include "fmt/core.h" #include "fmt/ranges.h" -#include "catch/catch.hpp" +#include +#include #include "esp_transport.h" #include "esp_transport_socks_proxy.h"