Adds test coverage with gcov & lcov ++

This commit is contained in:
Yann Weber 2023-02-18 22:45:24 +01:00
commit a57e875b07
9 changed files with 118 additions and 17 deletions

View file

@ -1,5 +1,4 @@
bin_PROGRAMS = asmsh child
noinst_LIBRARIES = libcheck_asmsh.a
libcheck_asmsh_a_SOURCES = mmap_parse.c asm_env.c compile.c logger.c
@ -8,8 +7,32 @@ child_SOURCES = child.s
SUBDIRS =
if CHECK
noinst_LIBRARIES = libcheck_asmsh.a
libcheck_asmsh_a_CFLAGS = @CFLAGS@ -fprofile-arcs -ftest-coverage
SUBDIRS += tests
LCOV_INFO=lcov.info
LCOV_HTML=lcov_html
checks: check coverage
coverage: $(LCOV_HTML)
$(LCOV_INFO): gcov
lcov --capture --directory . --output-file $@
$(LCOV_HTML): $(LCOV_INFO)
genhtml $< --output-directory $@
gcov: *.gcno
gcov -j $^
clean-local:
-rm -rf *.gcov *.gcda *.gcno $(LCOV_INFO) $(LCOV_HTML)
endif
child$(EXEEXT): $(child_SOURCES:.s=.o)
ld $(child_LDFLAGS) -o $@ $<