unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#14849: (system vm coverage) `line-execution-counts' misleading output
@ 2013-07-12 14:47 Taylan Ulrich B.
  2016-06-21  7:09 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Taylan Ulrich B. @ 2013-07-12 14:47 UTC (permalink / raw)
  To: 14849

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 ===





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#14849: (system vm coverage) `line-execution-counts' misleading output
  2013-07-12 14:47 bug#14849: (system vm coverage) `line-execution-counts' misleading output Taylan Ulrich B.
@ 2016-06-21  7:09 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2016-06-21  7:09 UTC (permalink / raw)
  To: Taylan Ulrich B.; +Cc: 14849-done

I have tried this one on master and it exhibits the results you expect,
not the buggy results.  I added the test to the test suite.  I don't
plan on devoting resource to fixing this bug in 2.0 though, so I'm
closing it for now.  Feel free to reopen if you hvae a patch to fix :)

Andy

On Fri 12 Jul 2013 16:47, taylanbayirli@gmail.com (Taylan Ulrich B.) writes:

> 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 ===





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-21  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 14:47 bug#14849: (system vm coverage) `line-execution-counts' misleading output Taylan Ulrich B.
2016-06-21  7:09 ` Andy Wingo

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).