Skip to content

Commit ac6c54c

Browse files
committed
Merge branch 'feature/storage_remove_nvs_test_host' into 'master'
remove(nvs_flash/test_nvs_host): Old make based host tests removed after complete migration See merge request espressif/esp-idf!27853
2 parents 58051ca + 6a23790 commit ac6c54c

19 files changed

+51
-2458
lines changed

.gitlab/ci/host-test.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,16 @@ check_public_headers:
3434
- IDF_TARGET=esp32p4 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
3535
- IDF_TARGET=esp32c61 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf-
3636

37-
test_nvs_on_host:
38-
extends: .host_test_template
39-
script:
40-
- cd components/nvs_flash/test_nvs_host
41-
- make test
42-
4337
test_nvs_coverage:
4438
extends:
4539
- .host_test_template
4640
- .rules:labels:nvs_coverage
4741
artifacts:
4842
paths:
49-
- components/nvs_flash/test_nvs_host/coverage_report
43+
- components/nvs_flash/host_test/nvs_host_test/coverage_report
5044
script:
51-
- cd components/nvs_flash/test_nvs_host
52-
- make coverage_report
45+
- cd components/nvs_flash/host_test/nvs_host_test
46+
- idf.py build coverage
5347
# the 'long' host tests take approx 11 hours on our current runners. Adding some margin here for possible CPU contention
5448
timeout: 18 hours
5549

components/nvs_flash/host_test/nvs_host_test/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,19 @@ set(COMPONENTS main)
55
# This test app doesn't require FreeRTOS, using mock instead
66
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
77

8+
idf_build_set_property(COMPILE_DEFINITIONS "NO_DEBUG_STORAGE" APPEND)
89
project(nvs_host_test)
10+
11+
add_custom_command(
12+
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/coverage_report/index.html"
13+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
14+
COMMAND gcovr --root $ENV{IDF_PATH}/components/nvs_flash --html-details
15+
--exclude ${CMAKE_CURRENT_SOURCE_DIR}/managed_components/*
16+
-o ${CMAKE_CURRENT_BINARY_DIR}/coverage_report/index.html ${CMAKE_CURRENT_BINARY_DIR}
17+
COMMENT "Generate coverage report"
18+
)
19+
20+
add_custom_target(coverage
21+
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
22+
DEPENDS "coverage_report/index.html"
23+
)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
11
| Supported Targets | Linux |
22
| ----------------- | ----- |
3+
4+
# To build
5+
Navigate to the host test folder and run the IDF build command for linux target
6+
7+
```
8+
cd $IDF_PATH
9+
. ./export.sh
10+
cd components/nvs_flash/host_test/nvs_host_test
11+
idf.py --preview set-target linux
12+
idf.py build
13+
```
14+
15+
# To run tests locally
16+
Navigate to the IDF root directory and run the binary from there. This ensures all calls to relative paths from test cases are resolved correctly.
17+
This is limitation of ci pipeline as it was not possible to specify the working directory of the host tests.
18+
19+
```
20+
cd $IDF_PATH
21+
./components/nvs_flash/host_test/nvs_host_test/build/nvs_host_test.elf
22+
```
23+
24+
# To create coverage report
25+
After running the tests, the coverage report can be generated following way.
26+
27+
```
28+
cd components/nvs_flash/host_test/nvs_host_test
29+
idf.py build coverage
30+
open ./build/coverage_report/index.html
31+
```

components/nvs_flash/host_test/nvs_host_test/main/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ idf_component_register(SRCS "test_nvs.cpp"
1212
REQUIRES nvs_flash
1313
PRIV_REQUIRES spi_flash)
1414

15+
target_compile_options(${COMPONENT_LIB} PUBLIC --coverage)
16+
target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage)
17+
1518
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
1619
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++20)
1720
endif()

components/nvs_flash/host_test/nvs_host_test/main/test_nvs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3742,7 +3742,7 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit
37423742
}
37433743
}
37443744

3745-
TEST_CASE("nvs multiple write with same key but different types", "[nvs][xxx]")
3745+
TEST_CASE("nvs multiple write with same key but different types", "[nvs]")
37463746
{
37473747
PartitionEmulationFixture f(0, 10);
37483748

components/nvs_flash/test_nvs_host/Makefile

Lines changed: 0 additions & 113 deletions
This file was deleted.

components/nvs_flash/test_nvs_host/README.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

components/nvs_flash/test_nvs_host/main.cpp

Lines changed: 0 additions & 2 deletions
This file was deleted.

components/nvs_flash/test_nvs_host/sdkconfig.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

components/nvs_flash/test_nvs_host/spi_flash_emulation.cpp

Lines changed: 0 additions & 133 deletions
This file was deleted.

0 commit comments

Comments
 (0)