From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jessica Tallon Newsgroups: gmane.lisp.guile.bugs Subject: bug#54911: Missing modules argument for coverage-data->lcov Date: Wed, 13 Apr 2022 16:01:27 +0200 Message-ID: <87tuax6pp7.fsf@tsyesika.se> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2626"; mail-complaints-to="usenet@ciao.gmane.io" To: 54911@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Apr 13 16:09:22 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nedgP-0000T1-Sb for guile-bugs@m.gmane-mx.org; Wed, 13 Apr 2022 16:09:21 +0200 Original-Received: from localhost ([::1]:52498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nedgO-0007qm-LA for guile-bugs@m.gmane-mx.org; Wed, 13 Apr 2022 10:09:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nedg6-0007qW-PE for bug-guile@gnu.org; Wed, 13 Apr 2022 10:09:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nedg6-0001zu-GC for bug-guile@gnu.org; Wed, 13 Apr 2022 10:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nedg6-0008FR-C3 for bug-guile@gnu.org; Wed, 13 Apr 2022 10:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jessica Tallon Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 13 Apr 2022 14:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54911 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164985893031683 (code B ref -1); Wed, 13 Apr 2022 14:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Apr 2022 14:08:50 +0000 Original-Received: from localhost ([127.0.0.1]:53447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nedfu-0008Ex-Hg for submit@debbugs.gnu.org; Wed, 13 Apr 2022 10:08:50 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nedft-0008Eq-B5 for submit@debbugs.gnu.org; Wed, 13 Apr 2022 10:08:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nedft-0007oD-7p for bug-guile@gnu.org; Wed, 13 Apr 2022 10:08:49 -0400 Original-Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:33488) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1nedfr-0001vr-BP for bug-guile@gnu.org; Wed, 13 Apr 2022 10:08:48 -0400 Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Kdkw95HcPz9sTY for ; Wed, 13 Apr 2022 16:08:41 +0200 (CEST) Received-SPF: pass client-ip=2001:67c:2050:0:465::101; envelope-from=tsyesika@tsyesika.se; helo=mout-p-101.mailbox.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10275 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, I noticed the documentation specify that the `coverage-data->lcov` function should be able to take modules to limit the scope of the data that's coverted to lcov. From the docs: -- Scheme Procedure: coverage-data->lcov data port #:key modules Traverse code coverage information DATA, as obtained with =E2=80=98with-code-coverage=E2=80=99, and write coverage information t= o port in the =E2=80=98.info=E2=80=99 format used by LCOV (http://ltp.sourceforge.net/coverage/lcov.php). The report will include all of MODULES (or, by default, all the currently loaded modules) even if their code was not executed. However I noticed that this didn't match the code. I've attached a patch which implements the behavour described in the docs. Thanks, Jessica. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-missing-modules-argument-for-coverage-data-lcov.patch Content-Description: patch adding missing modules argument >From 828daf200539d3a642fcf8210df7b58aa0d5fede Mon Sep 17 00:00:00 2001 From: Jessica Tallon Date: Wed, 13 Apr 2022 15:57:24 +0200 Subject: [PATCH] Fix missing modules argument for coverage-data->lcov The code coverage function `coverage-data->lcov` has a documented `modules` argument, however that was missing from the source. I have added it so when supplied it only converts the coverage data for the supplied modules. If not supplied it defaults the old behavour of including all the modules currently loaded. --- module/system/vm/coverage.scm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/module/system/vm/coverage.scm b/module/system/vm/coverage.scm index 0d51e261a..f1d65cc6c 100644 --- a/module/system/vm/coverage.scm +++ b/module/system/vm/coverage.scm @@ -300,7 +300,7 @@ 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 @@ -325,6 +325,12 @@ gathered, even if their code was not executed." ;; Output per-file coverage data. (format port "TN:~%") + (define source-files + (filter + (lambda (file) + (or (not modules) (member file modules))) + (instrumented-source-files data))) + (for-each (lambda (file) (let ((path (search-path %load-path file))) (if (string? path) @@ -345,6 +351,6 @@ gathered, even if their code was not executed." (format port "end_of_record~%")) (begin (format (current-error-port) - "skipping unknown source file: ~a~%" + "skipping source file: ~a~%" file))))) - (instrumented-source-files data))) + source-files)) -- 2.35.1 --=-=-=--