[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code coverage is broken

From: Amirouche Boubekki
Subject: Re: Code coverage is broken
Date: Sat, 9 Feb 2019 00:48:15 +0100

code coverage work with guile-2.2

Here is the test run:

address@hidden:~/src/scheme/guile/coverage$ guile --version
guile (GNU Guile) 2.2.4
Copyright (C) 2018 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later <>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
address@hidden:~/src/scheme/guile/coverage$ ls
Makefile  run-tests-with-coverage.scm  test.scm
address@hidden:~/src/scheme/guile/coverage$ cat Makefile
    @guile --debug run-tests-with-coverage.scm test.scm
    @genhtml | tail -n 3
address@hidden:~/src/scheme/guile/coverage$ cat run-tests-with-coverage.scm
(use-modules (system vm coverage)
             (system vm vm))

(define (run-test-with-coverage test)
  (call-with-values (lambda ()
                       (lambda ()
                         (load test))))
    (lambda (data result)
      (let ((port (open-output-file (string-append test ".info"))))
        (coverage-data->lcov data port)
        (close port)))))

(run-test-with-coverage (cadr (program-arguments)))
address@hidden:~/src/scheme/guile/coverage$ cat test.scm
(display "test echo\n")
address@hidden:~/src/scheme/guile/coverage$ make
test echo
Overall coverage rate:
  lines......: 1.5% (135 of 9180 lines)
  functions..: no data found

Get the code with: git clone

The thing that is not implemented is getting the coverage for the "current directory".
The percentage that genhtml gives is the overall coverage of all the code that is loaded (I guess).

Le ven. 8 févr. 2019 à 21:41, Nala Ginrut <address@hidden> a écrit :
Hi folks!
I'm trying to add code coverage for certain program.
However, the function callings are always unrecorded.
(use-modules (system vm coverage)
                         (system vm vm))
        (lambda ()
             (lambda () (display "hello\n"))))
        (lambda (data result)
          (let ((port (open-output-file "")))
            (coverage-data->lcov data port)
            (close port))))

(To someone who uses old 2.0, with-code-coverage interface has been
changed to accept only one thunk)

When I use lcov to generate coverage graph, it always complains that
 lines......: 0.0% (0 of 36447 lines)
  functions..: no data found
  branches...: no data found
I found the FN tag in info file is always missing.

Then I found in 581a4eb82b1534970060e3cbd79b9a96d351edf9

+      #;
         (for-each dump-function procs)
It seems that FN printing was skipped intended.

Is it a bug?
Anyone who has tried code coverage?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]