summary refs log tree commit diff
path: root/tests/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-04-07 18:08:56 +0200
committerLudovic Courtès <ludo@gnu.org>2014-04-07 18:16:58 +0200
commit68ec0450d1c3f125d7d290958dda6e89b6a0c37e (patch)
tree7366bbf0a54e4bf64f11dae6199368dd7563f13a /tests/utils.scm
parent1d000ae73ba99fc205a6c2596970e858ab4ce22f (diff)
downloadguix-68ec0450d1c3f125d7d290958dda6e89b6a0c37e.tar.gz
tests: Avoid buffering in 'fcntl-flock' tests.
Partially fixes <http://bugs.gnu.org/17212>.

* tests/utils.scm ("fcntl-flock wait", "fcntl-flock non-blocking"): Open
  files in binary mode, with no buffering.
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 1da847689c..4d2d123c6b 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -176,7 +176,7 @@
 (false-if-exception (delete-file temp-file))
 (test-equal "fcntl-flock wait"
   42                                              ; the child's exit status
-  (let ((file (open-file temp-file "w0")))
+  (let ((file (open-file temp-file "w0b")))
     ;; Acquire an exclusive lock.
     (fcntl-flock file 'write-lock)
     (match (primitive-fork)
@@ -185,7 +185,7 @@
          (const #t)
          (lambda ()
            ;; Reopen FILE read-only so we can have a read lock.
-           (let ((file (open-file temp-file "r")))
+           (let ((file (open-file temp-file "r0b")))
              ;; Wait until we can acquire the lock.
              (fcntl-flock file 'read-lock)
              (primitive-exit (read file)))
@@ -228,19 +228,19 @@
             (read-char input)
 
             ;; Open FILE read-only so we can have a read lock.
-            (let ((file (open-file temp-file "w")))
+            (let ((file (open-file temp-file "w0")))
               (catch 'flock-error
                 (lambda ()
                   ;; This attempt should throw EAGAIN.
                   (fcntl-flock file 'write-lock #:wait? #f))
                 (lambda (key errno)
-                  (primitive-exit errno))))
+                  (primitive-exit (pk 'errno errno)))))
             (primitive-exit -1))
           (lambda ()
             (primitive-exit -2))))
        (pid
         (close-port input)
-        (let ((file (open-file temp-file "w")))
+        (let ((file (open-file temp-file "w0")))
           ;; Acquire an exclusive lock.
           (fcntl-flock file 'write-lock)