git: 69361b878546 - main - if_ovpn tests: skip the if_ovpn_c test if if_ovpn.ko isn't loaded

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 01 Mar 2023 10:00:47 UTC
The branch main has been updated by kp:

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

commit 69361b8785468fe15bb2b169a0b72af5bc108cfa
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-02-28 10:14:24 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-03-01 09:07:34 +0000

    if_ovpn tests: skip the if_ovpn_c test if if_ovpn.ko isn't loaded
    
    Skip the test (rather than loading it) if if_ovpn.ko isn't loaded. Match
    the behaviour of other tests.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/net/if_ovpn/if_ovpn_c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/sys/net/if_ovpn/if_ovpn_c.c b/tests/sys/net/if_ovpn/if_ovpn_c.c
index d98f5a0dd8e6..fa8a9a07fa35 100644
--- a/tests/sys/net/if_ovpn/if_ovpn_c.c
+++ b/tests/sys/net/if_ovpn/if_ovpn_c.c
@@ -88,7 +88,8 @@ ATF_TC_BODY(tcp, tc)
 	nvlist_t *nvl;
 
 	/* Ensure the module is loaded. */
-	(void)kldload("if_ovpn");
+	if (kldfind("if_ovpn") == -1 && errno == ENOENT)
+		atf_tc_skip("if_ovpn not loaded");
 
 	ovpn_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);