unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: taylanbayirli@gmail.com (Taylan Ulrich B.)
To: 14849@debbugs.gnu.org
Subject: bug#14849: (system vm coverage) `line-execution-counts' misleading output
Date: Fri, 12 Jul 2013 16:47:00 +0200	[thread overview]
Message-ID: <8761wfal97.fsf@taylan.uni.cx> (raw)

The following shell/guile transcript showcases a minimal test-case for
when a tail-call fools the code-coverage module into thinking that the
line with the tail-call was not executed.

The result in the Guile transcript, $1, is an alist from line numbers
(starting from zero) to execution counts.

Converting the relevant coverage-data object into LCOV data via
`coverage-data->lcov', as advertised in (info "(guile) Code
Coverage"), then to HTML via LCOV's genhtml(1), will result in the
relevant line being colored red and contribute negatively to the total
line-coverage percentage.

=== BEGIN TRANSCRIPT ===
$ cat /tmp/test.scm  
(define (tail-call-test)
  (display "foo\n")
  (tail-call-target))

(define (tail-call-target)
  (display "bar\n"))
$ guile              
GNU Guile 2.0.9.20-10454
Copyright (C) 1995-2013 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (begin
...   (load "/tmp/test.scm")
...   (call-with-values
...       (lambda ()
...         ((@ (system vm coverage) with-code-coverage)
...          ((@ (system vm vm) the-vm))
...          tail-call-test))
...     (lambda (data . values)
...       ((@ (system vm coverage) line-execution-counts) data "/tmp/test.scm"))))
;;; <stdin>:0:4095: warning: possibly unbound variable `tail-call-test'
foo
bar
$1 = ((5 . 1) (4 . 1) (2 . 0) (1 . 1) (0 . 1))
scheme@(guile-user)> 
=== END TRANSCRIPT ===





             reply	other threads:[~2013-07-12 14:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 14:47 Taylan Ulrich B. [this message]
2016-06-21  7:09 ` bug#14849: (system vm coverage) `line-execution-counts' misleading output Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761wfal97.fsf@taylan.uni.cx \
    --to=taylanbayirli@gmail.com \
    --cc=14849@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).