Do code coverage analysis, and publish the results to GitLab Pages.
This commit is contained in:
parent
aef609291d
commit
900f8d9df5
3 changed files with 28 additions and 8 deletions
|
@ -3,6 +3,7 @@ image: alpine
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
# build advent itself
|
# build advent itself
|
||||||
binary:
|
binary:
|
||||||
|
@ -15,6 +16,8 @@ binary:
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- advent
|
- advent
|
||||||
|
- "*.gcda"
|
||||||
|
- "*.gcno"
|
||||||
# cache outputs to reduce the build time
|
# cache outputs to reduce the build time
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
|
@ -47,7 +50,24 @@ test:
|
||||||
stage: test
|
stage: test
|
||||||
before_script:
|
before_script:
|
||||||
- apk update
|
- 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:
|
script:
|
||||||
- cd tests
|
- cd tests
|
||||||
- make
|
- 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
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -1,7 +1,7 @@
|
||||||
# Makefile for the open-source release of adventure 2.5
|
# Makefile for the open-source release of adventure 2.5
|
||||||
|
|
||||||
CC?=gcc
|
CC?=gcc
|
||||||
CCFLAGS=-std=c99
|
CCFLAGS=-std=c99 -O0 --coverage
|
||||||
LIBS=
|
LIBS=
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Linux)
|
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
|
SOURCES=$(OBJS:.o=.c) COPYING NEWS README TODO adventure.text advent.text control advent.h funcs.h
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CCFLAGS) -O $(DBX) -c $<
|
$(CC) $(CCFLAGS) $(DBX) -c $<
|
||||||
|
|
||||||
advent: $(OBJS) database.o
|
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
|
main.o: advent.h funcs.h database.h
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ compile: compile.c
|
||||||
|
|
||||||
database.c database.h: compile adventure.text
|
database.c database.h: compile adventure.text
|
||||||
./compile
|
./compile
|
||||||
$(CC) $(CCFLAGS) -O $(DBX) -c database.c
|
$(CC) $(CCFLAGS) $(DBX) -c database.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o advent advent.html advent.6 database.[ch] compile
|
rm -f *.o advent advent.html advent.6 database.[ch] compile
|
||||||
|
|
|
@ -18,10 +18,10 @@ clean:
|
||||||
|
|
||||||
# Show summary lines for all tests.
|
# Show summary lines for all tests.
|
||||||
testlist:
|
testlist:
|
||||||
@grep --text '^##' *.log
|
@grep '^##' *.log
|
||||||
listcheck:
|
listcheck:
|
||||||
@for f in *.log; do \
|
@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
|
done
|
||||||
|
|
||||||
# General regression testing of commands and output; look at the *.log and
|
# General regression testing of commands and output; look at the *.log and
|
||||||
|
@ -34,7 +34,7 @@ buildregress:
|
||||||
done
|
done
|
||||||
regress:
|
regress:
|
||||||
@for file in $(TESTLOADS); do \
|
@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; \
|
if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \
|
||||||
then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
|
then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \
|
||||||
else echo "*** Nonzero return status on $${file}!"; exit 1; fi \
|
else echo "*** Nonzero return status on $${file}!"; exit 1; fi \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue