Fix tests run

Change-Id: I871160339a9de5c27aae8a128d5f57a535ac48d5
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-10-14 16:35:53 +02:00
parent 6ab023dbd1
commit 210ded8b38
6 changed files with 28 additions and 35 deletions

View File

@ -1,2 +1,3 @@
cl-json
drakma
local-time

View File

@ -1,3 +1,6 @@
(load (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname)))
(defun terminate (status)
#+sbcl (sb-ext:quit :unix-status status) ; SBCL
#+ccl ( ccl:quit status) ; Clozure CL
@ -8,6 +11,6 @@
(cl-user::quit)) ; Many implementations put QUIT in the sandbox CL-USER package.
(require 'cl-openstack-client-test)
(let ((results (5am:run 5am::*suite*)))
(let ((results (5am:run 'cl-openstack-client.test:tests)))
(5am:explain! results)
(terminate (if (eq (5am:results-status results ) t) 0 1)))
(terminate (if (eq (5am:results-status results) t) 0 1)))

View File

@ -1,6 +1,10 @@
#!/bin/sh
#!/bin/bash
set -e
set -x
export HOME=$PWD/.test-env
mkdir $HOME
cd $HOME
wget -q http://beta.quicklisp.org/quicklisp.lisp -O quicklisp.lisp
sbcl --load ../update-deps.lisp
sbcl --script ../update-deps.lisp
ln -s $PWD/.. ~/quicklisp/local-projects/cl-openstack-client
sbcl --script ../run-tests.lisp

View File

@ -1,8 +1,7 @@
(defpackage cl-keystone-client-test
(defpackage cl-keystone-client.test
(:use fiveam
cl
trivial-gray-streams
cl-openstack-client-test
cl-keystone-client)
(:import-from :local-time
:encode-timestamp
@ -23,11 +22,13 @@
(:import-from :chunga
:make-chunked-stream))
(in-package :cl-keystone-client-test)
(in-package :cl-keystone-client.test)
(def-suite keystone :description "Test the Openstack Keystone client.")
(def-suite tests
:in cl-openstack-client.test:tests
:description "Test the Openstack Keystone client.")
(in-suite keystone)
(in-suite tests)
(defparameter +keystone-format+
;; same as +ISO-8601-FORMAT+ except with non nano seconds.

View File

@ -1,20 +1,9 @@
(defpackage cl-openstack-client-test
(:use cl)
(:export with-function-patch))
(defpackage cl-openstack-client.test
(:use cl
fiveam)
(:export tests))
(in-package :cl-openstack-client-test)
(in-package :cl-openstack-client.test)
(defmacro with-function-patch (patch &rest body)
"Takes a PATCH form like a FLET clause, i.e. (fn-name (lambda-list) body),
evaluates BODY in an environment with fn-name rebound to the PATCH form and
uses UNWIND-PROTECT to safely restore the original definition afterwards."
(let ((oldfn (gensym))
(result (gensym))
(name (car patch))
(args (cadr patch))
(pbody (cddr patch)))
`(let ((,oldfn (symbol-function ',name)))
(setf (symbol-function ',name) (lambda ,args ,@pbody))
(unwind-protect (progn ,@body)
(setf (symbol-function ',name) ,oldfn))
,result)))
(def-suite tests
:description "cl-openstack-client tests")

View File

@ -1,13 +1,8 @@
(load "quicklisp.lisp")
(handler-case (quicklisp-quickstart:install :path (user-homedir-pathname))
(error nil (load "setup")))
(load (make-pathname :directory (pathname-directory (user-homedir-pathname)) :name "quicklisp" :type "lisp"))
(quicklisp-quickstart:install)
(dolist (file '("../requirements.txt" "../test-requirements.txt"))
(with-open-file (s file)
(loop for line = (read-line s nil)
while line
do (ql:quickload line))))
(push
;; Send me a patch to make this simpler please.
(apply 'make-pathname (list :directory (butlast (pathname-directory (user-homedir-pathname)))))
asdf:*central-registry*)
(load "../run-tests")
(quit)