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
     1.1 --- a/Makefile	Wed Dec 27 16:18:10 2023 +0100
     1.2 +++ b/Makefile	Wed Dec 27 17:19:54 2023 +0100
     1.3 @@ -59,6 +59,10 @@
     1.4  check: compile test-compile FORCE
     1.5  	$(build_dir)/tests/ucxtest
     1.6  
     1.7 +check-coverage: FORCE
     1.8 +	$(MAKE) -s check
     1.9 +	@cd src && $(MAKE) check-coverage
    1.10 +
    1.11  test-compile:
    1.12  	cd tests && $(MAKE)
    1.13  
     2.1 --- a/src/Makefile	Wed Dec 27 16:18:10 2023 +0100
     2.2 +++ b/src/Makefile	Wed Dec 27 17:19:54 2023 +0100
     2.3 @@ -28,11 +28,21 @@
     2.4  
     2.5  OBJ_EXT=.o
     2.6  OBJ=$(SRC:%.c=$(build_dir)/%$(OBJ_EXT))
     2.7 +GCOV=$(SRC:%.c=%.c.gcov)
     2.8  
     2.9  static: $(build_dir)/libucx_static$(STLIB_EXT)
    2.10  
    2.11  shared: $(build_dir)/libucx$(SHLIB_EXT)
    2.12  
    2.13 +check-coverage: $(GCOV)
    2.14 +	mv *.gcov "$(build_dir)"
    2.15 +
    2.16 +%.c.gcov: %.c $(build_dir)/%.gcno
    2.17 +	gcov -Ho "$(build_dir)" $<
    2.18 +
    2.19 +$(build_dir)/%.gcno:
    2.20 +	test -f "$@"
    2.21 +
    2.22  $(build_dir)/libucx_static$(STLIB_EXT): $(OBJ)
    2.23  	$(AR) $(ARFLAGS) $@ $^
    2.24  

mercurial