]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test//bio_dgram_test.c: Skip test when BIO_bind() fails
authorRichard Levitte <levitte@openssl.org>
Tue, 7 Mar 2023 14:21:16 +0000 (15:21 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 7 Mar 2023 14:24:54 +0000 (15:24 +0100)
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)

test/bio_dgram_test.c

index e925942a44f3bffcbbc5158de3739cc5881b9381..0e2fb53103b3c77f0bd2fc3af9e28365a6d8c617 100644 (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))