X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-simple-streams%2Fsimple-stream-tests.lisp;h=2371fc8facc610537cbc72f798d8c5da4e5a99c7;hb=7c75cd363da90afe334e936aad2b63437ea5905d;hp=0577d033b74e7fafefaf9748c523f19a6ff27d86;hpb=4898ef32c639b1c7f4ee13a5ba566ce6debd03e6;p=sbcl.git diff --git a/contrib/sb-simple-streams/simple-stream-tests.lisp b/contrib/sb-simple-streams/simple-stream-tests.lisp index 0577d03..2371fc8 100644 --- a/contrib/sb-simple-streams/simple-stream-tests.lisp +++ b/contrib/sb-simple-streams/simple-stream-tests.lisp @@ -124,7 +124,10 @@ (string= (prog1 (write-line "Got it!" s) (finish-output s)) (read-line s))) ;; Fail gracefully if echo isn't activated on the system - (sb-bsd-sockets::connection-refused-error () t)) + (sb-bsd-sockets::connection-refused-error () t) + ;; Timeout may occur on the restricted systems (e.g. FreeBSD + ;; with jail(8) or blackhole(4) is used). + (sb-bsd-sockets::operation-timeout-error () t)) t) (deftest write-read-large-sc-1 @@ -197,7 +200,10 @@ (string= (prog1 (write-line content s) (finish-output s)) (read-line s)))) ;; Fail gracefully if echo isn't activated on the system - (sb-bsd-sockets::connection-refused-error () t)) + (sb-bsd-sockets::connection-refused-error () t) + ;; Timeout may occur on the restricted systems (e.g. FreeBSD + ;; with jail(8) or blackhole(4) is used). + (sb-bsd-sockets::operation-timeout-error () t)) t) @@ -908,3 +914,38 @@ Nothing to see here, move along.") (deftest string-simple-stream-1 (values (subtypep 'string-simple-stream 'string-stream)) T) + +;; don't break fd-stream external-format support: + +(deftest external-format-1 + (progn + (with-open-file (s *test-file* + :direction :output + :if-exists :supersede + :element-type '(unsigned-byte 8)) + (write-byte 195 s) + (write-byte 132 s)) + (with-open-file (s *test-file* + :direction :input + :external-format :utf-8) + (char-code (read-char s)))) + 196) + +;; launchpad bug #491087 + +(deftest lp491087 + (labels ((read-big-int (stream) + (let ((b (make-array 1 :element-type '(signed-byte 32) + :initial-element 0))) + (declare (dynamic-extent b)) + (sb-simple-streams::read-vector b stream + :endian-swap :network-order) + (aref b 0)))) + (with-open-file (stream "lp491087.txt" :class 'file-simple-stream) + (let* ((start (file-position stream)) + (integer (read-big-int stream)) + (end (file-position stream))) + (and (= start 0) + (= integer #x30313233) + (= end 4))))) + T)