From 12c4e67675e691d7556a526aa062effff05a6532 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 7 Mar 2023 15:21:16 +0100 Subject: [PATCH] test//bio_dgram_test.c: Skip test when BIO_bind() fails This test isn't supposed to test BIO_bind() itself, so we can be a bit sloppy and assume that it fails because the attempted binding is not supported on the platform where this is run. For example, BIO_bind() fails when it's given an IPv6 address and the platform where this is run doesn't support that address family. In a case like this, it's sensible enough to simply skip the test when BIO_bind() fails. Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20449) --- test/bio_dgram_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/bio_dgram_test.c b/test/bio_dgram_test.c index e925942a44..0e2fb53103 100644 --- a/test/bio_dgram_test.c +++ b/test/bio_dgram_test.c @@ -175,11 +175,11 @@ static int test_bio_dgram_impl(int af, int use_local) if (!TEST_int_ge(fd2, 0)) goto err; - if (!TEST_int_gt(BIO_bind(fd1, addr1, 0), 0)) - goto err; - - if (!TEST_int_gt(BIO_bind(fd2, addr2, 0), 0)) + if (BIO_bind(fd1, addr1, 0) <= 0 + || BIO_bind(fd2, addr2, 0) <= 0) { + testresult = TEST_skip("BIO_bind() failed - assuming it's an unavailable address family"); goto err; + } info1.addr = addr1; if (!TEST_int_gt(BIO_sock_info(fd1, BIO_SOCK_INFO_ADDRESS, &info1), 0))