From 9182d38fa370338052a1f26f204decb0e5363593 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 5 May 2004 01:52:56 +0000 Subject: [PATCH] r9236: fix library loading, function name --- tests/foreign-loader.lisp | 3 ++- tests/time.lisp | 2 +- uffi-tests.asd | 49 ++++++++++++++++++++++++++++----------- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/tests/foreign-loader.lisp b/tests/foreign-loader.lisp index 1030732..ac9b5c0 100644 --- a/tests/foreign-loader.lisp +++ b/tests/foreign-loader.lisp @@ -34,7 +34,8 @@ (uffi:find-foreign-library "uffi-c-test" (list (pathname-directory *load-truename*) - "/usr/lib/uffi/")) + "/usr/lib/uffi/" + "/home/kevin/debian/src/uffi/tests/")) :supporting-libraries '("c") :module "uffi_tests") (warn "Unable to load uffi-c-test library")) diff --git a/tests/time.lisp b/tests/time.lisp index 8e2c6ef..aeedba0 100644 --- a/tests/time.lisp +++ b/tests/time.lisp @@ -98,5 +98,5 @@ (uffi:with-foreign-object (time 'time-t) (setf (uffi:deref-pointer time :unsigned-long) secs) - (c-ctime time))))) + (c-time time))))) diff --git a/uffi-tests.asd b/uffi-tests.asd index d68d1b0..b9b3bdc 100644 --- a/uffi-tests.asd +++ b/uffi-tests.asd @@ -14,6 +14,8 @@ (:use #:asdf #:cl)) (in-package #:uffi-tests-system) +(operate 'load-op 'uffi) + (defvar *library-file-dir* (append (pathname-directory *load-truename*) (list "tests"))) @@ -21,28 +23,47 @@ ()) (defmethod output-files ((o compile-op) (c uffi-test-source-file)) - (let ((found (some #'(lambda (dir) - (probe-file (make-pathname :directory dir - :name (component-name c) - :type "so"))) - '((:absolute "usr" "lib" "uffi"))))) + (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 "so" + :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) @@ -50,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")) -- 2.34.1