Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2020-12-31 22:41:35 +0300
committerChristopher Haster <chaster@utexas.edu>2021-01-10 11:12:45 +0300
commiteeeceb9e308491493e41520277319e4c3a44c3ee (patch)
tree57e4084881934a6de91362a11a399aedb7322c89 /Makefile
parentb2235e956dda7e69fc9048c1768fcfce45c913b9 (diff)
Added coverage.py, and optional coverage info to test.py
Now coverage information can be collected if you provide the --coverage to test.py. Internally this uses GCC's gcov instrumentation along with a new script, coverage.py, to parse *.gcov files. The main use for this is finding coverage info during CI runs. There's a risk that the instrumentation may make it more difficult to debug, so I decided to not make coverage collection enabled by default.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 16 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0cf3327..acdd460 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@ CC ?= gcc
AR ?= ar
SIZE ?= size
NM ?= nm
+GCOV ?= gcov
SRC += $(wildcard *.c bd/*.c)
OBJ := $(SRC:.c=.o)
@@ -31,6 +32,12 @@ override CFLAGS += -Wextra -Wshadow -Wjump-misses-init -Wundef
ifdef VERBOSE
override SCRIPTFLAGS += -v
endif
+ifdef EXEC
+override TESTFLAGS += $(patsubst %,--exec=%,$(EXEC))
+endif
+ifdef COVERAGE
+override TESTFLAGS += --coverage
+endif
all: $(TARGET)
@@ -43,11 +50,14 @@ size: $(OBJ)
code:
./scripts/code.py $(SCRIPTFLAGS)
+coverage:
+ ./scripts/coverage.py $(SCRIPTFLAGS)
+
test:
- ./scripts/test.py $(EXEC:%=--exec=%) $(SCRIPTFLAGS)
+ ./scripts/test.py $(TESTFLAGS) $(SCRIPTFLAGS)
.SECONDEXPANSION:
test%: tests/test$$(firstword $$(subst \#, ,%)).toml
- ./scripts/test.py $@ $(EXEC:%=--exec=%) $(SCRIPTFLAGS)
+ ./scripts/test.py $@ $(TESTFLAGS) $(SCRIPTFLAGS)
-include $(DEP)
@@ -63,6 +73,9 @@ lfs: $(OBJ)
%.s: %.c
$(CC) -S $(CFLAGS) $< -o $@
+%.gcda.gcov: %.gcda
+ ( cd $(dir $@) ; $(GCOV) -ri $(notdir $<) )
+
clean:
rm -f $(TARGET)
rm -f $(OBJ)
@@ -70,3 +83,4 @@ clean:
rm -f $(ASM)
rm -f tests/*.toml.*
rm -f sizes/*
+ rm -f results/*