From: Jason S. Ninneman Date: Fri, 2 Jun 2017 22:02:34 +0000 (-0700) Subject: Do code coverage analysis, and publish the results to GitLab Pages. X-Git-Tag: 0.90~27 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=900f8d9df50daba2f678c43f9c85ca8e19900090;p=open-adventure.git Do code coverage analysis, and publish the results to GitLab Pages. --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13004d5..1dcb6c1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: alpine stages: - build - test + - deploy # build advent itself binary: @@ -15,6 +16,8 @@ binary: artifacts: paths: - advent + - "*.gcda" + - "*.gcno" # cache outputs to reduce the build time cache: paths: @@ -47,7 +50,24 @@ test: stage: test before_script: - apk update - - apk add make + - apk add make gcc + - apk add lcov --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted script: - cd tests - make + - cd .. + - lcov -t "advent" -o advent.info -c -d . + - genhtml -o coverage advent.info + artifacts: + paths: + - coverage + +pages: + stage: deploy + script: + - mv coverage public + artifacts: + paths: + - public + only: + - master diff --git a/Makefile b/Makefile index bdd19de..8cdf1b3 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Makefile for the open-source release of adventure 2.5 CC?=gcc -CCFLAGS=-std=c99 +CCFLAGS=-std=c99 -O0 --coverage LIBS= UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) @@ -12,10 +12,10 @@ OBJS=main.o init.o actions1.o actions2.o score.o misc.o database.o SOURCES=$(OBJS:.o=.c) COPYING NEWS README TODO adventure.text advent.text control advent.h funcs.h .c.o: - $(CC) $(CCFLAGS) -O $(DBX) -c $< + $(CC) $(CCFLAGS) $(DBX) -c $< advent: $(OBJS) database.o - $(CC) $(CCFLAGS) -O $(DBX) -o advent $(OBJS) $(LIBS) + $(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) $(LIBS) main.o: advent.h funcs.h database.h @@ -38,7 +38,7 @@ compile: compile.c database.c database.h: compile adventure.text ./compile - $(CC) $(CCFLAGS) -O $(DBX) -c database.c + $(CC) $(CCFLAGS) $(DBX) -c database.c clean: rm -f *.o advent advent.html advent.6 database.[ch] compile diff --git a/tests/Makefile b/tests/Makefile index dddb8c2..74332dc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,10 +18,10 @@ clean: # Show summary lines for all tests. testlist: - @grep --text '^##' *.log + @grep '^##' *.log listcheck: @for f in *.log; do \ - if ( head -3 $$f | grep --text -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \ + if ( head -3 $$f | grep -q '^ *##' ); then :; else echo "$$f needs a description"; fi; \ done # General regression testing of commands and output; look at the *.log and @@ -34,7 +34,7 @@ buildregress: done regress: @for file in $(TESTLOADS); do \ - $(ECHO) -n " $${file} "; grep --text '##' $${file}.log || echo ' ## (no description)'; \ + $(ECHO) -n " $${file} "; grep '##' $${file}.log || echo ' ## (no description)'; \ if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \ then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \ else echo "*** Nonzero return status on $${file}!"; exit 1; fi \