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 <
http://gnu.org/licenses/lgpl.html>.
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
all:
@guile --debug run-tests-with-coverage.scm test.scm
@genhtml
test.scm.info | 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 ()
(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)))
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
address@hidden:~/src/scheme/guile/coverage$