From: Sean Bryant <sean@vi...> - 2011-05-11 00:56:15
First time posting and a fairly new user. I'm a fairly new lisper and
I'm running into trouble trying to generate coverage reports (using
sb-cover, obviously) for a specific package in my project.
I tried to just add the (declaim (optimization
sb-cover:store-coverage-data)) after loading the system, but then I
realized I made a horrible mistake as sbcl uses that optimization
declaration to add tracing data to the compiled code. I then naively
decided it would be a good idea to just force a recompile of the
system. To my horror, I ended up recompiling everything sbcl touched,
cl-sql, bordeaux threads, and more. The good news is that I managed to
generate the coverage report but only with tons of external dependencies
being included in the report as well. As much as I like knowing these
things, it's not exactly useful.
The solution I'm trying to come up with is creating a new type of
operation in asdf conveniently called cover-op. I haven't had much luck
in getting this working (I've only spent an hour on this, so not really
surprising given my exposure to asdf). Currently, I like the setup with
asdf:test-system and then just specialize perform to run the tests. I
would like to do the same thing to generate coverage reports, but the
compilation step is proving the be a problem.
I'm wondering what other sbcl users do to ensure coverage reports are
generating for only the "interesting" aspects of your applications?
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.
(:policy `(optimize sb-cover:store-coverage-data))
;; Recompile with coverage instrumentation.
(asdf:load-system system :force (list system))
;; 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.
to generate the coverage report for the system.