Add gcov integration to test suite

This commit is contained in:
Michael Theall 2016-08-04 23:42:03 -05:00
parent 24548b03d1
commit 0dcc009ae3
2 changed files with 11 additions and 4 deletions

2
test/pc/.gitignore vendored
View File

@ -1,3 +1,5 @@
*.d *.d
*.o *.o
test test
coverage.info
lcov/

View File

@ -6,11 +6,11 @@ OFILES := $(addprefix build/,$(CXXFILES:.cpp=.o)) \
$(patsubst ../../source/maths/%,build/%,$(CFILES:.c=.o)) $(patsubst ../../source/maths/%,build/%,$(CFILES:.c=.o))
DFILES := $(wildcard build/*.d) DFILES := $(wildcard build/*.d)
CFLAGS := -Wall -g -pipe -I../../include CFLAGS := -Wall -g -pipe -I../../include --coverage
CXXFLAGS := $(CFLAGS) -std=gnu++11 -DGLM_FORCE_RADIANS CXXFLAGS := $(CFLAGS) -std=gnu++11 -DGLM_FORCE_RADIANS
LDFLAGS := $(ARCH) -pipe -lm LDFLAGS := $(ARCH) -pipe -lm --coverage
.PHONY: all clean .PHONY: all clean lcov
all: $(TARGET) all: $(TARGET)
@ -18,6 +18,11 @@ $(TARGET): $(OFILES)
@echo "Linking $@" @echo "Linking $@"
$(CXX) -o $@ $^ $(LDFLAGS) $(CXX) -o $@ $^ $(LDFLAGS)
lcov: all
@./$(TARGET)
@lcov --capture --no-external --directory ../../include --directory ../../source --directory ../../test/pc --output-file coverage.info
@genhtml coverage.info --output-directory lcov
$(OFILES): | build $(OFILES): | build
build: build:
@ -32,6 +37,6 @@ build/%.o : ../../source/maths/%.c $(wildcard *.h)
@$(CC) -o $@ -c $< $(CFLAGS) -MMD -MP -MF build/$*.d @$(CC) -o $@ -c $< $(CFLAGS) -MMD -MP -MF build/$*.d
clean: clean:
$(RM) -r $(TARGET) build/ $(RM) -r $(TARGET) build/ coverage.info lcov/
-include $(DFILES) -include $(DFILES)