mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 12:57:57 +00:00
make: add ability to collect code coverage (v2)
gcc is executed with the option --coverage. lcov creates HTML pages containing the source code annotated with coverage information. make GCOV=1 make test make gcov Look at gcov/html/index.html v2: declare the weak __gcov_flush Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
162cb47930
commit
134937bc87
17
Makefile
17
Makefile
@ -124,6 +124,10 @@ DEPS := $(patsubst %.o,%.d,$(OBJS))
|
|||||||
.PHONY: all zdtm test rebuild clean distclean tags cscope \
|
.PHONY: all zdtm test rebuild clean distclean tags cscope \
|
||||||
docs help pie protobuf x86
|
docs help pie protobuf x86
|
||||||
|
|
||||||
|
ifeq ($(GCOV),1)
|
||||||
|
%.o $(PROGRAM): override CFLAGS += --coverage
|
||||||
|
endif
|
||||||
|
|
||||||
all: pie
|
all: pie
|
||||||
$(Q) $(MAKE) $(PROGRAM)
|
$(Q) $(MAKE) $(PROGRAM)
|
||||||
|
|
||||||
@ -180,6 +184,8 @@ clean:
|
|||||||
$(Q) $(RM) -f ./*.bin
|
$(Q) $(RM) -f ./*.bin
|
||||||
$(Q) $(RM) -f ./$(PROGRAM)
|
$(Q) $(RM) -f ./$(PROGRAM)
|
||||||
$(Q) $(RM) -rf ./test/dump/
|
$(Q) $(RM) -rf ./test/dump/
|
||||||
|
$(Q) $(RM) -f ./*.gcov ./*.gcda ./*.gcno
|
||||||
|
$(Q) $(RM) -rf ./gcov
|
||||||
$(Q) $(MAKE) -C protobuf/ clean
|
$(Q) $(MAKE) -C protobuf/ clean
|
||||||
$(Q) $(MAKE) -C arch/x86/ clean
|
$(Q) $(MAKE) -C arch/x86/ clean
|
||||||
$(Q) $(MAKE) -C pie/ clean
|
$(Q) $(MAKE) -C pie/ clean
|
||||||
@ -218,6 +224,17 @@ help:
|
|||||||
$(E) ' rebuild - Force-rebuild of [*] targets'
|
$(E) ' rebuild - Force-rebuild of [*] targets'
|
||||||
$(E) ' test - Run zdtm test-suite'
|
$(E) ' test - Run zdtm test-suite'
|
||||||
|
|
||||||
|
gcov:
|
||||||
|
$(E) " GCOV"
|
||||||
|
$(Q) mkdir gcov && \
|
||||||
|
cd gcov && \
|
||||||
|
cp ../*.gcno ../*.c ../test/root/crtools/ && \
|
||||||
|
geninfo --no-checksum --output-filename tproxyd.l.info --no-recursion .. && \
|
||||||
|
geninfo --no-checksum --output-filename tproxyd.ns.info --no-recursion ../test/root/crtools && \
|
||||||
|
sed -i 's#/test/root/crtools##' tproxyd.ns.info && \
|
||||||
|
lcov -a tproxyd.l.info -a tproxyd.ns.info -o tproxyd.info && \
|
||||||
|
genhtml -o html tproxyd.info
|
||||||
|
|
||||||
deps-targets := $(OBJS) $(patsubst %.o,%.s,$(OBJS)) $(patsubst %.o,%.i,$(OBJS)) $(PROGRAM)
|
deps-targets := $(OBJS) $(patsubst %.o,%.s,$(OBJS)) $(patsubst %.o,%.i,$(OBJS)) $(PROGRAM)
|
||||||
|
|
||||||
.DEFAULT_GOAL := all
|
.DEFAULT_GOAL := all
|
||||||
|
@ -1702,6 +1702,9 @@ static int sigreturn_prep_xsave_frame(struct thread_restore_args *args, CoreEntr
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void __gcov_flush(void) __attribute__((weak));
|
||||||
|
void __gcov_flush(void) {}
|
||||||
|
|
||||||
static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
||||||
{
|
{
|
||||||
long restore_task_vma_len;
|
long restore_task_vma_len;
|
||||||
@ -1962,6 +1965,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
|||||||
|
|
||||||
close_image_dir();
|
close_image_dir();
|
||||||
|
|
||||||
|
__gcov_flush();
|
||||||
|
|
||||||
pr_info("task_args: %p\n"
|
pr_info("task_args: %p\n"
|
||||||
"task_args->pid: %d\n"
|
"task_args->pid: %d\n"
|
||||||
"task_args->nr_threads: %d\n"
|
"task_args->nr_threads: %d\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user