| 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 | ;;; |
|---|
| 27 | |
|---|
| 28 | (defpackage #:cffi-tests-system |
|---|
| 29 | (:use #:cl #:asdf)) |
|---|
| 30 | (in-package #:cffi-tests-system) |
|---|
| 31 | |
|---|
| 32 | (eval-when (:compile-toplevel :load-toplevel :execute) |
|---|
| 33 | (oos 'load-op 'trivial-features)) |
|---|
| 34 | |
|---|
| 35 | (defvar *tests-dir* (append (pathname-directory *load-truename*) '("tests"))) |
|---|
| 36 | |
|---|
| 37 | (defclass c-test-lib (c-source-file) |
|---|
| 38 | ()) |
|---|
| 39 | |
|---|
| 40 | (defmethod perform ((o load-op) (c c-test-lib)) |
|---|
| 41 | nil) |
|---|
| 42 | |
|---|
| 43 | (defmethod perform ((o load-source-op) (c c-test-lib)) |
|---|
| 44 | nil) |
|---|
| 45 | |
|---|
| 46 | (defmethod perform ((o compile-op) (c c-test-lib)) |
|---|
| 47 | #-windows |
|---|
| 48 | (unless (zerop (run-shell-command |
|---|
| 49 | "cd ~A; make" |
|---|
| 50 | (namestring (make-pathname :name nil :type nil |
|---|
| 51 | :directory *tests-dir*)))) |
|---|
| 52 | (error 'operation-error :component c :operation o))) |
|---|
| 53 | |
|---|
| 54 | ;; For the convenience of ECL users. |
|---|
| 55 | #+ecl (require 'rt) |
|---|
| 56 | |
|---|
| 57 | (defsystem cffi-tests |
|---|
| 58 | :description "Unit tests for CFFI." |
|---|
| 59 | :depends-on (cffi #-ecl rt) |
|---|
| 60 | :components |
|---|
| 61 | ((:module "tests" |
|---|
| 62 | :serial t |
|---|
| 63 | :components |
|---|
| 64 | ((:c-test-lib "libtest") |
|---|
| 65 | (:file "package") |
|---|
| 66 | (:file "bindings") |
|---|
| 67 | (:file "funcall") |
|---|
| 68 | (:file "defcfun") |
|---|
| 69 | (:file "callbacks") |
|---|
| 70 | (:file "foreign-globals") |
|---|
| 71 | (:file "memory") |
|---|
| 72 | (:file "strings") |
|---|
| 73 | (:file "struct") |
|---|
| 74 | (:file "union") |
|---|
| 75 | (:file "enum") |
|---|
| 76 | (:file "misc-types") |
|---|
| 77 | (:file "misc"))))) |
|---|
| 78 | |
|---|
| 79 | (defmethod operation-done-p ((o test-op) (c (eql (find-system :cffi-tests)))) |
|---|
| 80 | nil) |
|---|
| 81 | |
|---|
| 82 | (defmethod perform ((o test-op) (c (eql (find-system :cffi-tests)))) |
|---|
| 83 | (flet ((run-tests (&rest args) |
|---|
| 84 | (apply (intern (string '#:run-cffi-tests) '#:cffi-tests) args))) |
|---|
| 85 | (run-tests :compiled nil) |
|---|
| 86 | (run-tests :compiled t))) |
|---|
| 87 | |
|---|
| 88 | ;;; vim: ft=lisp et |
|---|