git: e7f3888b31c2 - stable/14 - capsicum-test: skip SCTP tests if SCTP not available

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 11 Oct 2024 15:26:18 UTC
The branch stable/14 has been updated by emaste:

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

commit e7f3888b31c23ef3e26dc2bc04accf03ef943517
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-10-07 20:04:05 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-10-11 15:24:55 +0000

    capsicum-test: skip SCTP tests if SCTP not available
    
    Skip the test rather than failing if SCTP is not available (e.g., if
    sctp.ko is not loaded).
    
    Also submitted upstream as
    https://github.com/google/capsicum-test/pull/61
    
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D46999
    
    (cherry picked from commit 1d83090d850f627b6d6ebe7837e807df5d29799f)
---
 contrib/capsicum-test/sctp.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/capsicum-test/sctp.cc b/contrib/capsicum-test/sctp.cc
index 5f0d169456a8..76302059fa19 100644
--- a/contrib/capsicum-test/sctp.cc
+++ b/contrib/capsicum-test/sctp.cc
@@ -61,6 +61,9 @@ static int SctpClient(int port, unsigned char byte) {
 
 TEST(Sctp, Socket) {
   int sock = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
+  if (sock == -1 && errno == EPROTONOSUPPORT) {
+    GTEST_SKIP() << "socket(..., IPPROTO_SCTP) -> EPROTONOSUPPORT";
+  }
   EXPECT_OK(sock);
   if (sock < 0) return;