Skip to content

Instantly share code, notes, and snippets.

@fukamachi
Created October 27, 2011 11:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fukamachi/1319363 to your computer and use it in GitHub Desktop.
Save fukamachi/1319363 to your computer and use it in GitHub Desktop.
Useful utilities for CL testing.
(in-package :cl-user)
(ql:quickload :cl-test-more)
(defun asdf-component-files (comp)
(etypecase comp
(asdf::cl-source-file
(list (asdf:component-pathname comp)))
(asdf::static-file nil)
(asdf::component
(loop for c in (asdf:module-components comp)
append (asdf-component-files c)))))
(defun run-test-system (name)
(let ((system (asdf:find-system name)))
(map nil #'ql:quickload
(asdf::component-load-dependencies system))
(dolist (file (asdf-component-files system))
(with-open-file
(log-stream
(merge-pathnames (format nil "~A.log" (pathname-name file)) file)
:direction :output
:if-does-not-exist :create
:if-exists :supersede)
(let ((test-more:*test-result-output*
(make-broadcast-stream *standard-output* log-stream))
(*error-output*
(make-broadcast-stream *error-output* log-stream)))
(handler-case (load file)
(error (condition)
(princ condition test-more:*test-result-output*))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment