add make target to automatically gather coverage info

Wed, 27 Dec 2023 17:19:54 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 27 Dec 2023 17:19:54 +0100
changeset 774
4fd4e0c6107a
parent 773
bbf2f18b3818
child 775
d3f451440eef

add make target to automatically gather coverage info

Makefile file | annotate | diff | comparison | revisions
src/Makefile file | annotate | diff | comparison | revisions
--- a/Makefile	Wed Dec 27 16:18:10 2023 +0100
+++ b/Makefile	Wed Dec 27 17:19:54 2023 +0100
@@ -59,6 +59,10 @@
 check: compile test-compile FORCE
 	$(build_dir)/tests/ucxtest
 
+check-coverage: FORCE
+	$(MAKE) -s check
+	@cd src && $(MAKE) check-coverage
+
 test-compile:
 	cd tests && $(MAKE)
 
--- a/src/Makefile	Wed Dec 27 16:18:10 2023 +0100
+++ b/src/Makefile	Wed Dec 27 17:19:54 2023 +0100
@@ -28,11 +28,21 @@
 
 OBJ_EXT=.o
 OBJ=$(SRC:%.c=$(build_dir)/%$(OBJ_EXT))
+GCOV=$(SRC:%.c=%.c.gcov)
 
 static: $(build_dir)/libucx_static$(STLIB_EXT)
 
 shared: $(build_dir)/libucx$(SHLIB_EXT)
 
+check-coverage: $(GCOV)
+	mv *.gcov "$(build_dir)"
+
+%.c.gcov: %.c $(build_dir)/%.gcno
+	gcov -Ho "$(build_dir)" $<
+
+$(build_dir)/%.gcno:
+	test -f "$@"
+
 $(build_dir)/libucx_static$(STLIB_EXT): $(OBJ)
 	$(AR) $(ARFLAGS) $@ $^
 

mercurial