mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-08 20:55:14 -05:00
Add unity memory extension, fake_assert, and enable -fsanitize=address (#506)
* Enable libunitymemory extension to track dynamic memory usage during unit tests * Use UnityMemory in timers_utest.c * Add fake_assert.h to allow mocking of configASSERT calls * Add .editorconfig to make github show indentation correctly * Add unity memory and fake_assert to queue_utest.c * Add -fsanitize=address CFLAG when running unit tests * Define mtCOVERAGE_TEST_MARKER macro to include mtCOVERAGE_TEST_MARKER lines in coverage figures * Add additional memory check / protection CFLAGS for CMock tests * Fix out of bounds array access in list_utest.c * Move the fake_assert.h include to the top of FreeRTOSConfig.h
This commit is contained in:
parent
c4d8002634
commit
570ae6bb52
11 changed files with 151 additions and 59 deletions
|
|
@ -12,8 +12,10 @@ include makefile.in
|
|||
all: doc coverage
|
||||
execs: $(UNITS) | directories
|
||||
|
||||
|
||||
$(UNITS) : ${LIB_DIR}/libcmock.so ${LIB_DIR}/libunity.so | directories
|
||||
$(UNITS) : ${LIB_DIR}/libcmock.so \
|
||||
${LIB_DIR}/libunity.so \
|
||||
${LIB_DIR}/libunitymemory.so \
|
||||
| directories
|
||||
$(MAKE) -C $@
|
||||
|
||||
doc: | directories
|
||||
|
|
@ -41,23 +43,31 @@ help:
|
|||
@echo -e 'Usage: $$ make <unit>\n '
|
||||
@echo -e ' where <unit> is one of: $(UNITS) doc all run run_formatted run_col run_col_formatted coverage'
|
||||
|
||||
$(LIB_DIR)/libcmock.so : ${CMOCK_SRC_DIR}/cmock.c \
|
||||
${CMOCK_SRC_DIR}/cmock.h \
|
||||
${LIB_DIR}/libunity.so \
|
||||
$(LIB_DIR)/libcmock.so : ${CMOCK_SRC_DIR}/cmock.c \
|
||||
${CMOCK_SRC_DIR}/cmock.h \
|
||||
${LIB_DIR}/libunity.so \
|
||||
Makefile | directories
|
||||
${CC} -o $@ -shared -fPIC $< ${INCLUDE_DIR}
|
||||
|
||||
$(LIB_DIR)/libunity.so : ${UNITY_SRC_DIR}/unity.c \
|
||||
${UNITY_SRC_DIR}/unity.h \
|
||||
Makefile | directories
|
||||
$(LIB_DIR)/libunity.so : ${UNITY_SRC_DIR}/unity.c \
|
||||
${UNITY_SRC_DIR}/unity.h \
|
||||
Makefile | directories
|
||||
${CC} -o $@ -shared -fPIC $<
|
||||
|
||||
$(LIB_DIR)/libunitymemory.so: ${UNITY_EXTRAS_DIR}/memory/src/unity_memory.c \
|
||||
${UNITY_EXTRAS_DIR}/memory/src/unity_memory.h \
|
||||
${LIB_DIR}/libunity.so \
|
||||
Makefile | directories
|
||||
${CC} -o $@ -shared -fPIC $< ${INCLUDE_DIR}
|
||||
|
||||
run : $(UNITS) directories
|
||||
-rm $(BUILD_DIR)/unit_test_report.txt
|
||||
for f in $(BIN_DIR)/*; do \
|
||||
$${f} | tee -a $(BUILD_DIR)/unit_test_report.txt ; done
|
||||
cd $(BUILD_DIR) && \
|
||||
ruby $(UNITY_BIN_DIR)/parse_output.rb -xml $(BUILD_DIR)/unit_test_report.txt
|
||||
for f in $(BIN_DIR)/*; do \
|
||||
$${f} | tee -a $(BUILD_DIR)/unit_test_report.txt; \
|
||||
done
|
||||
cd $(BUILD_DIR) && \
|
||||
ruby $(UNITY_BIN_DIR)/parse_output.rb -xml \
|
||||
$(BUILD_DIR)/unit_test_report.txt
|
||||
|
||||
run_col : $(UNITS) zero_coverage | directories
|
||||
for f in $(BIN_DIR)/*; do \
|
||||
|
|
@ -65,17 +75,17 @@ run_col : $(UNITS) zero_coverage | directories
|
|||
|
||||
run_formatted : $(UNITS) zero_coverage | directories
|
||||
for f in $(BIN_DIR)/*; do \
|
||||
$${f} > $(BUILD_DIR)/output; \
|
||||
ruby $(UNITY_BIN_DIR)/parse_output.rb $(BUILD_DIR)/output ; \
|
||||
done
|
||||
$${f} > $(BUILD_DIR)/output; \
|
||||
ruby $(UNITY_BIN_DIR)/parse_output.rb $(BUILD_DIR)/output ; \
|
||||
done
|
||||
|
||||
run_col_formatted : $(UNITS) zero_coverage | directories
|
||||
for f in $(BIN_DIR)/*; do \
|
||||
$${f} > $(BUILD_DIR)/output; \
|
||||
ruby -r $(UNITY_BIN_DIR)/colour_reporter.rb \
|
||||
$${f} > $(BUILD_DIR)/output; \
|
||||
ruby -r $(UNITY_BIN_DIR)/colour_reporter.rb \
|
||||
-e "report('$$(ruby $(UNITY_BIN_DIR)/parse_output.rb \
|
||||
$(BUILD_DIR)/output)')"; \
|
||||
done
|
||||
$(BUILD_DIR)/output)')"; \
|
||||
done
|
||||
|
||||
zero_coverage :
|
||||
lcov --zerocounters --directory $(BUILD_DIR)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue