summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-25 23:22:45 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-25 23:34:20 +0200
commit5cd25aad3cdb6c970a76542e328a3beba8c1f2c9 (patch)
treec2edfdb472236ea9145756b7da82ce32174da22e /tests
parent0054e47036b13d46f0f026bbc04d19770c2ecbad (diff)
downloadguix-5cd25aad3cdb6c970a76542e328a3beba8c1f2c9.tar.gz
syscalls: 'terminal-columns' catches EINVAL on the TIOCGWINSZ ioctl.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/build/syscalls.scm (terminal-columns): Tolerate EINVAL.
* tests/syscalls.scm ("terminal-window-size ENOTTY"): Likewise.
Diffstat (limited to 'tests')
-rw-r--r--tests/syscalls.scm7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 895f90f4d8..71bcbc4d32 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -259,15 +259,16 @@
              (#f #f)
              (lo (interface-address lo)))))))
 
-(test-equal "terminal-window-size ENOTTY"
-  ENOTTY
+(test-assert "terminal-window-size ENOTTY"
   (call-with-input-file "/dev/null"
     (lambda (port)
       (catch 'system-error
         (lambda ()
           (terminal-window-size port))
         (lambda args
-          (system-error-errno args))))))
+          ;; Accept EINVAL, which some old Linux versions might return.
+          (memv (system-error-errno args)
+                (list ENOTTY EINVAL)))))))
 
 (test-assert "terminal-columns"
   (> (terminal-columns) 0))