diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f1b560d76..b2e0bb5573 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -243,6 +243,24 @@ test_nvs_on_host: - cd components/nvs_flash/test_nvs_host - make test +test_nvs_coverage: + stage: test + image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG + tags: + - nvs_host_test + dependencies: [] + artifacts: + paths: + - components/nvs_flash/test_nvs_host/coverage_report + only: + - triggers + # This job takes a few hours to finish, so only run it on demand + variables: + BOT_NEEDS_TRIGGER_BY_NAME: 1 + script: + - cd components/nvs_flash/test_nvs_host + - make coverage_report + test_partition_table_on_host: stage: test image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG diff --git a/components/nvs_flash/test_nvs_host/Makefile b/components/nvs_flash/test_nvs_host/Makefile index f1f5b52f26..3696304949 100644 --- a/components/nvs_flash/test_nvs_host/Makefile +++ b/components/nvs_flash/test_nvs_host/Makefile @@ -37,10 +37,10 @@ $(OUTPUT_DIR): mkdir -p $(OUTPUT_DIR) test: $(TEST_PROGRAM) - ./$(TEST_PROGRAM) + ./$(TEST_PROGRAM) -d yes exclude:[long] long-test: $(TEST_PROGRAM) - ./$(TEST_PROGRAM) [list],[enumtable],[spi_flash_emu],[nvs],[long] + ./$(TEST_PROGRAM) -d yes $(COVERAGE_FILES): $(TEST_PROGRAM) long-test @@ -58,4 +58,4 @@ clean: rm -rf coverage_report/ rm -f coverage.info -.PHONY: clean all test +.PHONY: clean all test long-test diff --git a/components/nvs_flash/test_nvs_host/test_nvs.cpp b/components/nvs_flash/test_nvs_host/test_nvs.cpp index f35edf5b2d..dd013e24ac 100644 --- a/components/nvs_flash/test_nvs_host/test_nvs.cpp +++ b/components/nvs_flash/test_nvs_host/test_nvs.cpp @@ -720,9 +720,16 @@ TEST_CASE("can init storage from flash with random contents", "[nvs]") } -TEST_CASE("nvs api tests, starting with random data in flash", "[nvs][.][long]") +TEST_CASE("nvs api tests, starting with random data in flash", "[nvs][long]") { - for (size_t count = 0; count < 10000; ++count) { + const size_t testIters = 3000; + int lastPercent = -1; + for (size_t count = 0; count < testIters; ++count) { + int percentDone = (int) (count * 100 / testIters); + if (percentDone != lastPercent) { + lastPercent = percentDone; + printf("%d%%\n", percentDone); + } SpiFlashEmulator emu(10); emu.randomize(static_cast(count)); @@ -977,7 +984,7 @@ TEST_CASE("monkey test", "[nvs][monkey]") s_perf << "Monkey test: nErase=" << emu.getEraseOps() << " nWrite=" << emu.getWriteOps() << std::endl; } -TEST_CASE("test recovery from sudden poweroff", "[.][long][nvs][recovery][monkey]") +TEST_CASE("test recovery from sudden poweroff", "[long][nvs][recovery][monkey]") { std::random_device rd; std::mt19937 gen(rd()); diff --git a/tools/ci/apply_bot_filter.py b/tools/ci/apply_bot_filter.py index 26f458836e..29c8bb565e 100755 --- a/tools/ci/apply_bot_filter.py +++ b/tools/ci/apply_bot_filter.py @@ -28,8 +28,8 @@ def parse_filter(filter_name): return filters -def process_filter(filter_name, ci_name): - execute = True +def process_filter(execute_by_default, filter_name, ci_name): + execute = execute_by_default # bot message is case insensitive (processed with lower case). so we also convert ci_name to lower case. ci_name = ci_name.lower() @@ -51,8 +51,12 @@ def process_filter(filter_name, ci_name): if __name__ == "__main__": - need_to_execute = process_filter("BOT_STAGE_FILTER", os.getenv("CI_JOB_STAGE")) \ - and process_filter("BOT_JOB_FILTER", os.getenv("CI_JOB_NAME")) + execute_by_default = True + if os.getenv("BOT_NEEDS_TRIGGER_BY_NAME", "0") == "1": + execute_by_default = False + + need_to_execute = process_filter(True, "BOT_STAGE_FILTER", os.getenv("CI_JOB_STAGE")) \ + and process_filter(execute_by_default, "BOT_JOB_FILTER", os.getenv("CI_JOB_NAME")) if need_to_execute: sys.exit(0) else: