Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2023 13:29:25 GMT
From:      =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1955ad42b3b7 - main - tftpd: Gracefully skip tests if networking is not enabled.
Message-ID:  <202303101329.32ADTPAM090231@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=1955ad42b3b71a2083bd6d2aec0d9a10dd78eb21

commit 1955ad42b3b71a2083bd6d2aec0d9a10dd78eb21
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-03-10 13:25:00 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-03-10 13:25:16 +0000

    tftpd: Gracefully skip tests if networking is not enabled.
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    asomers
    Differential Revision:  https://reviews.freebsd.org/D39012
---
 libexec/tftpd/tests/functional.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libexec/tftpd/tests/functional.c b/libexec/tftpd/tests/functional.c
index 8c35daf5cd65..36f22ea33294 100644
--- a/libexec/tftpd/tests/functional.c
+++ b/libexec/tftpd/tests/functional.c
@@ -319,7 +319,13 @@ setup(struct sockaddr_storage *to, uint16_t idx)
 	ATF_REQUIRE_EQ(getcwd(pwd, sizeof(pwd)), pwd);
 	
 	/* 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,
 	    "bind failed with error %s", strerror(errno));
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303101329.32ADTPAM090231>