notes and paren matching.
[CommonLispStat.git] / external / cffi.darcs / cffi-tests.asd
blobd885e2693da3163a0f447bfd9b7b03eafeda369f
1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; cffi-tests.asd --- ASDF system definition for CFFI unit tests.
4 ;;;
5 ;;; Copyright (C) 2005-2006, James Bielman  <jamesjb@jamesjb.com>
6 ;;;
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:
14 ;;;
15 ;;; The above copyright notice and this permission notice shall be
16 ;;; included in all copies or substantial portions of the Software.
17 ;;;
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.
26 ;;;
28 (defpackage #:cffi-tests-system
29   (:use #:cl #:asdf))
30 (in-package #:cffi-tests-system)
32 (defvar *tests-dir* (append (pathname-directory *load-truename*) '("tests")))
34 (defclass c-test-lib (c-source-file)
35   ())
37 (defmethod perform ((o load-op) (c c-test-lib))
38   nil)
40 (defmethod perform ((o load-source-op) (c c-test-lib))
41   nil)
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.
53 #+ecl (require 'rt)
55 (defsystem cffi-tests
56   :description "Unit tests for CFFI."
57   :depends-on (cffi #-ecl rt)
58   :components
59   ((:module "tests"
60     :serial t
61     :components
62     ((:c-test-lib "libtest")
63      (:file "package")
64      (:file "bindings")
65      (:file "funcall")
66      (:file "defcfun")
67      (:file "callbacks")
68      (:file "foreign-globals")
69      (:file "memory")
70      (:file "strings")
71      (:file "struct")
72      (:file "union")
73      (:file "enum")
74      (:file "misc-types")
75      (:file "misc")))))
77 (defun run-cffi-tests (&key (compiled nil))
78   (funcall (intern (symbol-name '#:run-cffi-tests) '#:cffi-tests)
79            :compiled compiled))
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.")))
86 ;;; vim: ft=lisp et