1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

Fix `getaddrinfo' tests.

Thanks to Ken Raeburn.

* test-suite/tests/net-db.test ("getaddrinfo")["port 80"]: Fix bogus
  check of `addrinfo:flags' (POSIX says that the "contents of the
  ai_flags field of the returned structures are undefined.").
  ("wrong service name"): Accept `EAI_NONAME' as a valid error code.
This commit is contained in:
Ludovic Courtès 2010-02-15 16:10:01 +01:00
parent 2fe5eb561c
commit 25bc75c431

View file

@ -50,7 +50,6 @@
(fold (lambda (ai ok?) (fold (lambda (ai ok?)
(let ((sa (addrinfo:addr ai))) (let ((sa (addrinfo:addr ai)))
(and ok? (and ok?
(> (logand (addrinfo:flags ai) AI_ADDRCONFIG) 0)
(= (sockaddr:port sa) 80)))) (= (sockaddr:port sa) 80))))
#t #t
ai)))) ai))))
@ -73,5 +72,8 @@
(getaddrinfo "127.0.0.1" "does-not-exist" AI_NUMERICHOST) (getaddrinfo "127.0.0.1" "does-not-exist" AI_NUMERICHOST)
#f) #f)
(lambda (key errcode) (lambda (key errcode)
(and (= errcode EAI_SERVICE) ;; According to POSIX, both error codes are valid (glibc 2.11
;; chooses `EAI_SERVICE'; Darwin chooses `EAI_NONAME'.)
(and (or (= errcode EAI_SERVICE)
(= errcode EAI_NONAME))
(string? (gai-strerror errcode)))))))) (string? (gai-strerror errcode))))))))