X-Git-Url: http://git.kpe.io/?p=uffi.git;a=blobdiff_plain;f=uffi-tests.asd;h=d2221f9246e09e60667441b200491ad9c3f4556f;hp=18af90b1606e3b113ef9af4e258a78688f3499eb;hb=895cdddc64ad069c4d8173a21d0d5ce47b79e919;hpb=a90b2382e88626ea8ac6a0e470fdb515f0351a0a diff --git a/uffi-tests.asd b/uffi-tests.asd index 18af90b..d2221f9 100644 --- a/uffi-tests.asd +++ b/uffi-tests.asd @@ -14,36 +14,56 @@ (:use #:asdf #:cl)) (in-package #:uffi-tests-system) -(defvar *asd-file-dir* (pathname-directory *load-truename*)) -(defvar *library-file-dir* (append *asd-file-dir* "tests")) +(operate 'load-op 'uffi) + +(defvar *library-file-dir* (append (pathname-directory *load-truename*) + (list "tests"))) (defclass uffi-test-source-file (c-source-file) ()) (defmethod output-files ((o compile-op) (c uffi-test-source-file)) - (let ((found (some #'(lambda (dir) - (probe-file (make-pathname :directory d - :name (component-name c) - :type "so"))) - '((:absolute "usr" "lib" "uffi") - *asd-file-dir*)))) - (if found - (list searched) - (list (make-pathname :name (component-name c) - :type "so" + (let* ((library-file-type + (funcall (intern (symbol-name'#:default-foreign-library-type) + (symbol-name '#:uffi)))) + (found + (some #'(lambda (dir) + (probe-file (make-pathname + :directory dir + :name (component-name c) + :type library-file-type))) + '((:absolute "usr" "lib" "uffi"))))) + (list (if found + found + (make-pathname :name (component-name c) + :type library-file-type :directory *library-file-dir*))))) (defmethod perform ((o load-op) (c uffi-test-source-file)) - nil) ;; lisp loader file will load library + nil) ;;; library will be loaded by a loader file + +(defmethod operation-done-p ((o load-op) (c uffi-test-source-file)) + (and (symbol-function (intern (symbol-name '#:cs-count-upper) + (find-package '#:uffi-tests))) + t)) (defmethod perform ((o compile-op) (c uffi-test-source-file)) - (unless (zerop (run-shell-command - "cd ~A; make" - (namestring (make-pathname :name nil - :type nil - :directory *library-file-dir*)))) - (error 'operation-error :component c :operation o))) + (unless (operation-done-p o c) + #-(or win32 mswindows) + (unless (zerop (run-shell-command + #-freebsd "cd ~A; make" + #+freebsd "cd ~A; gmake" + (namestring (make-pathname :name nil + :type nil + :directory *library-file-dir*)))) + (error 'operation-error :component c :operation o)))) +(defmethod operation-done-p ((o compile-op) (c uffi-test-source-file)) + (or (and (probe-file #p"/usr/lib/uffi/uffi-c-test.so") t) + (let ((lib (make-pathname :defaults (component-pathname c) + :type (uffi:default-foreign-library-type)))) + (and (probe-file lib) + (> (file-write-date lib) (file-write-date (component-pathname c))))))) (defsystem uffi-tests :depends-on (:uffi) @@ -51,8 +71,8 @@ ((:module tests :components ((:file "rt") - (:uffi-test-source-file "uffi-c-test") (:file "package" :depends-on ("rt")) + (:uffi-test-source-file "uffi-c-test" :depends-on ("package")) (:file "strtol" :depends-on ("package")) (:file "atoifl" :depends-on ("package")) (:file "getenv" :depends-on ("package")) @@ -60,7 +80,7 @@ (:file "union" :depends-on ("package")) (:file "arrays" :depends-on ("package")) (:file "structs" :depends-on ("package")) - (:file "pointers" :depends-on ("package")) + (:file "objects" :depends-on ("package")) (:file "time" :depends-on ("package")) (:file "foreign-loader" :depends-on ("package" "uffi-c-test")) (:file "uffi-c-test-lib" :depends-on ("foreign-loader"))