commit 86df5ff4055857a4a9b024f7ed84c86ddff46016 from: cage date: Sun Jan 02 13:22:02 2022 UTC - [regress-extra] added test 'read-a-tiny-amount-of-data'. commit - f7920b3b30825cc28d15046ae6f9de010e157f7b commit + 86df5ff4055857a4a9b024f7ed84c86ddff46016 blob - a3a4857826d3cc5ed2b031b6724f4845d2d6c234 blob + 5022c3d3462d8b03b9368b8a92ba335b0323a9f7 --- regress/lisp/9p-test/kami-tests.lisp +++ regress/lisp/9p-test/kami-tests.lisp @@ -470,3 +470,32 @@ (assert-equality #'= (length (make-huge-data)) (length (read-huge-file *remote-test-path-huge*)))) + +(defun read-a-tiny-amount-of-data (path amount &optional (root "/")) + (with-open-ssl-stream (stream + socket + *host* + *port* + *client-certificate* + *certificate-key*) + (let* ((*messages-sent* ()) + (*buffer-size* 4096) + (root-fid (mount stream root)) + (path-fid (open-path stream root-fid path)) + (results nil)) + (9p-read stream + path-fid + 0 + amount + :callback (lambda (x reply) + (declare (ignore x)) + (let ((data (decode-read-reply reply nil))) + (setf results data)))) + (read-all-pending-message stream) + results))) + +(deftest test-read-a-tiny-amount-of-data ((kami-suite) (test-write-huge-file)) + (let ((amount 3)) + (assert-equality #'= + amount + (length (read-a-tiny-amount-of-data *remote-test-path-huge* amount)))))