mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/nvs: fix host build with GCC 4.9, add coverage report generation
This commit is contained in:
parent
7998b6ca2e
commit
a65e019451
6
components/nvs_flash/.gitignore
vendored
6
components/nvs_flash/.gitignore
vendored
@ -1 +1,7 @@
|
|||||||
test/test_nvs
|
test/test_nvs
|
||||||
|
test/coverage
|
||||||
|
test/coverage.info
|
||||||
|
*.gcno
|
||||||
|
*.gcda
|
||||||
|
*.gcov
|
||||||
|
*.o
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
TEST_PROGRAM=test_nvs
|
TEST_PROGRAM=test_nvs
|
||||||
all: test
|
all: $(TEST_PROGRAM)
|
||||||
|
|
||||||
SOURCE_FILES = \
|
SOURCE_FILES = \
|
||||||
$(addprefix ../src/, \
|
$(addprefix ../src/, \
|
||||||
@ -17,12 +17,15 @@ SOURCE_FILES = \
|
|||||||
crc.cpp \
|
crc.cpp \
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
||||||
CPPFLAGS += -I../include -I../src -I./ -I../../esp32/include -I ../../spi_flash/include
|
CPPFLAGS += -I../include -I../src -I./ -I../../esp32/include -I ../../spi_flash/include -fprofile-arcs -ftest-coverage
|
||||||
|
CFLAGS += -fprofile-arcs -ftest-coverage
|
||||||
CXXFLAGS += -std=c++11 -Wall -Werror
|
CXXFLAGS += -std=c++11 -Wall -Werror
|
||||||
LDFLAGS += -lstdc++
|
LDFLAGS += -lstdc++ -Wall -fprofile-arcs -ftest-coverage
|
||||||
|
|
||||||
OBJ_FILES = $(SOURCE_FILES:.cpp=.o)
|
OBJ_FILES = $(SOURCE_FILES:.cpp=.o)
|
||||||
|
|
||||||
|
COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
|
||||||
|
|
||||||
$(OBJ_FILES): %.o: %.cpp
|
$(OBJ_FILES): %.o: %.cpp
|
||||||
|
|
||||||
$(TEST_PROGRAM): $(OBJ_FILES)
|
$(TEST_PROGRAM): $(OBJ_FILES)
|
||||||
@ -34,7 +37,20 @@ $(OUTPUT_DIR):
|
|||||||
test: $(TEST_PROGRAM)
|
test: $(TEST_PROGRAM)
|
||||||
./$(TEST_PROGRAM)
|
./$(TEST_PROGRAM)
|
||||||
|
|
||||||
|
$(COVERAGE_FILES): $(TEST_PROGRAM) test
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJ_FILES) $(TEST_PROGRAM)
|
rm -f $(OBJ_FILES) $(TEST_PROGRAM)
|
||||||
|
rm -f $(COVERAGE_FILES) *.gcov
|
||||||
|
rm -rf coverage_report/
|
||||||
|
rm -f coverage.info
|
||||||
|
|
||||||
.PHONY: clean all test
|
.PHONY: clean all test
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFailCountdown != SIZE_T_MAX && mFailCountdown-- == 0) {
|
if (mFailCountdown != SIZE_MAX && mFailCountdown-- == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFailCountdown != SIZE_T_MAX && mFailCountdown-- == 0) {
|
if (mFailCountdown != SIZE_MAX && mFailCountdown-- == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ protected:
|
|||||||
size_t mLowerSectorBound = 0;
|
size_t mLowerSectorBound = 0;
|
||||||
size_t mUpperSectorBound = 0;
|
size_t mUpperSectorBound = 0;
|
||||||
|
|
||||||
size_t mFailCountdown = SIZE_T_MAX;
|
size_t mFailCountdown = SIZE_MAX;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -554,11 +554,6 @@ public:
|
|||||||
static_assert(nKeys == sizeof(types) / sizeof(types[0]), "");
|
static_assert(nKeys == sizeof(types) / sizeof(types[0]), "");
|
||||||
static_assert(nKeys == sizeof(values) / sizeof(values[0]), "");
|
static_assert(nKeys == sizeof(values) / sizeof(values[0]), "");
|
||||||
|
|
||||||
|
|
||||||
auto generateRandomString = [](char* dst, size_t size) {
|
|
||||||
size_t len = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto randomRead = [&](size_t index) -> esp_err_t {
|
auto randomRead = [&](size_t index) -> esp_err_t {
|
||||||
switch (types[index]) {
|
switch (types[index]) {
|
||||||
case ItemType::I32:
|
case ItemType::I32:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user