r9236: fix library loading, function name
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 5 May 2004 01:52:56 +0000 (01:52 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 5 May 2004 01:52:56 +0000 (01:52 +0000)
tests/foreign-loader.lisp
tests/time.lisp
uffi-tests.asd

index 10307321d3a21e17c543ff90a14380914c90ada1..ac9b5c04615f2a61c93ec5f470c3e788d911136d 100644 (file)
@@ -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"))
index 8e2c6efcef4dbee009492f88f960b2c9d62e2e6d..aeedba089c3f813bcf1f194fe435c29dd2832e4f 100644 (file)
@@ -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)))))
 
index d68d1b0ac83cd0b85b0de6d31ec352e5c41e51eb..b9b3bdcecfbcd4c6c49657bd05c58f73976dad9d 100644 (file)
@@ -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")))
 
   ())
 
 (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"))