summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-03-15 10:40:51 +0100
committerLudovic Courtès <ludo@gnu.org>2017-03-15 15:19:53 +0100
commit81a0f1cdf12e7bcc34c1203f034a323fa8f52cf5 (patch)
tree8060a793fb9709625095c18d36275a5c3dcf7d6c /tests
parentbc551cf32b6ccb3f8dd60b1d0d4e3c3e88cb1f8d (diff)
downloadguix-81a0f1cdf12e7bcc34c1203f034a323fa8f52cf5.tar.gz
zlib: Don't rely on EBADF being ignored by 'fport_close'.
In 2.2, 'fport_close' no longer swallows EBADF and instead raises a
'system-error' for this.  This commit adjusts for 2.2.

* guix/zlib.scm (close-procedure): Remove.
(make-gzip-input-port): Use 'port->fdes' instead of 'fileno'.
Use 'gzclose' instead of 'close-procedure'.
(make-gzip-output-port): Likewise.
* tests/zlib.scm ("compression/decompression pipe"): Don't check whether
PARENT is closed using 'port-closed?'.  Instead, use 'seek' on the
underlying FD and check for EBADF.
Diffstat (limited to 'tests')
-rw-r--r--tests/zlib.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/zlib.scm b/tests/zlib.scm
index 5455240a71..f71609b7c5 100644
--- a/tests/zlib.scm
+++ b/tests/zlib.scm
@@ -57,7 +57,16 @@
               (match (waitpid pid)
                 ((_ . status)
                  (and (zero? status)
-                      (port-closed? parent)
+
+                      ;; PORT itself isn't closed but its underlying file
+                      ;; descriptor must have been closed by 'gzclose'.
+                      (catch 'system-error
+                        (lambda ()
+                          (seek (fileno parent) 0 SEEK_CUR)
+                          #f)
+                        (lambda args
+                          (= EBADF (system-error-errno args))))
+
                       (bytevector=? received data))))))))))))
 
 (test-end)