From nobody Thu Aug 22 19:03:36 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WqXfd1f1rz5TS5G; Thu, 22 Aug 2024 19:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WqXfd0J67z4K13; Thu, 22 Aug 2024 19:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724353417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AxwZOkIdU6eio32VFusk3IaT4FronKp3fOogULUSpbc=; b=macUgdWoL8c0SDCvZQQvUsaL6zQcY8mmvjygmIbw5jRpYhK6u+uBV9BVrnpFGgTVVG8ren Fr3MjewjGdiVFw3esWQFrcvcD1LVqiyju210gc0EKzpErrOMQVwzBkzG0760b3LfckcEho IWqru6kD52/Ngj0wwbLgLMC5Kb0Rz2x5L8b19YBymbP5AEMkDEVrQ6bF0jhzWtBZwVW4Ga 4/mpymEioIjmkxw4yHeNQDkSep0TkNrllz1WnsshC83I94NBR6ciM8AFjKt0mILePK2b87 HQjyJrT1N9XAnPd/wZ5/tob7KkY8p8tVDhUuEFPwS8J52WX7JOKHxuHxUzXp/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724353417; a=rsa-sha256; cv=none; b=vsv30OJLB0URg0mnAFqvNLhuAGHy3XMu0kmBRoRWfHlDL+1hHwSqh6WeG/FtAaoNNJYMWC tuJP/qPlnfBIjM0mbEZl3pvpv2oC5e5dFQpjHLwrKhhscYTYjsmUVAOqF0ZpJzRXgBcZTm sHjhja1kHbB1s7N74QoG9FyZPCHHDZG/L8USL8bWMB9RE2jhZefpLlSijNalltCoaCwJU0 uBCkhFKNoAvAWUl4cWC/e3qcqsiywMhAK8wAgMyKrhUZ+FxPOyX+wQgefmIVN01RKmA5Wy RlTX/+jiphDzf95KKJCZzKWTnkdoWaJWrGXSqfq58eWQ0MPTaMUYtnx/3Oqpvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724353417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AxwZOkIdU6eio32VFusk3IaT4FronKp3fOogULUSpbc=; b=d+j4Zf4ZaIDJ6SsHYM6VZDjRQLvNnpakLeMLqFXNhZyGz29L4BVVxb22Buj6/AkLYbC8GK 6D7ACclUU9ZRjjAQkG5vOYwqFGwiGmh01dlE303FSakQXBEgI5tjXPZ/qHEo3Na0mRBc4Y xMzME+tZYSD8BVm8xLVA6aVHwZ7I/VRspIEFW4SViSr83dojSt6nPXHyKXSa9j+8glAtsC 3Yrjt0UbpkeCo10Ci5ef/MYV7HpchvKXO7JNwvm/qCMbYtuZSUPpGZaS/CXFYlQCbMyCmx FqUun0UeiXpiUkXWBPpvYSyOAXFbSrUS2OxEd4z1sNzbj0wT5SmfL/icgobxpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WqXfc71Mhzg98; Thu, 22 Aug 2024 19:03:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47MJ3a06083293; Thu, 22 Aug 2024 19:03:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47MJ3apI083290; Thu, 22 Aug 2024 19:03:36 GMT (envelope-from git) Date: Thu, 22 Aug 2024 19:03:36 GMT Message-Id: <202408221903.47MJ3apI083290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 09d61b28a00a - stable/14 - vnet tests: verify that we can load if_epair and if_bridge List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 09d61b28a00a0645087859ca124c17499c6941e1 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=09d61b28a00a0645087859ca124c17499c6941e1 commit 09d61b28a00a0645087859ca124c17499c6941e1 Author: Kristof Provost AuthorDate: 2024-07-18 20:36:55 +0000 Commit: Kristof Provost CommitDate: 2024-08-22 19:01:33 +0000 vnet tests: verify that we can load if_epair and if_bridge We're going to start running many of the vnet tests in nested jails (so they can run in parallel). That means the tests won't be able to load kernel modules, which we commonly do for if_epair and if_bridge. Just assume that all vnet tests need this, because so many of them do that we don't want to manually annotate all of them. This is essentially a no-op on non-nested tests. Do the same for the python test framework. While here also have pflog_init actually call pft_init. While having pflog loaded implies we have pf too pft_init also checks for vimage support, and now for if_epair. Reviewed by: markj MFC after: 1 month Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46039 (cherry picked from commit ae8d58814089308028046ac80aeeb9cbb784bd0a) --- tests/atf_python/sys/net/vnet.py | 6 ++++++ tests/sys/common/vnet.subr | 21 +++++++++++++++++++++ tests/sys/netpfil/pf/utils.subr | 2 ++ 3 files changed, 29 insertions(+) diff --git a/tests/atf_python/sys/net/vnet.py b/tests/atf_python/sys/net/vnet.py index 8942e6839b35..7af63aa2b0c3 100644 --- a/tests/atf_python/sys/net/vnet.py +++ b/tests/atf_python/sys/net/vnet.py @@ -335,6 +335,10 @@ class VnetTestTemplate(BaseTest): NEED_ROOT: bool = True TOPOLOGY = {} + def _require_default_modules(self): + libc.kldload("if_epair.ko") + self.require_module("if_epair") + def _get_vnet_handler(self, vnet_alias: str): handler_name = "{}_handler".format(vnet_alias) return getattr(self, handler_name, None) @@ -452,6 +456,8 @@ class VnetTestTemplate(BaseTest): def setup_method(self, _method): """Sets up all the required topology and handlers for the given test""" super().setup_method(_method) + self._require_default_modules() + # TestIP6Output.test_output6_pktinfo[ipandif] topology_id = get_topology_id(self.test_id) topology = self.TOPOLOGY diff --git a/tests/sys/common/vnet.subr b/tests/sys/common/vnet.subr index 0f7dec0dc6f1..ee498cda64f3 100644 --- a/tests/sys/common/vnet.subr +++ b/tests/sys/common/vnet.subr @@ -11,11 +11,32 @@ unlist_interface() sed -i "" /^$1\$/d created_interfaces.lst } +_vnet_check_req() +{ + type=$1 + + if kldstat -q -n if_${type}.ko; then + return + fi + + if ! kldload -n -q if_${type}; then + atf_skip "if_${type}.ko is required to run this test." + return + fi +} + vnet_init() { if [ "`sysctl -i -n kern.features.vimage`" != 1 ]; then atf_skip "This test requires VIMAGE" fi + + # Check if we can create if_epair or if_bridge interfaces. + # We may be running in a jail already, unable to load modules. + # If so, skip this test because it very likely (but not certainly) + # wants at least one of those + _vnet_check_req epair + _vnet_check_req bridge } vnet_mkepair() diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr index 74ed07984601..8b463ca15fb3 100644 --- a/tests/sys/netpfil/pf/utils.subr +++ b/tests/sys/netpfil/pf/utils.subr @@ -83,6 +83,8 @@ pfsynct_init() pflog_init() { + pft_init + if ! kldstat -q -m pflog; then atf_skip "This test requires pflog" fi