Skip to content

Commit

Permalink
Overhaul CL-BENCH invocation mechanism
Browse files Browse the repository at this point in the history
New location for CL-BENCH which now contains an ASDF definition.
  • Loading branch information
easye committed May 30, 2020
1 parent 7263f8e commit da16e96
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
8 changes: 3 additions & 5 deletions abcl.asd
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,9 @@ be in a directory named '../ansi-test/'."
:description "Test ABCL with CL-BENCH."
:perform (test-op (o s)
(uiop:symbol-call :abcl.test.cl-bench 'run))
:components ((:module package :pathname "../cl-bench/"
:components ((:file "defpackage")))
(:module wrapper :pathname "test/lisp/cl-bench/"
:depends-on (package) :components
((:file "wrapper")))))
:components ((:module wrapper :pathname "test/lisp/cl-bench/"
:components ((:file "wrapper")))))

(defsystem abcl/documentation
:description "Tools to generate LaTeX source from docstrings."
:depends-on (swank
Expand Down
39 changes: 35 additions & 4 deletions test/lisp/cl-bench/wrapper.lisp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(defpackage :abcl.test.cl-bench
(:use :cl :asdf)
(:nicknames "cl-bench")
(:export run))

(:nicknames "CL-BENCH")
(:export #:run))
(in-package :abcl.test.cl-bench)

(defparameter *cl-bench-master-source-location*
"<http://www.chez.com/emarsden/downloads/cl-bench.tar.gz>")
"<git+https://gitlab.common-lisp.net/ansi-test/cl-bench.git>")

;;; Deprecated. Use ASDF to locate CL-BENCH source
(defparameter *cl-bench-directory*
(asdf:system-relative-pathname :abcl "../cl-bench/"))

Expand All @@ -17,7 +17,38 @@
(defmacro cl-bench::with-spawned-thread (&body body)
`(progn ,@body))

(defun add-to-asdf (directory &key (asdf-conf-file "cl-bench.conf"))
(let* ((source-registry.conf.d
(merge-pathnames ".config/common-lisp/source-registry.conf.d/"
(user-homedir-pathname)))
(asdf-conf
(merge-pathnames asdf-conf-file source-registry.conf.d)))
(unless (probe-file source-registry.conf.d)
(ensure-directories-exist source-registry.conf.d))
(when (probe-file asdf-conf)
(format *standard-output* "Overwriting existing ~a" asdf-conf))
(with-open-file (o asdf-conf
:direction :output :if-exists :supersede)
(write `(:directory ,directory) :stream o))
(format *standard-output* "Configured ASDF via ~%~t~a~% to search~%~t'~a'~%"
asdf-conf directory)))

(defun run ()
(unless (ignore-errors (asdf:find-system :cl-bench))
(if (probe-file *cl-bench-directory*)
(when (probe-file (merge-pathnames "cl-bench.asd" *cl-bench-directory*))
(add-to-asdf *cl-bench-directory*)
(asdf/source-registry:initialize-source-registry)
(unless (ignore-errors (asdf:find-system :cl-bench))
(error "Failed to configure ASDF to find CL-BENCH in ~a" *cl-bench-directory*)))
(error "Please download and install a newer version of CL-BENCH containing an ASDF definition in ~a from ~a"
*cl-bench-directory* *cl-bench-master-source-location*)))
(ql:quickload :cl-bench)
(uiop:symbol-call :cl-bench :bench-run))


;;; Deprecated running CL-BENCH without ASDF definition.
(defun old-run ()
(unless (probe-file *cl-bench-directory*)
(error "Failed to find the cl-bench test suite in '~A'.~%
Please manually download and extract the cl-bench tool suite~%
Expand Down

0 comments on commit da16e96

Please sign in to comment.