Commit Diff


commit - 8ecbb4c4adee77eac4a151bd7d33ecd4b02d9e5c
commit + 13bdd729b80a3fdcdc018218a8dbae92bf112c1d
blob - b08bccfbfb296e5d66a2a63c0f90e7531d5cd732
blob + d621b3adb30381c42b93e1e4f2f07194836c9e3b
--- regress/lisp/9p-test/kami-tests.lisp
+++ regress/lisp/9p-test/kami-tests.lisp
@@ -670,3 +670,56 @@
         (multiple-value-list (example-change-times-file (renamed-filename)
                                                         +new-atime-2+
                                                         +new-mtime-2+)))))
+
+(alexandria::define-constant +many-files-number+ 10000               :test #'=)
+
+(alexandria::define-constant +many-files-path+   "/many/open/files/" :test #'string=)
+
+(alexandria::define-constant +many-files-format+ "~a/~a.dummy"       :test #'string=)
+
+(defun example-create-many-files (path &optional (root "/"))
+  (with-open-ssl-stream (stream
+                         socket
+                         *host*
+                         *port*
+                         *client-certificate*
+                         *certificate-key*)
+    (let* ((*messages-sent* ())
+           (root-fid        (mount stream root)))
+      (length (loop for i from 0 below +many-files-number+
+                    collect
+                    (let* ((cloned-fid  (clone-fid stream root-fid))
+                           (created-fid (create-path stream
+                                                     cloned-fid
+                                                     (format nil
+                                                             +many-files-format+
+                                                             path
+                                                             i))))
+                      (9p-clunk stream created-fid)
+                      cloned-fid))))))
+
+(deftest test-create-many-files ((kami-suite) (test-move-file))
+  (assert-equality #'=
+      +many-files-number+
+      (ignore-errors (example-create-many-files +many-files-path+))))
+
+(defun example-open-many-files (path &optional (root "/"))
+  (with-open-ssl-stream (stream
+                         socket
+                         *host*
+                         *port*
+                         *client-certificate*
+                         *certificate-key*)
+    (let* ((*messages-sent* ())
+           (root-fid        (mount stream root)))
+      (loop for i from 0 below 509 do
+        (9p-clunk stream (open-path stream
+                                    root-fid
+                                    (format nil
+                                            +many-files-format+
+                                            path
+                                            i))))
+      t)))
+
+(deftest test-open-many-files ((kami-suite) (test-create-many-files))
+  (assert-true (ignore-errors (example-open-many-files +many-files-path+))))