root/trunk/build.lisp

Revision 4044, 6.8 kB (checked in by hans, 6 days ago)

add yason system to list of loaded systems in build.lisp

Line 
1 ;; -*- Lisp -*-
2
3 ;; BKNR build script - Called by buildbot to build/test
4
5 (setf *compile-verbose* nil)
6 (setf *compile-print* nil)
7
8 #+sbcl
9 (require "ASDF")
10 (load (compile-file "thirdparty/asdf/asdf.lisp"))
11
12 (defpackage :build (:use :cl))
13 (in-package :build)
14
15 (format t "Building with ~A ~A.~%Features: ~S~%"
16         (lisp-implementation-type) (lisp-implementation-version)
17         *features*)
18
19 #+openmcl
20 (setf ccl::*defmethod-declare-all-arguments-ignorable* t)
21
22 (defun setup-registry (directory-path)
23   (flet ((valid-p (asd-pathname)
24            (and (not (member "_darcs" (pathname-directory asd-pathname) :test #'equal))
25                 (not (member "asd" (pathname-directory asd-pathname) :test #'equal)))))
26     (format t "; adding components under ~A to asdf registry~%" directory-path)
27     (mapc (lambda (asd-pathname)
28             (when (valid-p asd-pathname)
29               (let ((member (member (file-namestring asd-pathname) asdf:*central-registry*
30                                     :key #'(lambda (entry) (if (or (stringp entry) (pathnamep entry))
31                                                                (file-namestring entry)
32                                                                nil))
33                                     :test #'equal)))
34                 (assert (not member)
35                         nil
36                         "Found ~a,~%but ~a~%already exists in the asdf registry."
37                         asd-pathname (first member))
38                 (push asd-pathname asdf:*central-registry*))))
39           (directory (merge-pathnames #p"**/*.asd" directory-path)))))
40
41 (defun exit (code)
42   #+sbcl
43   (sb-unix:unix-exit code)
44   #+openmcl
45   (ccl:quit code)
46   #+cmu
47   (unix:unix-exit code))
48
49 #+openmcl
50 (defvar *initial-shared-libraries* (copy-list ccl::*shared-libraries*))
51
52 #+openmcl
53 (defun dump-image (&optional (image-name "bknr-sbcl.image"))
54   (format t "~&;;; --- dumping image ~A~%" image-name)
55   (dolist (lib ccl::*shared-libraries*)
56     (ignore-errors
57       (ccl::close-shared-library lib)))
58   (setf ccl::*shared-libraries* *initial-shared-libraries*)
59   (ccl:save-application "bknr-ccl.image"))
60
61 #+sbcl
62 (defun dump-image (&optional (image-name "bknr-sbcl.image"))
63   (format t "~&;;; --- dumping image ~A~%" image-name)
64   (sb-ext:save-lisp-and-die "bknr-sbcl.image"))
65
66 (setup-registry (probe-file *default-pathname-defaults*))
67
68 (dolist (system '(:bknr.web
69                   :quickhoney
70                   :bos.web
71                   :bos.test
72                   :lisp-ecoop
73                   :bknr.datastore.test
74                   :bknr.indices.test
75                   :bknr.skip-list.test
76                   :html-match
77                   :html-match.test
78                   :yason
79                   :cl-gd-test
80                   :cl-ppcre-test
81                   :kmrcl-tests
82                   :flexi-streams
83                   :flexi-streams-test
84                   :uffi
85                   #+(or) :uffi-tests
86                   :screamer
87                   :cl-fad
88                   :xhtmlgen-test
89                   #+(or) :cffi-tests
90                   #+(or) :usocket
91                   #+(or) :usocket-test
92                   #+(or) :uffi-test
93                   #+(or) :usocket-test
94                   ))
95   (format t "~&;;; --- loading system ~A~%" system)
96   (asdf:oos 'asdf:load-op system :verbose nil))
97
98 ;; For some reason, automatic loading of the GD library does not work
99 ;; on FreeBSD/i386 with SBCL.  This temporary fix hopefully cures the
100 ;; problem for the moment:
101 #+(and sbcl freebsd x86)
102 (progn
103   (eval (read-from-string "(uffi:load-foreign-library \"/usr/local/lib/libgd.so\")"))
104   (eval (read-from-string "(uffi:load-foreign-library \"/usr/local/lib/cl-gd-glue.so\")")))
105
106 (defun build ()
107   (exit 0))
108
109 (defmacro run-tests (&body forms)
110   `(let (any-failed)
111      ,@(mapcar (lambda (form)
112                  `(progn
113                     (format t "~&====================== RUNNING ~S~%"
114                             ',form)     ; quoted
115                     (let ((failed (null ,form)))
116                       (format t "~&====================== ~S ~A~%~%"
117                               ',form (if failed "FAILED xxxxx" "SUCCEEDED"))
118                       (setf any-failed (or any-failed failed)))))
119                forms)
120      (exit (if any-failed 1 0))))
121
122 #+(or)
123 (defun cl-ppcre-run-no-failures-p ()
124   (let ((expected "..........
125 ..........
126 ..........
127 ..........
128 ..........
129 ..........
130 ......
131  662 (\"a\" =~ /((a)*)*/):
132    \\2: expected NIL but got \"a\"
133 ....
134 .........
135  790 (\"babc\" =~ /^(b*|ba){1,2}bc/):
136    \\1: expected \"\" but got \"ba\"
137 .
138 ..........
139 ..........
140 ..........
141 ..........
142 ..........
143 ..........
144 ...
145 1439 (\"dbaacb\" =~ /(?<!(c|d))[ab]/):
146    \\1: expected NIL but got \"d\"
147 .......
148 ..........
149 .."))
150     (string= expected
151              (with-output-to-string (to-string)
152                (let ((*standard-output* (make-broadcast-stream *standard-output* to-string)))
153                  (cl-ppcre-test:test))))))
154
155 (defun cl-gd-run-no-failures-p ()
156   (flet ((test% ()
157            (let ((result t))
158              (loop for i from 1 to 19 do
159                   (if (member i '(7 8 15 17))
160                       (format t "Skipping Test ~A~%" i)
161                       (handler-case
162                           (let ((r (let ((test-function
163                                           (intern (format nil "TEST-~3,'0d" i)
164                                                   :cl-gd-test)))
165                                      (funcall test-function))))
166                             (format t "Test ~A ~:[failed~;succeeded~].~%" i r)
167                             (unless r (setf result nil)))
168                         (error (condition)
169                           (format t "Test ~A failed with the following error: ~A~%"
170                                   i condition)
171                           (setf result nil))))
172                   (force-output))
173              (format t "Done.~%")
174              result)))
175     (test%)))
176
177 (defun flexi-streams-no-failures-p ()
178   (format t "(we are clipping verbose output here)~%")
179   (let ((result (with-output-to-string (*error-output*)
180                   (flexi-streams-test::run-tests))))
181     (cond
182       ((ppcre:scan "All\\s+\\d+\\s+tests passed" result) t)
183       ((ppcre:scan "\\d+\\s+of\\s+\\d+\\s+tests failed" result) nil)
184       (t (warn "could not interpret flexi-streams test result")
185          nil))))
186
187 (defun fiveam-run-no-failures-p (test)
188   (let ((results (5am::run test)))
189     (5am:explain! results)
190     (zerop (nth-value 8 (5am::partition-results results)))))
191
192 (defun test ()
193   (cl-gd::load-gd-glue)
194   (format t "~&;;; --- running tests~%")
195   (run-tests
196    #+(or)
197    (cl-ppcre-run-no-failures-p)   
198    (cl-gd-run-no-failures-p)
199    #+(or)
200    (flexi-streams-no-failures-p)
201    (unit-test:run-all-tests)
202    (rt:do-tests)
203    (fiveam-run-no-failures-p :bknr.datastore)
204    #-darwin (fiveam-run-no-failures-p :bos.test)
205    (progn #+(or) (fiveam-run-no-failures-p :it.bese.FiveAM)
206           (warn "skipping :it.bese.FiveAM tests")
207           t)
208    ))
209
Note: See TracBrowser for help on using the browser.