diff --git a/tests/Makefile b/tests/Makefile
index 86b7503c935bfcee1b0042dc15193cb0c432f6e6..939490b3494e19bcd145e43b15fd4db0ba7eb14f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -129,7 +129,9 @@ fate-list:
 
 coverage.info: TAG = LCOV
 coverage.info:
-	$(M)lcov -q -d $(CURDIR) -b $(SRC_PATH) --capture -o $@
+	$(M)lcov -q -d $(CURDIR) -b $(SRC_PATH) --capture | \
+	    sed "s,$(CURDIR)/\./,$(CURDIR)/," > $@
+	$(M)lcov -q --remove $@ "/usr/include*" -o $@
 
 lcov:  TAG = GENHTML
 lcov: coverage.info