Skip to content

Commit

Permalink
Merge test suites.
Browse files Browse the repository at this point in the history
  • Loading branch information
luismbo committed Aug 14, 2007
1 parent 01890f6 commit 37cd2b7
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 38 deletions.
10 changes: 6 additions & 4 deletions net.sockets-tests.asd → iolib-tests.asd
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
;;; DEALINGS IN THE SOFTWARE.

(asdf:defsystem :net.sockets-tests
:description "Socket library test suite."
(defsystem iolib-tests
:description "IOLib test suite."
:licence "MIT"
:depends-on (:net.sockets :rt)
:depends-on (io.streams net.sockets rt)
:pathname (merge-pathnames (make-pathname :directory '(:relative "tests"))
*load-truename*)
:components
((:file "net.sockets-tests")))
((:file "pkgdcl")
(:file "streams" :depends-on ("pkgdcl"))
(:file "sockets" :depends-on ("pkgdcl"))))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 7 additions & 11 deletions io.streams-tests.asd → tests/pkgdcl.lisp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
;;;
;;; io.streams-tests.asd --- ASDF system definition.
;;; pkgdcl.lisp --- Package definition.
;;;
;;; Copyright (C) 2007, Luis Oliveira <[email protected]>
;;;
Expand All @@ -24,12 +24,8 @@
;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
;;; DEALINGS IN THE SOFTWARE.

(asdf:defsystem io.streams-tests
:description "Test suite for io-streams."
:author "Luis Oliveira <[email protected]>"
:licence "BSD"
:depends-on (:rt :io.streams :alexandria)
:pathname (merge-pathnames (make-pathname :directory '(:relative "tests"))
*load-truename*)
:components
((:file "io.streams-tests")))
(in-package #:cl-user)

(defpackage #:iolib-tests
(:use #:common-lisp #:rtest #:net.sockets #:io.streams
#:trivial-gray-streams #:alexandria))
12 changes: 3 additions & 9 deletions tests/net.sockets-tests.lisp → tests/sockets.lisp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Indent-tabs-mode: NIL -*-
;;;
;;; tests.lisp --- net.sockets test suite.
;;; sockets.lisp --- net.sockets test suite.
;;;
;;; Copyright (C) 2007, Luis Oliveira <[email protected]>
;;;
Expand Down Expand Up @@ -31,13 +31,7 @@
;;; released into the public domain in jurisdictions where this is
;;; possible, or under the FreeBSD licence where not.

(in-package #:common-lisp-user)

(defpackage #:net.sockets-tests
(:nicknames #:sockets-tests)
(:use #:common-lisp #:rtest :net.sockets))

(in-package #:net.sockets-tests)
(in-package #:iolib-tests)

;;; A couple of these tests require an echo server. You can either
;;; compile and run the provided tests/echo-server.c or enabled the
Expand Down Expand Up @@ -424,7 +418,7 @@
:type nil
:defaults
(asdf:system-definition-pathname
(asdf:find-system '#:net.sockets-tests))))))
(asdf:find-system '#:iolib-tests))))))
(ignore-errors (delete-file file))
(with-socket (p :family :local :connect :passive :local-filename file)
(with-socket (a :family :local :remote-filename file)
Expand Down
24 changes: 10 additions & 14 deletions tests/io.streams-tests.lisp → tests/streams.lisp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;
;;; tests.lisp --- IO.STREAMS test suite.
;;; streams.lisp --- IO.STREAMS test suite.
;;;
;;; Copyright (c) 2006-2007, Dr. Edmund Weitz. All rights reserved.
;;; Copyright (c) 2007, Luis Oliveira <[email protected]>
Expand Down Expand Up @@ -29,13 +29,7 @@
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(in-package :common-lisp-user)

(defpackage #:io.streams-tests
(:use #:common-lisp :rt :io.streams :alexandria
:trivial-gray-streams))

(in-package #:io.streams-tests)
(in-package #:iolib-tests)

(defclass my-file-stream (dual-channel-single-fd-gray-stream)
((path :initarg :path :reader file-stream-path)))
Expand All @@ -56,6 +50,7 @@
(:input :error)
((:io :output) :create)))
(external-format :default))
(declare (ignore if-does-not-exist))
;; move OPEN to INITIALIZE-INSTANCE
(let ((fd (nix:open path
(logior (ecase direction
Expand All @@ -80,10 +75,11 @@
(with-open-stream (,var ,stream)
,@body))))

(defvar *this-dir*
(defvar *data-dir*
(let ((sys-pn (asdf:system-definition-pathname
(asdf:find-system 'io.streams-tests))))
(make-pathname :directory (append (pathname-directory sys-pn) '("tests"))
(asdf:find-system 'iolib-tests))))
(make-pathname :directory (append (pathname-directory sys-pn)
'("tests" "data"))
:defaults sys-pn)))

(defvar *test-dir*
Expand Down Expand Up @@ -171,9 +167,9 @@
;;; check if the outcome is as expected. Uses various variants of the
;;; :DIRECTION keyword when opening the files."
(defun compare-files (path-in external-format-in path-out external-format-out)
(let ((full-path-in (merge-pathnames path-in *this-dir*))
(let ((full-path-in (merge-pathnames path-in *data-dir*))
(full-path-out (merge-pathnames path-out *test-dir*))
(full-path-orig (merge-pathnames path-out *this-dir*)))
(full-path-orig (merge-pathnames path-out *data-dir*)))
(dolist (direction-out '(:output :io) t)
(dolist (direction-in '(:input :io))
(let ((description (format nil "Test ~S ~A [~A] --> ~A [~A]"
Expand All @@ -188,7 +184,7 @@
(format *error-output* "~&;; Test failed!!!~%")
(return-from compare-files nil)))))))

(deftest big-comparision-test
(deftest big-stream-comparision-test
(let ((args-list (loop for (file-name symbols) in *test-files*
nconc (create-test-combinations file-name symbols))))
(loop for args in args-list
Expand Down

0 comments on commit 37cd2b7

Please sign in to comment.