From c730c9e397938206dc950b8bd02c972ccaa7e6d2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 21 Jun 2019 20:31:22 +0800 Subject: [PATCH] nvs: minor host test fixes Fixes the tests to pass when some files already exist. Fixes clean target. Moves CONFIG_NVS_ENCRYPTION definition into sdkconfig.h. --- components/nvs_flash/test_nvs_host/Makefile | 12 ++++++------ components/nvs_flash/test_nvs_host/sdkconfig.h | 1 + components/nvs_flash/test_nvs_host/test_nvs.cpp | 9 +++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/components/nvs_flash/test_nvs_host/Makefile b/components/nvs_flash/test_nvs_host/Makefile index 76a8a5b875..d509fd6ee3 100644 --- a/components/nvs_flash/test_nvs_host/Makefile +++ b/components/nvs_flash/test_nvs_host/Makefile @@ -21,7 +21,7 @@ SOURCE_FILES = \ crc.cpp \ main.cpp -CPPFLAGS += -I../include -I../src -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage -DCONFIG_NVS_ENCRYPTION +CPPFLAGS += -I../include -I../src -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../soc/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage CFLAGS += -fprofile-arcs -ftest-coverage CXXFLAGS += -std=c++11 -Wall -Werror LDFLAGS += -lstdc++ -Wall -fprofile-arcs -ftest-coverage @@ -61,10 +61,10 @@ clean: rm -f $(COVERAGE_FILES) *.gcov rm -rf coverage_report/ rm -f coverage.info - rm ../nvs_partition_generator/partition_single_page.bin - rm ../nvs_partition_generator/partition_multipage_blob.bin - rm ../nvs_partition_generator/partition_encrypted.bin - rm ../nvs_partition_generator/partition_encrypted_using_keygen.bin - rm ../nvs_partition_generator/partition_encrypted_using_keyfile.bin + rm -f ../nvs_partition_generator/partition_single_page.bin + rm -f ../nvs_partition_generator/partition_multipage_blob.bin + rm -f ../nvs_partition_generator/partition_encrypted.bin + rm -f ../nvs_partition_generator/partition_encrypted_using_keygen.bin + rm -f ../nvs_partition_generator/partition_encrypted_using_keyfile.bin .PHONY: clean all test long-test diff --git a/components/nvs_flash/test_nvs_host/sdkconfig.h b/components/nvs_flash/test_nvs_host/sdkconfig.h index 80ffec3016..a38e0a10d8 100644 --- a/components/nvs_flash/test_nvs_host/sdkconfig.h +++ b/components/nvs_flash/test_nvs_host/sdkconfig.h @@ -1,2 +1,3 @@ +#define CONFIG_NVS_ENCRYPTION 1 //currently use the legacy implementation, since the stubs for new HAL are not done yet #define CONFIG_SPI_FLASH_USE_LEGACY_IMPL 1 diff --git a/components/nvs_flash/test_nvs_host/test_nvs.cpp b/components/nvs_flash/test_nvs_host/test_nvs.cpp index a92a20bc67..8326235ab4 100644 --- a/components/nvs_flash/test_nvs_host/test_nvs.cpp +++ b/components/nvs_flash/test_nvs_host/test_nvs.cpp @@ -14,6 +14,7 @@ #include "catch.hpp" #include "nvs.hpp" #include "nvs_test_api.h" +#include "sdkconfig.h" #ifdef CONFIG_NVS_ENCRYPTION #include "nvs_encr.hpp" #endif @@ -2470,10 +2471,10 @@ TEST_CASE("check and read data from partition generated via manufacturing utilit if (childpid == 0) { exit(execlp("bash", "bash", "-c", - "rm -rf ../../../tools/mass_mfg/host_test | \ - cp -rf ../../../tools/mass_mfg/testdata mfg_testdata | \ - cp -rf ../nvs_partition_generator/testdata . | \ - mkdir -p ../../../tools/mass_mfg/host_test",NULL)); + "rm -rf ../../../tools/mass_mfg/host_test && \ + cp -rf ../../../tools/mass_mfg/testdata mfg_testdata && \ + cp -rf ../nvs_partition_generator/testdata . && \ + mkdir -p ../../../tools/mass_mfg/host_test", NULL)); } else { CHECK(childpid > 0); waitpid(childpid, &status, 0);