Skip to content

Instantly share code, notes, and snippets.

@JekoTronik
Last active April 23, 2020 20:46
Show Gist options
  • Save JekoTronik/6401d0a60a3e4e8829210e70583d0254 to your computer and use it in GitHub Desktop.
Save JekoTronik/6401d0a60a3e4e8829210e70583d0254 to your computer and use it in GitHub Desktop.
(use-modules (system vm coverage)
(system vm vm))
(add-to-load-path (dirname (current-filename)))
(call-with-values (lambda ()
(with-code-coverage (lambda ()
(load "tests.scm"))))
(lambda (tests-coverage-data . useless-values)
(call-with-output-file "lcov.info"
(lambda (lcov-file)
(coverage-data->lcov tests-coverage-data lcov-file)))))
;; Focus coverage on my module
(when (not (zero? (system* "lcov" "--remove" "lcov.info" "-o" "lcov-final.info" "/gnu/*")))
(error "lcov remove failed"))
(when (not (zero? (system* "genhtml" "lcov-final.info" "-o" "coverage")))
(error "genhtml failed"))
(delete-file "lcov.info")
(delete-file "lcov-final.info")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment