Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tools/buildtest.lisp: generalize

  • Loading branch information...
commit 5f1a1112541d9a3500ef9cccbc1abb675c046b11 1 parent b9ca5c8
@joachifm authored
Showing with 28 additions and 25 deletions.
  1. +1 −1  git_hooks/pre-commit
  2. +27 −24 tools/buildtest.lisp
View
2  git_hooks/pre-commit
@@ -18,7 +18,7 @@ done
if $run_build_test ; then
echo "Running build test"
- env sbcl --noinform --no-userinit --load tools/buildtest.lisp
+ env sbcl --noinform --load tools/buildtest.lisp --eval '(buildtest :webkit)'
if [ $? -ne 0 ] ; then
echo "Commit rejected: build failed"
exit 1
View
51 tools/buildtest.lisp
@@ -1,19 +1,17 @@
-;;;; buildtest.lisp: catch load/compile errors
-;;;; Used by git_hooks/pre-commit
-
-;; Where to get dependencies. Change to suit your needs.
-#-quicklisp
-(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
- (user-homedir-pathname))))
- (when (probe-file quicklisp-init)
- (load quicklisp-init)))
-
-#-asdf
-(require :asdf)
-
-;; Load the system, signal error on failure.
-;; Note that warnings and so on are ignored.
-;; All other output is redirected to /dev/null.
+;; buildtest.lisp
+;;
+;; Commentary:
+;;
+;; Attempt to load a system, report outcome to the OS.
+;; Used in git_hooks/pre-commit
+;;
+;; Usage:
+;;
+;; $ lisp --eval '(progn (load "buildtest.lisp") (buildtest SYSTEM))'
+;;
+;; This assumes that SYSTEM's definition is in the CWD and that lisp has ASDF.
+;;
+;; Code:
(defun exit (code)
#+ccl (quit code)
@@ -21,12 +19,17 @@
#+ecl (ext:exit code)
#+sbcl (sb-unix:unix-exit code))
-(let* ((null-stream (make-broadcast-stream))
- (*standard-output* null-stream)
- (*trace-output* null-stream))
- (handler-case (asdf:operate 'asdf:load-op :webkit)
- (error (c) (progn (format *error-output* "Failed: ~A~%" c)
- (exit 1)))))
+(eval-when (:load-toplevel :compile-toplevel)
+ (unless (find-package :asdf)
+ (format t "ASDF is required to run this script.")
+ (exit 1)))
+
+(defun buildtest (sys)
+ (let* ((null-stream (make-broadcast-stream))
+ (*standard-output* null-stream)
+ (*trace-output* null-stream))
+ (handler-case (asdf:operate 'asdf:load-op sys)
+ (error (c) (progn (format *error-output* "Failed: ~A~%" c)
+ (exit 1)))))
-;; If we got here, everything went well
-(exit 0)
+ (exit 0))
Please sign in to comment.
Something went wrong with that request. Please try again.