2016-08-17 11:08:22 -04:00
|
|
|
TEST_PROGRAM=test_nvs
|
2016-08-22 02:16:21 -04:00
|
|
|
all: $(TEST_PROGRAM)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
SOURCE_FILES = \
|
2017-03-02 01:22:22 -05:00
|
|
|
esp_error_check_stub.cpp \
|
2016-08-17 11:08:22 -04:00
|
|
|
$(addprefix ../src/, \
|
|
|
|
nvs_types.cpp \
|
|
|
|
nvs_api.cpp \
|
|
|
|
nvs_page.cpp \
|
|
|
|
nvs_pagemanager.cpp \
|
|
|
|
nvs_storage.cpp \
|
2016-09-20 10:40:12 -04:00
|
|
|
nvs_item_hash_list.cpp \
|
2019-11-24 22:32:40 -05:00
|
|
|
nvs_handle_simple.cpp \
|
|
|
|
nvs_handle_locked.cpp \
|
|
|
|
nvs_partition_manager.cpp \
|
2020-04-26 20:51:31 -04:00
|
|
|
nvs_partition.cpp \
|
|
|
|
nvs_encrypted_partition.cpp \
|
2019-11-24 22:32:40 -05:00
|
|
|
nvs_cxx_api.cpp \
|
2024-01-17 04:44:50 -05:00
|
|
|
nvs_platform.cpp \
|
2016-08-17 11:08:22 -04:00
|
|
|
) \
|
|
|
|
spi_flash_emulation.cpp \
|
|
|
|
test_compressed_enum_table.cpp \
|
|
|
|
test_spi_flash_emulation.cpp \
|
|
|
|
test_intrusive_list.cpp \
|
|
|
|
test_nvs.cpp \
|
2019-11-24 22:32:40 -05:00
|
|
|
test_partition_manager.cpp \
|
|
|
|
test_nvs_handle.cpp \
|
2020-03-20 01:35:36 -04:00
|
|
|
test_nvs_storage.cpp \
|
2020-04-26 20:51:31 -04:00
|
|
|
test_nvs_partition.cpp \
|
2019-11-24 22:32:40 -05:00
|
|
|
test_nvs_cxx_api.cpp \
|
2020-05-25 21:28:39 -04:00
|
|
|
test_nvs_initialization.cpp \
|
2016-08-17 11:08:22 -04:00
|
|
|
main.cpp
|
|
|
|
|
2021-06-02 23:59:00 -04:00
|
|
|
SOURCE_FILES_C = ../../esp_rom/linux/esp_rom_crc.c
|
|
|
|
|
2020-03-11 06:32:56 -04:00
|
|
|
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
|
|
|
|
COMPILER := clang
|
|
|
|
else
|
|
|
|
COMPILER := gcc
|
|
|
|
endif
|
|
|
|
|
2022-10-14 08:15:32 -04:00
|
|
|
CPPFLAGS += -I../private_include -I../include -I../src -I../../esp_rom/include -I../../esp_rom/include/linux -I../../log/include -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../esp_partition/include -I ../../hal/include -I ../../xtensa/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage -g2 -ggdb
|
|
|
|
CFLAGS += -fprofile-arcs -ftest-coverage -DLINUX_TARGET -DLINUX_HOST_LEGACY_TEST
|
|
|
|
CXXFLAGS += -std=c++11 -Wall -Werror -DLINUX_TARGET -DLINUX_HOST_LEGACY_TEST
|
2016-08-22 02:16:21 -04:00
|
|
|
LDFLAGS += -lstdc++ -Wall -fprofile-arcs -ftest-coverage
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2020-03-11 06:32:56 -04:00
|
|
|
ifeq ($(COMPILER),clang)
|
|
|
|
CFLAGS += -fsanitize=address
|
|
|
|
CXXFLAGS += -fsanitize=address
|
|
|
|
LDFLAGS += -fsanitize=address
|
|
|
|
endif
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
OBJ_FILES = $(SOURCE_FILES:.cpp=.o)
|
2021-06-02 23:59:00 -04:00
|
|
|
OBJ_FILES_C = $(SOURCE_FILES_C:.c=.o)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-08-22 02:16:21 -04:00
|
|
|
COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
$(OBJ_FILES): %.o: %.cpp
|
2021-06-02 23:59:00 -04:00
|
|
|
$(OBJ_FILES_C): %.c: %.c
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2021-06-02 23:59:00 -04:00
|
|
|
$(TEST_PROGRAM): clean-coverage $(OBJ_FILES) $(OBJ_FILES_C)
|
2018-07-02 07:10:43 -04:00
|
|
|
$(MAKE) -C ../../mbedtls/mbedtls/ lib
|
2021-06-02 23:59:00 -04:00
|
|
|
g++ $(LDFLAGS) -o $(TEST_PROGRAM) $(OBJ_FILES) $(OBJ_FILES_C) ../../mbedtls/mbedtls/library/libmbedcrypto.a
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
$(OUTPUT_DIR):
|
|
|
|
mkdir -p $(OUTPUT_DIR)
|
|
|
|
|
|
|
|
test: $(TEST_PROGRAM)
|
2018-04-15 23:51:43 -04:00
|
|
|
./$(TEST_PROGRAM) -d yes exclude:[long]
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-08-23 00:54:09 -04:00
|
|
|
long-test: $(TEST_PROGRAM)
|
2018-04-15 23:51:43 -04:00
|
|
|
./$(TEST_PROGRAM) -d yes
|
2016-08-23 00:54:09 -04:00
|
|
|
|
|
|
|
$(COVERAGE_FILES): $(TEST_PROGRAM) long-test
|
2016-08-22 02:16:21 -04:00
|
|
|
|
|
|
|
coverage.info: $(COVERAGE_FILES)
|
|
|
|
find ../src/ -name "*.gcno" -exec gcov -r -pb {} +
|
|
|
|
lcov --capture --directory ../src --no-external --output-file coverage.info
|
|
|
|
|
|
|
|
coverage_report: coverage.info
|
|
|
|
genhtml coverage.info --output-directory coverage_report
|
|
|
|
@echo "Coverage report is in coverage_report/index.html"
|
|
|
|
|
2020-03-11 05:59:27 -04:00
|
|
|
clean-coverage:
|
2016-08-22 02:16:21 -04:00
|
|
|
rm -f $(COVERAGE_FILES) *.gcov
|
|
|
|
rm -rf coverage_report/
|
|
|
|
rm -f coverage.info
|
2020-03-11 05:59:27 -04:00
|
|
|
|
|
|
|
clean: clean-coverage
|
|
|
|
$(MAKE) -C ../../mbedtls/mbedtls/ clean
|
2021-06-02 23:59:00 -04:00
|
|
|
rm -f $(OBJ_FILES) $(OBJ_FILES_C) $(TEST_PROGRAM)
|
2019-06-21 08:31:22 -04:00
|
|
|
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
|
2020-04-26 20:51:31 -04:00
|
|
|
rm -f ../nvs_partition_generator/partition_decrypted.bin
|
|
|
|
rm -f ../nvs_partition_generator/partition_encoded.bin
|
2019-11-24 22:32:40 -05:00
|
|
|
rm -f ../nvs_partition_generator/Test-1-partition-encrypted.bin
|
|
|
|
rm -f ../nvs_partition_generator/Test-1-partition.bin
|
|
|
|
rm -f ../../../tools/mass_mfg/samples/sample_values_multipage_blob_created.csv
|
|
|
|
rm -f ../../../tools/mass_mfg/samples/sample_values_singlepage_blob_created.csv
|
|
|
|
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2020-03-11 05:59:27 -04:00
|
|
|
.PHONY: clean clean-coverage all test long-test
|