Hi guile-devel,

I came across a discrepancy between the manual (section 6.27 “Code
Coverage Reports”) and the code. The manual says that
“coverage-data->lcov” should take “modules” as a keyword argument, but
the function itself has no keyword arguments. Being able to limit the
modules included in a coverage report is really useful, since normally
one doesn’t care about which lines of code in “ice-9/eval.scm” were
evaluated during tests. :)

This simple patch adds the “modules” keyword to “coverage-data->lcov” as
specified in the manual.


-- Tim

P.S. Thanks for all your work! Guile is a really fun and hackable
language.

>From 0c991fe96a44e8ac492abdb63fc5bc4e25e66ff9 Mon Sep 17 00:00:00 2001
From: Timothy Sample <samp...@ngyro.com>
Date: Fri, 8 Dec 2017 17:00:45 -0500
Subject: [PATCH] Add modules keyword to coverage-data->lcov

* module/system/vm/coverage.scm (coverage-data->lcov): Add modules
  keyword to select which modules are included in the report (as already
  documented in the manual).
---
 module/system/vm/coverage.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/module/system/vm/coverage.scm b/module/system/vm/coverage.scm
index f47e33f58..96890c0d2 100644
--- a/module/system/vm/coverage.scm
+++ b/module/system/vm/coverage.scm
@@ -301,11 +301,11 @@ was loaded at the time DATA was collected."
 ;;; LCOV output.
 ;;;
 
-(define* (coverage-data->lcov data port)
+(define* (coverage-data->lcov data port #:key (modules #f))
   "Traverse code coverage information DATA, as obtained with
 `with-code-coverage', and write coverage information in the LCOV format to PORT.
-The report will include all the modules loaded at the time coverage data was
-gathered, even if their code was not executed."
+The report will include all of MODULES (or, by default, the modules loaded at
+the time coverage data was gathered) even if their code was not executed."
 
   ;; FIXME: Re-enable this code, but using for-each-elf-symbol on each source
   ;; chunk.  Use that to build a map of file -> proc-addr + line + name.  Then
@@ -348,4 +348,4 @@ gathered, even if their code was not executed."
                       (format (current-error-port)
                               "skipping unknown source file: ~a~%"
                               file)))))
-            (instrumented-source-files data)))
+            (or modules (instrumented-source-files data))))
-- 
2.15.0

Reply via email to