mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-14 01:54:35 +02:00
ci(wear_levelling): upgrade to Catch2 as a component
This commit is contained in:
@@ -2,9 +2,7 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
set(COMPONENTS main)
|
set(COMPONENTS main)
|
||||||
# Freertos is included via common components. However, CATCH isn't compatible with the FreeRTOS component yet, hence
|
# This test app doesn't require FreeRTOS, using mock instead
|
||||||
# using the FreeRTOS mock component.
|
|
||||||
# target.
|
|
||||||
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
||||||
|
|
||||||
project(wear_levelling_host_test)
|
project(wear_levelling_host_test)
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
idf_component_register(SRCS "main.cpp"
|
idf_component_register(SRCS "test_wl.cpp"
|
||||||
"test_wl.cpp"
|
|
||||||
INCLUDE_DIRS "$ENV{IDF_PATH}/tools/catch"
|
|
||||||
PRIV_INCLUDE_DIRS "../../private_include"
|
PRIV_INCLUDE_DIRS "../../private_include"
|
||||||
"../.."
|
"../.."
|
||||||
REQUIRES wear_levelling
|
REQUIRES wear_levelling
|
||||||
WHOLE_ARCHIVE
|
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)
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
#include "catch.hpp"
|
|
||||||
#include "esp_err.h"
|
|
||||||
#include "sdkconfig.h"
|
|
||||||
|
|
||||||
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
|
|
||||||
{
|
|
||||||
printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x", rc);
|
|
||||||
#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
|
|
||||||
printf(" (%s)", esp_err_to_name(rc));
|
|
||||||
#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
|
|
||||||
printf(" at %p\n", __builtin_return_address(0));
|
|
||||||
printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression);
|
|
||||||
abort();
|
|
||||||
}
|
|
@@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
espressif/catch2: "^3.4.0"
|
@@ -1,7 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
#include "catch.hpp"
|
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2016-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
|
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
@@ -34,7 +34,6 @@ TEST_CASE("write and read back data", "[wear_levelling]")
|
|||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
wl_handle_t wl_handle;
|
wl_handle_t wl_handle;
|
||||||
|
|
||||||
int flash_handle;
|
|
||||||
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||||
|
|
||||||
// Mount wear-levelled partition
|
// Mount wear-levelled partition
|
||||||
@@ -105,7 +104,6 @@ TEST_CASE("power down test", "[wear_levelling]")
|
|||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
wl_handle_t wl_handle;
|
wl_handle_t wl_handle;
|
||||||
|
|
||||||
int flash_handle;
|
|
||||||
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||||
|
|
||||||
// Disable power down failure counting
|
// Disable power down failure counting
|
||||||
@@ -295,7 +293,6 @@ TEST_CASE("power down during WL status 1 update", "[wear_levelling]")
|
|||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
wl_handle_t wl_handle;
|
wl_handle_t wl_handle;
|
||||||
|
|
||||||
int flash_handle;
|
|
||||||
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||||
|
|
||||||
size_t offset_state_1, offset_state_2, size_state = 0;
|
size_t offset_state_1, offset_state_2, size_state = 0;
|
||||||
@@ -339,7 +336,6 @@ TEST_CASE("power down during WL status 2 update", "[wear_levelling]")
|
|||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
wl_handle_t wl_handle;
|
wl_handle_t wl_handle;
|
||||||
|
|
||||||
int flash_handle;
|
|
||||||
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||||
|
|
||||||
size_t offset_state_1, offset_state_2, size_state = 0;
|
size_t offset_state_1, offset_state_2, size_state = 0;
|
||||||
@@ -383,7 +379,6 @@ TEST_CASE("power down between WL status 1 and WL status 2 update", "[wear_levell
|
|||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
wl_handle_t wl_handle;
|
wl_handle_t wl_handle;
|
||||||
|
|
||||||
int flash_handle;
|
|
||||||
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage");
|
||||||
|
|
||||||
size_t offset_state_1, offset_state_2, size_state = 0;
|
size_t offset_state_1, offset_state_2, size_state = 0;
|
||||||
|
Reference in New Issue
Block a user