tests: Relax expectations for the 'home-page' checker.

Fixes a regression introduced in
50fc2384feb3bb2677d074f8f0deb5ae3c56b4d8.

* tests/lint.scm (warning-contains?): New procedure.
("home-page: host not found"): Use 'warning-contains?' instead of
testing for equality, as was the case before commit 50fc2384feb.
This handles the case where the 'getaddrinfo' error is not "Name or
service not known" but instead something like "System error" or
"Servname not supported for ai_socktype", as is the case in the build
environment.
This commit is contained in:
Ludovic Courtès 2019-08-17 15:34:24 +02:00
parent 02460db047
commit 37592014e1
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

@ -74,6 +74,12 @@
(((and (? lint-warning?) warning))
(lint-warning-message warning))))
(define (warning-contains? str warnings)
"Return true if WARNINGS is a singleton with a warning that contains STR."
(match warnings
(((? lint-warning? warning))
(string-contains (lint-warning-message warning) str))))
(test-begin "lint")
@ -366,13 +372,11 @@
(single-lint-warning-message
(check-home-page pkg))))
(test-equal "home-page: host not found"
"URI http://does-not-exist domain not found: Name or service not known"
(test-assert "home-page: host not found"
(let ((pkg (package
(inherit (dummy-package "x"))
(home-page "http://does-not-exist"))))
(single-lint-warning-message
(check-home-page pkg))))
(warning-contains? "domain not found" (check-home-page pkg))))
(test-skip (if (http-server-can-listen?) 0 1))
(test-equal "home-page: Connection refused"