1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
3 ;;; cffi-tests.asd --- ASDF system definition for CFFI unit tests.
5 ;;; Copyright (C) 2005-2006, James Bielman <jamesjb@jamesjb.com>
7 ;;; Permission is hereby granted, free of charge, to any person
8 ;;; obtaining a copy of this software and associated documentation
9 ;;; files (the "Software"), to deal in the Software without
10 ;;; restriction, including without limitation the rights to use, copy,
11 ;;; modify, merge, publish, distribute, sublicense, and/or sell copies
12 ;;; of the Software, and to permit persons to whom the Software is
13 ;;; furnished to do so, subject to the following conditions:
15 ;;; The above copyright notice and this permission notice shall be
16 ;;; included in all copies or substantial portions of the Software.
18 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 ;;; DEALINGS IN THE SOFTWARE.
28 (defpackage #:cffi-tests-system
30 (in-package #:cffi-tests-system)
32 (defvar *tests-dir* (append (pathname-directory *load-truename*) '("tests")))
34 (defclass c-test-lib (c-source-file)
37 (defmethod perform ((o load-op) (c c-test-lib))
40 (defmethod perform ((o load-source-op) (c c-test-lib))
43 (defmethod perform ((o compile-op) (c c-test-lib))
44 #-(or win32 mswindows)
45 (unless (zerop (run-shell-command
46 #-(or freebsd solaris) "cd ~A; make"
47 #+(or freebsd solaris) "cd ~A; gmake"
48 (namestring (make-pathname :name nil :type nil
49 :directory *tests-dir*))))
50 (error 'operation-error :component c :operation o)))
52 ;; For the convenience of ECL users.
56 :description "Unit tests for CFFI."
57 :depends-on (cffi #-ecl rt)
62 ((:c-test-lib "libtest")
68 (:file "foreign-globals")
77 (defun run-cffi-tests (&key (compiled nil))
78 (funcall (intern (symbol-name '#:run-cffi-tests) '#:cffi-tests)
81 (defmethod perform ((o test-op) (c (eql (find-system :cffi-tests))))
82 (unless (and (run-cffi-tests :compiled nil)
83 (run-cffi-tests :compiled t))
84 (error "test-op failed.")))