Commits

David Krentzlin  committed 5851a46

version bump to bring versions in sync

  • Participants
  • Parent commits ff9de73

Comments (0)

Files changed (3)

File sendfile.setup

   (install-extension 
     'sendfile
     '("sendfile.so" "sendfile.import.so" "sendfile-static.o")
-    '((version "1.7.9")
+    '((version "1.7.10")
      (static "sendfile-static.o")
      (documentation "sendfile.html"))))

File tests/sendfile-spec.scm

-(load "test-utils.scm")
+(load "spec-helper.scm")
 
-(with-running-server
- (lambda ()
+(define (megabytes n)
+  (* n 1024 1024))
+
+(define (transmits-correctly)
+  (let ((server-side-checksum #f)
+        (expected-checksum #f))
+    (matcher
+     (check (subject)
+            (with-running-server
+             (lambda ()
+               (call-with-temporary-file/checksum (force subject)
+                                                  (lambda (file-path checksum)
+                                                    (set! expected-checksum checksum)
+                                                    (set! server-side-checksum (stream-file file-path (string-length (force subject))))
+                                                    (string=? server-side-checksum checksum))))))
+     (message (form subject negate)
+              (with-output-to-string
+                (lambda ()
+                  (printf "Checksum missmatch. Expected ~A but got ~A" expected-checksum server-side-checksum)))))))
+
+
+
    
-  (describe "Sendfile"
-    (context "sendfile-impl"
-      (it "should run"
-        (expect #t))))
+  (context "Sendfile"
+    (it "can send files greater than 1 mb" (meta ((bug . 727)))
+        (expect (generate-buffer (megabytes 2)) (transmits-correctly))))
 
 
 
-
-  ))
-

File tests/test-utils.scm

 
 
 
-;; New test helpers
-;; try to implement some nicer abstractions
-(define (with-running-server thunk)
-  (let ((pid (start-server)))
-    (thunk)
-    (stop-server pid)))
 
-;; access the running server
-(define (call-with-connection-to-server proc)
-  (parameterize ((tcp-read-timeout 3))
-    (receive (input output) (tcp-connect "localhost" (server-port))
-      (let ((result (proc input output)))
-        (close-input-port input)
-        (close-output-port output)
-        result))))
-
-;; generate files
-(define (with-temporary-file bytes proc)
-  (let ((path (create-temporary-file)))
-    (with-output-to-file path (fill-file-with-bytes bytes))
-    (let ((result (proc path)))
-      (delete-file path)
-      result)))
-
-(define ((fill-file-with-bytes bytes))
-  (write (make-string bytes)))