From 33896fe67e4b0e98e15c193866e9370bfd5bd955 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 27 Nov 2023 14:34:10 +0100 Subject: [PATCH] ci(log): upgrade to Catch2 as a component --- components/log/host_test/log_test/main/CMakeLists.txt | 11 +++++++---- .../log/host_test/log_test/main/idf_component.yml | 2 ++ components/log/host_test/log_test/main/log_test.cpp | 3 +-- 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 components/log/host_test/log_test/main/idf_component.yml diff --git a/components/log/host_test/log_test/main/CMakeLists.txt b/components/log/host_test/log_test/main/CMakeLists.txt index e1f4369f20..20b0d42435 100644 --- a/components/log/host_test/log_test/main/CMakeLists.txt +++ b/components/log/host_test/log_test/main/CMakeLists.txt @@ -1,5 +1,8 @@ idf_component_register(SRCS "log_test.cpp" - INCLUDE_DIRS - "." - $ENV{IDF_PATH}/tools/catch - REQUIRES log) + INCLUDE_DIRS "." + REQUIRES log + WHOLE_ARCHIVE) + +# 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/log/host_test/log_test/main/idf_component.yml b/components/log/host_test/log_test/main/idf_component.yml new file mode 100644 index 0000000000..f7982136b9 --- /dev/null +++ b/components/log/host_test/log_test/main/idf_component.yml @@ -0,0 +1,2 @@ +dependencies: + espressif/catch2: "^3.4.0" diff --git a/components/log/host_test/log_test/main/log_test.cpp b/components/log/host_test/log_test/main/log_test.cpp index a4befc9a24..40da7d3763 100644 --- a/components/log/host_test/log_test/main/log_test.cpp +++ b/components/log/host_test/log_test/main/log_test.cpp @@ -6,13 +6,12 @@ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ -#define CATCH_CONFIG_MAIN #include #include #include #include "esp_log.h" -#include "catch.hpp" +#include using namespace std;