~ruther/guix-local

7adbe85e60fce61d0082a9c46604a26d651cb87a — Ludovic Courtès 10 years ago 001dae0
syscalls: 'interface-address' can return #f.

Fixes <http://bugs.gnu.org/22612>.
Reported by Danny Milosavljevic <dannym@scratchpost.org>.

* tests/syscalls.scm ("network-interfaces returns one or more
interfaces"): Accept 'interface-address' value of #f.
1 files changed, 6 insertions(+), 2 deletions(-)

M tests/syscalls.scm
M tests/syscalls.scm => tests/syscalls.scm +6 -2
@@ 1,5 1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;;
;;; This file is part of GNU Guix.


@@ 223,7 223,11 @@
    ((interfaces ..1)
     (list (every interface? interfaces)
           (every string? (map interface-name interfaces))
           (every vector? (map interface-address interfaces))))))
           (every (lambda (sockaddr)
                    ;; Sometimes interfaces have no associated address.
                    (or (vector? sockaddr)
                        (not sockaddr)))
                  (map interface-address interfaces))))))

(test-equal "network-interfaces returns \"lo\""
  (list #t (make-socket-address AF_INET (inet-pton AF_INET "127.0.0.1") 0))