On 11 May 2011 03:00, Sean Bryant <sean@...> wrote:
> I'm running into trouble trying to generate coverage reports (using
> sb-cover, obviously) for a specific package in my project.
(defun call-with-coverage (thunk system)
;; Make sure it's dependencies are OK.
(asdf:load-system system)
(unwind-protect
(with-compilation-unit
(:policy `(optimize sb-cover:store-coverage-data))
;; Recompile with coverage instrumentation.
(asdf:load-system system :force (list system))
(funcall thunk))
;; Remove coverage instrumentation.
(asdf:load-system system :force (list system))))
(defmacro with-coverage ((system) &body body)
`(call-with-coverage (lambda () ,@body) ,system))
Then you can do eg.
(with-coverage (:esrap)
(sb-cover:reset-coverage)
(load "~/src/esrap-git/example-sexp.lisp")
(sb-cover:report "~/tmp/cover/"))
to generate the coverage report for the system.
Cheers,
-- Nikodemus
|