source: trunk/abcl/test/lisp/cl-bench/wrapper.lisp

Last change on this file was 15290, checked in by Mark Evenson, 20 months ago

Overhaul CL-BENCH invocation mechanism

New location for CL-BENCH which now contains an ASDF definition.

File size: 2.8 KB
Line 
1(defpackage :abcl.test.cl-bench
2  (:use :cl :asdf)
3  (:nicknames "CL-BENCH")
4  (:export #:run))
5(in-package :abcl.test.cl-bench)
6
7(defparameter *cl-bench-master-source-location*
8  "<git+https://gitlab.common-lisp.net/ansi-test/cl-bench.git>")
9
10;;; Deprecated.  Use ASDF to locate CL-BENCH source
11(defparameter *cl-bench-directory*
12  (asdf:system-relative-pathname :abcl "../cl-bench/"))
13 
14;;; cl-bench defines BENCH-GC and WITH-SPAWNED-THREAD in
15;;; '*cl-bench-directory*/sysdep/setup-ablisp.lisp'. 
16(defun cl-bench::bench-gc () (ext:gc))
17(defmacro cl-bench::with-spawned-thread (&body body)
18  `(progn ,@body))
19
20(defun add-to-asdf (directory &key (asdf-conf-file "cl-bench.conf"))
21  (let* ((source-registry.conf.d
22          (merge-pathnames ".config/common-lisp/source-registry.conf.d/"
23                           (user-homedir-pathname)))
24         (asdf-conf
25           (merge-pathnames asdf-conf-file source-registry.conf.d)))
26    (unless (probe-file source-registry.conf.d)
27      (ensure-directories-exist source-registry.conf.d))
28    (when (probe-file asdf-conf)
29      (format *standard-output* "Overwriting existing ~a" asdf-conf))
30    (with-open-file (o asdf-conf
31                       :direction :output :if-exists :supersede)
32      (write `(:directory ,directory) :stream o))
33    (format *standard-output* "Configured ASDF via ~%~t~a~% to search~%~t'~a'~%"
34            asdf-conf directory)))
35
36(defun run ()
37  (unless (ignore-errors (asdf:find-system :cl-bench))
38    (if (probe-file *cl-bench-directory*)
39        (when (probe-file (merge-pathnames "cl-bench.asd" *cl-bench-directory*))
40          (add-to-asdf *cl-bench-directory*)
41          (asdf/source-registry:initialize-source-registry)
42          (unless (ignore-errors (asdf:find-system :cl-bench))
43            (error "Failed to configure ASDF to find CL-BENCH in ~a" *cl-bench-directory*)))
44        (error "Please download and install a newer version of CL-BENCH containing an ASDF definition in ~a from ~a"
45               *cl-bench-directory* *cl-bench-master-source-location*)))
46  (ql:quickload :cl-bench)
47  (uiop:symbol-call :cl-bench :bench-run))
48
49
50;;; Deprecated running CL-BENCH without ASDF definition. 
51(defun old-run () 
52  (unless (probe-file *cl-bench-directory*)
53    (error "Failed to find the cl-bench test suite in '~A'.~%
54Please manually download and extract the cl-bench tool suite~%
55from ~A to run the tests."
56           *cl-bench-directory*
57           *cl-bench-master-source-location*))
58  (let ((*default-pathname-defaults* *cl-bench-directory*))
59    (if (find :unix *features*)
60        (run-shell-command 
61         (format nil "cd ~A; make clean optimize-files" *cl-bench-directory*))
62        (run-shell-command "cd ~A && make clean optimize-files" *cl-bench-directory*))
63    (load "generate.lisp")
64    (load "do-compilation-script.lisp")
65    (load "do-execute-script.lisp")))
66 
Note: See TracBrowser for help on using the repository browser.