unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Code coverage
@ 2019-04-12 10:35 jeremy
  2019-04-13 14:52 ` Jeremy Korwin-Zmijowski
  0 siblings, 1 reply; 4+ messages in thread
From: jeremy @ 2019-04-12 10:35 UTC (permalink / raw)
  To: guile-user

Hello dear guilers !

I have implemented a code coverage test with a piece of code I modified 
for my usage, here it is (filename : cybo-cov.scm):

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

(let ((output-directory
        (string-append
	(getenv "HOME") "/Workspace/guile-cybo/coverage")))
   (let-values (((data . values)
		(with-code-coverage (the-vm)
				    (lambda ()
				      (load "cybo-test.scm")))))
     (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-XXXXXX")))
	   (file (port-filename port)))
       (coverage-data->lcov data port)
       (close port)
       (when (not (zero? (system* "genhtml" file "-o" output-directory)))
	    (error "genhtml failed"))
       (delete-file file))))

When I execute

$ guile -L .

then

scheme@(guile-user)> (load "cybo-cov.scm")

The report seems to cover my project and all Guile 2.0 code. I would 
like the test to focus on my project only.
Does someone know how I can configure the test ?

Thank you in advance for your help.

Jeko



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

* Re: Code coverage
  2019-04-12 10:35 Code coverage jeremy
@ 2019-04-13 14:52 ` Jeremy Korwin-Zmijowski
  2019-04-13 15:59   ` Amirouche Boubekki
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Korwin-Zmijowski @ 2019-04-13 14:52 UTC (permalink / raw)
  To: guile-user

Le vendredi 12 avril 2019 à 12:35 +0200, jeremy@korwin-zmijowski.fr a
écrit :
> Hello dear guilers !
> 
> I have implemented a code coverage test with a piece of code I
> modified 
> for my usage, here it is (filename : cybo-cov.scm):
> 
> (use-modules (system vm coverage)
> 	     (system vm vm)
> 	     (srfi srfi-11))
> 
> (let ((output-directory
>         (string-append
> 	(getenv "HOME") "/Workspace/guile-cybo/coverage")))
>    (let-values (((data . values)
> 		(with-code-coverage (the-vm)
> 				    (lambda ()
> 				      (load "cybo-test.scm")))))
>      (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-
> XXXXXX")))
> 	   (file (port-filename port)))
>        (coverage-data->lcov data port)
>        (close port)
>        (when (not (zero? (system* "genhtml" file "-o" output-
> directory)))
> 	    (error "genhtml failed"))
>        (delete-file file))))
> 
> When I execute
> 
> $ guile -L .
> 
> then
> 
> scheme@(guile-user)> (load "cybo-cov.scm")
> 
> The report seems to cover my project and all Guile 2.0 code. I would 
> like the test to focus on my project only.
> Does someone know how I can configure the test ?
> 
> Thank you in advance for your help.
> 
> Jeko
> 

The code for Guile 2.2.3 is

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

(let ((output-directory (string-append
			 (getenv "HOME")
			 "/Workspace/guile-cybo/coverage")))
  (let-values (((data . values)
		(with-code-coverage
		 (lambda ()
		   (load "cybo-test.scm")))))
    (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-XXXXXX")))
	   (file (port-filename port)))
      (coverage-data->lcov data port)
      (close port)
      (when (not (zero? (system* "genhtml" file "-o" output-
directory)))
	(error "genhtml failed"))
      (delete-file file))))

Jeko




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

* Re: Code coverage
  2019-04-13 14:52 ` Jeremy Korwin-Zmijowski
@ 2019-04-13 15:59   ` Amirouche Boubekki
  2019-04-16 21:56     ` Jeremy Korwin
  0 siblings, 1 reply; 4+ messages in thread
From: Amirouche Boubekki @ 2019-04-13 15:59 UTC (permalink / raw)
  To: Jeremy Korwin-Zmijowski; +Cc: Guile User

Le sam. 13 avr. 2019 à 16:52, Jeremy Korwin-Zmijowski <
jeremy@korwin-zmijowski.fr> a écrit :

> Le vendredi 12 avril 2019 à 12:35 +0200, jeremy@korwin-zmijowski.fr a
> écrit :
> > Hello dear guilers !
> >
> > I have implemented a code coverage test with a piece of code I
> > modified
> > for my usage, here it is (filename : cybo-cov.scm):
> >
> > (use-modules (system vm coverage)
> >            (system vm vm)
> >            (srfi srfi-11))
> >
> > (let ((output-directory
> >         (string-append
> >       (getenv "HOME") "/Workspace/guile-cybo/coverage")))
> >    (let-values (((data . values)
> >               (with-code-coverage (the-vm)
> >                                   (lambda ()
> >                                     (load "cybo-test.scm")))))
> >      (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-
> > XXXXXX")))
> >          (file (port-filename port)))
> >        (coverage-data->lcov data port)
> >        (close port)
> >        (when (not (zero? (system* "genhtml" file "-o" output-
> > directory)))
> >           (error "genhtml failed"))
> >        (delete-file file))))
> >
> > When I execute
> >
> > $ guile -L .
> >
> > then
> >
> > scheme@(guile-user)> (load "cybo-cov.scm")
> >
> > The report seems to cover my project and all Guile 2.0 code. I would
> > like the test to focus on my project only.
> > Does someone know how I can configure the test ?
> >
> > Thank you in advance for your help.
> >
> > Jeko
> >
>
> The code for Guile 2.2.3 is
>
> (use-modules (system vm coverage)
>              (system vm vm)
>              (srfi srfi-11))
>
> (let ((output-directory (string-append
>                          (getenv "HOME")
>                          "/Workspace/guile-cybo/coverage")))
>   (let-values (((data . values)
>                 (with-code-coverage
>                  (lambda ()
>                    (load "cybo-test.scm")))))
>     (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-XXXXXX")))
>            (file (port-filename port)))
>       (coverage-data->lcov data port)
>       (close port)
>       (when (not (zero? (system* "genhtml" file "-o" output-
> directory)))
>         (error "genhtml failed"))
>       (delete-file file))))
>
> Jeko
>

I am not sure of what you are trying to achieve. There was recent-ish
thread about code coverage
in guile-devel mailing list:
http://lists.gnu.org/archive/html/guile-devel/2019-02/msg00029.html

HTH


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

* Re: Code coverage
  2019-04-13 15:59   ` Amirouche Boubekki
@ 2019-04-16 21:56     ` Jeremy Korwin
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Korwin @ 2019-04-16 21:56 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: Guile User

Le samedi 13 avril 2019 à 17:59 +0200, Amirouche Boubekki a écrit :
> 
> 
> Le sam. 13 avr. 2019 à 16:52, Jeremy Korwin-Zmijowski <
> jeremy@korwin-zmijowski.fr> a écrit :
> > Le vendredi 12 avril 2019 à 12:35 +0200, jeremy@korwin-zmijowski.fr
> >  a
> > écrit :
> > > Hello dear guilers !
> > > 
> > > I have implemented a code coverage test with a piece of code I
> > > modified 
> > > for my usage, here it is (filename : cybo-cov.scm):
> > > 
> > > (use-modules (system vm coverage)
> > >            (system vm vm)
> > >            (srfi srfi-11))
> > > 
> > > (let ((output-directory
> > >         (string-append
> > >       (getenv "HOME") "/Workspace/guile-cybo/coverage")))
> > >    (let-values (((data . values)
> > >               (with-code-coverage (the-vm)
> > >                                   (lambda ()
> > >                                     (load "cybo-test.scm")))))
> > >      (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-
> > > XXXXXX")))
> > >          (file (port-filename port)))
> > >        (coverage-data->lcov data port)
> > >        (close port)
> > >        (when (not (zero? (system* "genhtml" file "-o" output-
> > > directory)))
> > >           (error "genhtml failed"))
> > >        (delete-file file))))
> > > 
> > > When I execute
> > > 
> > > $ guile -L .
> > > 
> > > then
> > > 
> > > scheme@(guile-user)> (load "cybo-cov.scm")
> > > 
> > > The report seems to cover my project and all Guile 2.0 code. I
> > would 
> > > like the test to focus on my project only.
> > > Does someone know how I can configure the test ?
> > > 
> > > Thank you in advance for your help.
> > > 
> > > Jeko
> > > 
> > 
> > The code for Guile 2.2.3 is
> > 
> > (use-modules (system vm coverage)
> >              (system vm vm)
> >              (srfi srfi-11))
> > 
> > (let ((output-directory (string-append
> >                          (getenv "HOME")
> >                          "/Workspace/guile-cybo/coverage")))
> >   (let-values (((data . values)
> >                 (with-code-coverage
> >                  (lambda ()
> >                    (load "cybo-test.scm")))))
> >     (let* ((port (mkstemp! (string-copy "/tmp/cybo-coverage-
> > XXXXXX")))
> >            (file (port-filename port)))
> >       (coverage-data->lcov data port)
> >       (close port)
> >       (when (not (zero? (system* "genhtml" file "-o" output-
> > directory)))
> >         (error "genhtml failed"))
> >       (delete-file file))))
> > 
> > Jeko
> 
> I am not sure of what you are trying to achieve. There was recent-ish 
> thread about code coverage
> in guile-devel mailing list: 
> http://lists.gnu.org/archive/html/guile-devel/2019-02/msg00029.html
> 
> HTH

Hello Amirouche !

I am confused. 

Yesterday, the report gave me the function coverage. Today, after I
read the mailing list you pointed out, I deleted the html report and
re-launch the coverage (juste to confirm I do have the function
coverage). And... I lost the function coverage report ! It never come
back haha what's the **** ?

I was going to test my coverage by browsing and parsing the html report
:(

I will give the shot to the patch you give in the mailing list.

Jeko




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

end of thread, other threads:[~2019-04-16 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-12 10:35 Code coverage jeremy
2019-04-13 14:52 ` Jeremy Korwin-Zmijowski
2019-04-13 15:59   ` Amirouche Boubekki
2019-04-16 21:56     ` Jeremy Korwin

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