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 <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20449)
This commit is contained in:
Richard Levitte 2023-03-07 15:21:16 +01:00
parent a8681703d4
commit 12c4e67675

View File

@ -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))