+(defvar *asd-file-dir* (pathname-directory *load-truename*))
+(defvar *library-file-dir* (append *asd-file-dir* "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"
+ :directory *library-file-dir*)))))
+
+(defmethod perform ((o load-op) (c uffi-test-source-file))
+ nil) ;; lisp loader file will load library
+
+(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)))
+
+