-
Notifications
You must be signed in to change notification settings - Fork 2
/
coverage.lisp
41 lines (38 loc) · 1.69 KB
/
coverage.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;;; coverage.lisp --- Helper script for coverage report generation.
;;;;
;;;; Copyright (C) 2014, 2017 Jan Moringen
;;;;
;;;; Author: Jan Moringen <[email protected]>
(require :sb-cover)
(defun compute-coverage-for-system (system
&key
(output-directory
(merge-pathnames
(concatenate 'string (string system) "/")
"coverage-report/")))
(flet ((set-store-coverage (storep)
(eval `(declaim (optimize (sb-cover:store-coverage-data ,(if storep 3 0))))))
(load-system-silently (system &rest args)
(let* ((*standard-output* (make-broadcast-stream))
(*trace-output* *standard-output*))
(handler-bind ((style-warning #'muffle-warning))
(apply #'asdf:load-system system args)))))
(load-system-silently system) ; load dependencies
(unwind-protect
(progn
(set-store-coverage t)
(load-system-silently system :force t)
(set-store-coverage nil)
(let ((*compile-print* nil)
(*compile-progress* nil)
(*compile-verbose* nil))
(asdf:test-system system))
(sb-cover:report output-directory))
(set-store-coverage nil)
(load-system-silently system :force t)
(sb-cover:clear-coverage))))
(map nil #'compute-coverage-for-system
(mapcar (lambda (string)
(intern (string-upcase string) '#:keyword))
(or (rest sb-ext:*posix-argv*)
(mapcar #'pathname-name (directory "*.asd")))))