From a6371d2a97e3230e4de16cc9be38745377e11b0e Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Mon, 8 Mar 2021 15:07:44 +0800 Subject: [PATCH] [nvs] nvs page host runs in CI, fix build failure * nvs host page unit test now runs in ci * fixed nvs host page unit test build failure --- CMakeLists.txt | 7 +++++++ .../nvs_page_test/main/nvs_page_test.cpp | 18 +++++++++--------- .../host_test/nvs_page_test/sdkconfig.defaults | 1 + .../stubs/soc/include/hal/spi_flash_types.h | 5 +++++ tools/ci/config/host-test.yml | 7 +++++++ 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ac1b91ac5..d0adb9bb17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,13 @@ if(CONFIG_COMPILER_DUMP_RTL_FILES) list(APPEND compile_options "-fdump-rtl-expand") endif() +if(NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS 8.0.0) + if(CONFIG_COMPILER_HIDE_PATHS_MACROS) + list(APPEND compile_options "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.") + list(APPEND compile_options "-fmacro-prefix-map=${IDF_PATH}=IDF") + endif() +endif() + # GCC-specific options if(CMAKE_C_COMPILER_ID STREQUAL "GNU") list(APPEND compile_options "-fstrict-volatile-bitfields" diff --git a/components/nvs_flash/host_test/nvs_page_test/main/nvs_page_test.cpp b/components/nvs_flash/host_test/nvs_page_test/main/nvs_page_test.cpp index d3899be783..a1742f709f 100644 --- a/components/nvs_flash/host_test/nvs_page_test/main/nvs_page_test.cpp +++ b/components/nvs_flash/host_test/nvs_page_test/main/nvs_page_test.cpp @@ -1,11 +1,11 @@ -/* Hello World Example +// NVSPage Host Test +// +// This example code is in the Public Domain (or CC0 licensed, at your option.) +// +// Unless required by applicable law or agreed to in writing, this +// software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. - This example code is in the Public Domain (or CC0 licensed, at your option.) - - Unless required by applicable law or agreed to in writing, this - software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - CONDITIONS OF ANY KIND, either express or implied. -*/ #include #include "unity.h" #include "test_fixtures.hpp" @@ -929,6 +929,6 @@ int main(int argc, char **argv) RUN_TEST(test_Page_calcEntries__active_wo_blob); RUN_TEST(test_Page_calcEntries__active_with_blob); RUN_TEST(test_Page_calcEntries__invalid); - UNITY_END(); - return 0; + int failures = UNITY_END(); + return failures; } diff --git a/components/nvs_flash/host_test/nvs_page_test/sdkconfig.defaults b/components/nvs_flash/host_test/nvs_page_test/sdkconfig.defaults index a057733348..d7ae4dee46 100644 --- a/components/nvs_flash/host_test/nvs_page_test/sdkconfig.defaults +++ b/components/nvs_flash/host_test/nvs_page_test/sdkconfig.defaults @@ -1,3 +1,4 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n +CONFIG_COMPILER_HIDE_PATHS_MACROS=n CONFIG_IDF_TARGET="linux" CONFIG_CXX_EXCEPTIONS=y diff --git a/components/spi_flash/sim/stubs/soc/include/hal/spi_flash_types.h b/components/spi_flash/sim/stubs/soc/include/hal/spi_flash_types.h index 9e0525e309..f816bea7ef 100644 --- a/components/spi_flash/sim/stubs/soc/include/hal/spi_flash_types.h +++ b/components/spi_flash/sim/stubs/soc/include/hal/spi_flash_types.h @@ -41,6 +41,11 @@ typedef enum { SPI_FLASH_READ_MODE_MAX, ///< The fastest io mode supported by the host is ``ESP_FLASH_READ_MODE_MAX-1``. } esp_flash_io_mode_t; +/** + * Configuration structure for the flash chip suspend feature. + */ +typedef struct spi_flash_sus_cmd_conf_dummy spi_flash_sus_cmd_conf; + struct spi_flash_host_driver_s; typedef struct spi_flash_host_driver_s spi_flash_host_driver_t; diff --git a/tools/ci/config/host-test.yml b/tools/ci/config/host-test.yml index 538f3d3611..505dedc8f9 100644 --- a/tools/ci/config/host-test.yml +++ b/tools/ci/config/host-test.yml @@ -362,3 +362,10 @@ test_detect_python: - "dash -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'" - "zsh -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'" - "fish -c 'source tools/detect_python.fish && echo Our Python: $ESP_PYTHON'" + +test_nvs_page: + extends: .host_test_template + script: + - cd ${IDF_PATH}/components/nvs_flash/host_test/nvs_page_test + - idf.py build + - build/host_nvs_page_test.elf