unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Help me setup test coverage
@ 2018-03-06 19:07 amirouche
  2018-03-12 14:55 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: amirouche @ 2018-03-06 19:07 UTC (permalink / raw)
  To: Guile User

Hello all!


I have some difficulties setting up test coverage.

Here the procedure I use that inspired from guile/test-suite/guile-test:


(use-modules (system vm coverage)
             (system vm vm))


(define (run-test-with-coverage test)
  (call-with-values (lambda ()
                      (with-code-coverage
                       (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)))


It takes the name of a module as first argument and will load that file
inside 'with-code-coverage' and write the lcov .info file.

I've setup a simple example, it requires guile and lcov for genhtml.

You can reproduce the issue as follow:

  $ git clone https://github.com/a-guile-mind/coverage
  $ cd coverage
  $ make
    test echo
    Overall coverage rate:
      lines......: 0.0% (0 of 9164 lines)
      functions..: no data found

As you can see in the output, no lines seems to be visited by the vm.
The output should be at least one, the line inside test.scm.

What I am doing wrong?

Thanks in advance!






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

* Re: Help me setup test coverage
  2018-03-06 19:07 Help me setup test coverage amirouche
@ 2018-03-12 14:55 ` Ludovic Courtès
  2018-03-12 22:40   ` amirouche
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-03-12 14:55 UTC (permalink / raw)
  To: guile-user

Hello,

amirouche <amirouche@hypermove.net> skribis:

> I've setup a simple example, it requires guile and lcov for genhtml.
>
> You can reproduce the issue as follow:
>
>  $ git clone https://github.com/a-guile-mind/coverage
>  $ cd coverage
>  $ make
>    test echo
>    Overall coverage rate:
>      lines......: 0.0% (0 of 9164 lines)
>      functions..: no data found
>
> As you can see in the output, no lines seems to be visited by the vm.
> The output should be at least one, the line inside test.scm.

I think you need to use the VM’s “debug” engine, the one you get when
invoking “guile --debug”.

HTH!

Ludo’.




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

* Re: Help me setup test coverage
  2018-03-12 14:55 ` Ludovic Courtès
@ 2018-03-12 22:40   ` amirouche
  2018-03-13 10:54     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: amirouche @ 2018-03-12 22:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-user



Le lun. 12 mars 2018 à 15:55, Ludovic Courtès <ludo@gnu.org> a écrit 
:
> Hello,
> 
> amirouche <amirouche@hypermove.net> skribis:
> 
>>  I've setup a simple example, it requires guile and lcov for genhtml.
>> 
>>  You can reproduce the issue as follow:
>> 
>>   $ git clone https://github.com/a-guile-mind/coverage
>>   $ cd coverage
>>   $ make
>>     test echo
>>     Overall coverage rate:
>>       lines......: 0.0% (0 of 9164 lines)
>>       functions..: no data found
>> 
>>  As you can see in the output, no lines seems to be visited by the 
>> vm.
>>  The output should be at least one, the line inside test.scm.
> 
> I think you need to use the VM’s “debug” engine, the one you 
> get when
> invoking “guile --debug”.
> 
> HTH!
> 

Indeed, thanks a lot, I really appreciate your input as usual. I updated
the code in the repository [0]

[0] 
https://github.com/a-guile-mind/coverage/commit/d66861f949bcd6eea680506caee2268b48fcb75a

There is still a minor annoyance. In the manual [1] there is a 'modules'
keyword documented for the procedure 'coverage-data->lcov' but in the
current code that argument is gone [2]

[1] 
https://www.gnu.org/software/guile/manual/html_node/Code-Coverage.html#Code-Coverage
[2] 
http://git.savannah.gnu.org/cgit/guile.git/tree/module/system/vm/coverage.scm?h=stable-2.2#n301

Is there a known workaround to get the coverage only for a given module?

TIA!




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

* Re: Help me setup test coverage
  2018-03-12 22:40   ` amirouche
@ 2018-03-13 10:54     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-03-13 10:54 UTC (permalink / raw)
  To: amirouche; +Cc: guile-user

Hello,

amirouche <amirouche@hypermove.net> skribis:

>> I think you need to use the VM’s “debug” engine, the one you get
>> when
>> invoking “guile --debug”.
>>
>> HTH!
>>
>
> Indeed, thanks a lot, I really appreciate your input as usual. I updated
> the code in the repository [0]
>
> [0]
> https://github.com/a-guile-mind/coverage/commit/d66861f949bcd6eea680506caee2268b48fcb75a
>
> There is still a minor annoyance. In the manual [1] there is a 'modules'
> keyword documented for the procedure 'coverage-data->lcov' but in the
> current code that argument is gone [2]

I don’t know how to fix it, but there may be other issues: commit
581a4eb82b1534970060e3cbd79b9a96d351edf9 commented out a few things
there, with an explanation of what needs to be done to re-enable it.

Would you like to give it a go?

Ludo’.



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

end of thread, other threads:[~2018-03-13 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 19:07 Help me setup test coverage amirouche
2018-03-12 14:55 ` Ludovic Courtès
2018-03-12 22:40   ` amirouche
2018-03-13 10:54     ` Ludovic Courtès

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