Make groveler directive CONSTANT more robust.
[cffi.git] / cffi-tests.asd
blob77e806c48c191e9107f2513f2e8b0263c3eb5b9d
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                   "cd ~A; make"
47                   (namestring (make-pathname :name nil :type nil
48                                              :directory *tests-dir*))))
49     (error 'operation-error :component c :operation o)))
51 ;; For the convenience of ECL users.
52 #+ecl (require 'rt)
54 (defsystem cffi-tests
55   :description "Unit tests for CFFI."
56   :depends-on (cffi #-ecl rt)
57   :components
58   ((:module "tests"
59     :serial t
60     :components
61     ((:c-test-lib "libtest")
62      (:file "package")
63      (:file "bindings")
64      (:file "funcall")
65      (:file "defcfun")
66      (:file "callbacks")
67      (:file "foreign-globals")
68      (:file "memory")
69      (:file "strings")
70      (:file "struct")
71      (:file "union")
72      (:file "enum")
73      (:file "misc-types")
74      (:file "misc")))))
76 (defmethod operation-done-p ((o test-op) (c (eql (find-system :cffi-tests))))
77   nil)
79 (defmethod perform ((o test-op) (c (eql (find-system :cffi-tests))))
80   (flet ((run-tests (&rest args)
81            (apply (intern (string '#:run-cffi-tests) '#:cffi-tests) args)))
82     (run-tests :compiled nil)
83     (run-tests :compiled t)))
85 ;;; vim: ft=lisp et