mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-25 00:00:15 +01:00
Hook up gcov
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ad8e0d2857
commit
b06f6e9d41
3 changed files with 71 additions and 5 deletions
20
configure.ac
20
configure.ac
|
|
@ -50,6 +50,26 @@ fi
|
|||
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
|
||||
|
||||
|
||||
AC_MSG_CHECKING([whether to build with gcov])
|
||||
AC_ARG_ENABLE([gcov],
|
||||
[AS_HELP_STRING([--enable-gcov],
|
||||
[Whether to enable coverage testing (default:enabled)])]
|
||||
[],
|
||||
[enable_gcov=yes],
|
||||
)
|
||||
AS_IF([test "x$enable_gcov" != "xno"],
|
||||
[
|
||||
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
enable_gcov=yes
|
||||
],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"])
|
||||
AC_SUBST([GCOV_CFLAGS])
|
||||
AC_SUBST([GCOV_LDFLAGS])
|
||||
AC_MSG_RESULT([$enable_gcov])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
libevdev/Makefile
|
||||
man/Makefile
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
lib_LTLIBRARIES=libevdev.la
|
||||
|
||||
AM_CPPFLAGS = $(GCOV_CFLAGS)
|
||||
|
||||
libevdev_la_SOURCES = \
|
||||
libevdev.h \
|
||||
libevdev-int.h \
|
||||
libevdev-util.h \
|
||||
libevdev.c
|
||||
|
||||
libevdev_la_LDFLAGS = -version-info $(LIBEVDEV_LT_VERSION) -export-symbols-regex '^libevdev_'
|
||||
libevdev_la_LDFLAGS = -version-info $(LIBEVDEV_LT_VERSION) -export-symbols-regex '^libevdev_' $(GCOV_LDFLAGS)
|
||||
|
||||
libevdevincludedir = $(includedir)/libevdev-1.0/libevdev
|
||||
libevdevinclude_HEADERS = libevdev.h
|
||||
|
|
|
|||
|
|
@ -8,13 +8,57 @@ libevdev_sources = $(top_srcdir)/libevdev/libevdev.c \
|
|||
$(top_srcdir)/libevdev/libevdev-int.h
|
||||
common_sources = $(libevdev_sources) test-common-uinput.c test-common-uinput.h
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/libevdev $(CHECK_CFLAGS)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/libevdev $(CHECK_CFLAGS) $(GCOV_CFLAGS)
|
||||
|
||||
|
||||
|
||||
test_event_names_SOURCES = test-event-names.c $(common_sources)
|
||||
test_event_names_LDADD = $(CHECK_LIBS)
|
||||
test_event_names_LDADD = $(CHECK_LIBS) $(GCOV_LDFLAGS)
|
||||
|
||||
test_libevdev_init_SOURCES = test-libevdev-init.c $(common_sources)
|
||||
test_libevdev_init_LDADD = $(CHECK_LIBS)
|
||||
test_libevdev_init_LDADD = $(CHECK_LIBS) $(GCOV_LDFLAGS)
|
||||
|
||||
test_libevdev_has_event_SOURCES = test-libevdev-has-event.c $(common_sources)
|
||||
test_libevdev_has_event_LDADD = $(CHECK_LIBS)
|
||||
test_libevdev_has_event_LDADD = $(CHECK_LIBS) $(GCOV_LDFLAGS)
|
||||
|
||||
if GCOV_ENABLED
|
||||
gcov-clean:
|
||||
@rm -f *.gcov
|
||||
|
||||
gcov-report.txt: gcov-clean check-TESTS
|
||||
$(AM_V_GEN)(rm -rf $@; \
|
||||
echo "========== coverage report ========" >> $@; \
|
||||
for file in `find $(top_srcdir)/libevdev -name "*.c" -printf "%P\n"`; do \
|
||||
gcov $$file > /dev/null; \
|
||||
if test -f $$file.gcov; then \
|
||||
total=`grep -v " -:" $$file.gcov | wc -l`; \
|
||||
missing=`grep "#####" $$file.gcov | wc -l`; \
|
||||
hit=$$((total - missing)); \
|
||||
echo -e "$$file: total lines: $$total not tested: $$missing ($$((($$hit * 100)/$$total))%)"; \
|
||||
fi \
|
||||
done >> $@; \
|
||||
echo "========== =============== ========" >> $@; \
|
||||
)
|
||||
|
||||
gcov: gcov-report.txt
|
||||
@cat gcov-report.txt
|
||||
|
||||
check-local: gcov
|
||||
|
||||
else
|
||||
|
||||
gcov-report.txt:
|
||||
@true
|
||||
|
||||
gcov:
|
||||
@true
|
||||
|
||||
gcov-clean:
|
||||
@true
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: gcov gcov-clean gcov-report.txt
|
||||
|
||||
clean-local: gcov-clean
|
||||
rm -f *.gcno *.gcda
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue