tests: Adjust syscall tests for 2.6ish Linux.

* tests/syscalls.scm ("set-network-interface-flags",
  "set-network-interface-address"): Accept EACCES as a valid result.
This commit is contained in:
Ludovic Courtès 2015-01-19 15:44:12 +01:00
parent 510023184a
commit d35c5e29b6

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -91,15 +91,15 @@ (define-module (test-syscalls)
(system-error-errno args))))) (system-error-errno args)))))
(test-skip (if (zero? (getuid)) 1 0)) (test-skip (if (zero? (getuid)) 1 0))
(test-equal "set-network-interface-flags" (test-assert "set-network-interface-flags"
EPERM
(let ((sock (socket AF_INET SOCK_STREAM 0))) (let ((sock (socket AF_INET SOCK_STREAM 0)))
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
(set-network-interface-flags sock "lo" IFF_UP)) (set-network-interface-flags sock "lo" IFF_UP))
(lambda args (lambda args
(close-port sock) (close-port sock)
(system-error-errno args))))) ;; We get EPERM with Linux 3.18ish and EACCES with 2.6.32.
(memv (system-error-errno args) (list EPERM EACCES))))))
(test-equal "network-interface-address lo" (test-equal "network-interface-address lo"
(make-socket-address AF_INET (inet-pton AF_INET "127.0.0.1") 0) (make-socket-address AF_INET (inet-pton AF_INET "127.0.0.1") 0)
@ -108,8 +108,7 @@ (define-module (test-syscalls)
(close-port sock) (close-port sock)
addr)) addr))
(test-equal "set-network-interface-address" (test-assert "set-network-interface-address"
EPERM
(let ((sock (socket AF_INET SOCK_STREAM 0))) (let ((sock (socket AF_INET SOCK_STREAM 0)))
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
@ -120,7 +119,8 @@ (define-module (test-syscalls)
0))) 0)))
(lambda args (lambda args
(close-port sock) (close-port sock)
(system-error-errno args))))) ;; We get EPERM with Linux 3.18ish and EACCES with 2.6.32.
(memv (system-error-errno args) (list EPERM EACCES))))))
(test-end) (test-end)