ci(fatfs): upgrade to Catch2 as a component, enable CI build

This commit is contained in:
Ivan Grokhotkov 2023-11-27 14:32:05 +01:00
parent 8e81bbe014
commit 047e50615e
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
7 changed files with 13 additions and 15 deletions

View File

@ -0,0 +1,3 @@
components/fatfs/host_test:
enable:
- if: IDF_TARGET == "linux"

View File

@ -2,9 +2,7 @@ cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)
# Freertos is included via common components. However, CATCH isn't compatible with the FreeRTOS component yet, hence
# using the FreeRTOS mock component.
# target.
# This test doesn't require FreeRTOS, uses a mock instead
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
project(fatfs_host_test)

View File

@ -1,6 +1,8 @@
idf_component_register(SRCS "main.cpp"
"test_fatfs.cpp"
INCLUDE_DIRS "$ENV{IDF_PATH}/tools/catch"
idf_component_register(SRCS "test_fatfs.cpp"
REQUIRES fatfs
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)

View File

@ -0,0 +1,2 @@
dependencies:
espressif/catch2: "^3.4.0"

View File

@ -1,7 +0,0 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

View File

@ -12,7 +12,7 @@
#include "diskio_impl.h"
#include "diskio_wl.h"
#include "catch.hpp"
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Create volume, open file, write and read back data", "[fatfs]")
{
@ -158,7 +158,6 @@ TEST_CASE("Test mounting 2 volumes, writing data and formating the 2nd one, read
FATFS fs1;
wl_handle_t wl_handle1 = WL_INVALID_HANDLE;
size_t allocation_unit_size = CONFIG_WL_SECTOR_SIZE;
size_t data_size = 10;

View File

@ -40,6 +40,7 @@ warning: unknown kconfig symbol 'ESPTOOLPY_FLASHSIZE_4MB' assigned to 'y' in /bu
warning: unknown kconfig symbol 'ESPTOOLPY_FLASHSIZE' assigned to '"4MB"' in /builds/espressif/esp-idf/components/esp_partition/host_test/partition_api_test/sdkconfig.defaults
warning: unknown kconfig symbol 'ESPTOOLPY_FLASHSIZE' assigned to '"4MB"' in /builds/espressif/esp-idf/components/spiffs/host_test/sdkconfig.defaults
warning: unknown kconfig symbol 'ESPTOOLPY_FLASHSIZE' assigned to '"8MB"' in /builds/espressif/esp-idf/components/wear_levelling/host_test/sdkconfig.defaults
warning: unknown kconfig symbol 'ESPTOOLPY_FLASHSIZE' assigned to '"8MB"' in /builds/espressif/esp-idf/components/fatfs/host_test/sdkconfig.defaults
warning: unknown kconfig symbol 'ESPTOOLPY_MONITOR_BAUD_921600B' assigned to 'y' in /builds/espressif/esp-idf/examples/bluetooth/esp_ble_mesh/vendor_models/*
warning: unknown kconfig symbol 'FMB_TIMER_GROUP' assigned to '0' in /builds/espressif/esp-idf/examples/protocols/modbus/tcp/*
warning: unknown kconfig symbol 'FMB_TIMER_INDEX' assigned to '0' in /builds/espressif/esp-idf/examples/protocols/modbus/tcp/*