From 210ded8b388358e0824a1a7c111afb5b8484560e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 14 Oct 2013 16:35:53 +0200 Subject: [PATCH] Fix tests run Change-Id: I871160339a9de5c27aae8a128d5f57a535ac48d5 Signed-off-by: Julien Danjou --- requirements.txt | 1 + run-tests.lisp | 7 +++++-- run-tests.sh | 8 ++++++-- tests/keystone.lisp | 11 ++++++----- tests/openstack.lisp | 25 +++++++------------------ update-deps.lisp | 11 +++-------- 6 files changed, 28 insertions(+), 35 deletions(-) diff --git a/requirements.txt b/requirements.txt index 36dcfbe..cdadebd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ cl-json drakma +local-time diff --git a/run-tests.lisp b/run-tests.lisp index 5289063..d7fb9fb 100644 --- a/run-tests.lisp +++ b/run-tests.lisp @@ -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))) diff --git a/run-tests.sh b/run-tests.sh index 6d45bec..f0defa6 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -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 diff --git a/tests/keystone.lisp b/tests/keystone.lisp index 1b7d920..034e416 100644 --- a/tests/keystone.lisp +++ b/tests/keystone.lisp @@ -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. diff --git a/tests/openstack.lisp b/tests/openstack.lisp index 43e80f6..1ab852d 100644 --- a/tests/openstack.lisp +++ b/tests/openstack.lisp @@ -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") diff --git a/update-deps.lisp b/update-deps.lisp index 6a56def..62f1412 100644 --- a/update-deps.lisp +++ b/update-deps.lisp @@ -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)