tftpd: Gracefully skip tests if networking is not enabled.

Sponsored by:	Klara, Inc.
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D39012
This commit is contained in:
Dag-Erling Smørgrav 2023-03-10 13:25:00 +00:00
parent 64c2a712d6
commit 1955ad42b3

View File

@ -319,7 +319,13 @@ setup(struct sockaddr_storage *to, uint16_t idx)
ATF_REQUIRE_EQ(getcwd(pwd, sizeof(pwd)), pwd); ATF_REQUIRE_EQ(getcwd(pwd, sizeof(pwd)), pwd);
/* Must bind(2) pre-fork so it happens before the client's send(2) */ /* Must bind(2) pre-fork so it happens before the client's send(2) */
ATF_REQUIRE((server_s = socket(protocol, SOCK_DGRAM, 0)) > 0); server_s = socket(protocol, SOCK_DGRAM, 0);
if (server_s < 0 && errno == EAFNOSUPPORT) {
atf_tc_skip("This test requires IPv%d support",
protocol == PF_INET ? 4 : 6);
}
ATF_REQUIRE_MSG(server_s >= 0,
"socket failed with error %s", strerror(errno));
ATF_REQUIRE_EQ_MSG(bind(server_s, server_addr, len), 0, ATF_REQUIRE_EQ_MSG(bind(server_s, server_addr, len), 0,
"bind failed with error %s", strerror(errno)); "bind failed with error %s", strerror(errno));