Wednesday, 9 January 2008

Code coverage in SBCL

This is the most useful thing since macros: sb-cover.

No nonsense code coverage:


;;; The code coverage module
(require :sb-cover)

;;; Enable instrumentation
(declaim (optimize sb-cover:store-coverage-data))

;;; Force recompilation with instrumentation
(asdf:oos 'asdf:load-op :my-project-test :force t)

;;; Run the tests!
(my-project-test::run-all-tests)

;;; Create the report
(sb-cover:report "/tmp/report/")

;;; Disable instrumentation
(declaim (optimize (sb-cover:store-coverage-data 0)))


See Code coverage tool for SBCL for some nice output as well. I had no idea the cl-ppcre tests had such good coverage. Damn.

No comments: