From nobody Tue Jul 23 15:00:08 2024 X-Original-To: dev-commits-src-all@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 4WT0gX4d34z5S54g; Tue, 23 Jul 2024 15:00:08 +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 4WT0gX47Bfz4V0w; Tue, 23 Jul 2024 15:00:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721746808; 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=BYs5iyUw2MbzLWywTP3XCdPjBwLwTDQvKZ6TZkCh0w0=; b=I4YF3fwZCXwVcgft1N1JQI/Fs6YfvlIUK25kf8t66+Gstc3EvYHDfPaOgfT8CgYx83TMgT bhqcXx5IY9LnF4eTGLdZftRloWP7wKZefhShuZ/u4PPkMr/1/m6TmE+xnED9+G9fN3K6wx 2RULWlTavNb4LaL2fTs7/fOdOhBWCkqUWEeo2AQkKe+ZZuJc9YJFIT8FivwA/O6SRek2l4 B38yeoWOD1NmlmZPxXAj9FHtkTHCd0pECSZO29WbevPb9mZJb2GMGAytcTGP5sgZLih0Za nTVvbtFE2IIlJWBsnEIkPkCiVbUnCAqgJbsDU33hmHW7dYAQxotqV6JUT5N5qg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721746808; a=rsa-sha256; cv=none; b=rFubcyHCK3tua4ZJCIbUhRWSoPAXnO20N/LraRqTca/z8IH7a+7MK856E0L6GN6kKxKHEI tCsYJUuqDs+0XyN+DaC1IJYZluwzQ7iun+QDDUSfJFaGZWhqCNstTL4XF2YofA3aq46ugU WfqnnRBpA3tghwebh6+zUcH+bGP3XcLGI7OzXkpUCDiCnJZ8NNulBE0+Vlomec55qe/VJC 6QgCS5pdoceiW3jcq/WSaj0Xwn3QL5Mms/mTRH0hYjyP8Oks15aEVUhNOIOe6bbeTASFzJ Hho22fWZIggGy0lk6W97dQkQa0fyfPHVDkiCa0F+B9WRoSwHGbbhMJcban1u/g== 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=1721746808; 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=BYs5iyUw2MbzLWywTP3XCdPjBwLwTDQvKZ6TZkCh0w0=; b=q5okBdHln72cZJA0DHinvitj2hxB8Y9dAxdK27lfmPi9Gymcfhm4w+MdzLwZsD9neIz/Eb uJdV4Tvx6x/y3COHhOCuK/NY0jWHrmYM3Zq8thE9H0HoA6h6PT11j9Wwy/9vQrgGrpOIFe QsMhr/tLd8BUIoWOtSWMWCbgTnd9i2X04YRi7TQebn6lyFvwDPFvkaqKdrvMi0Owf98ds9 hmjf85VqGe7+9DUX1dUdFp1o4Ohzf9TIJLZLa7dt9wLFcE8jI/9CFUXLo4CuoGR4yamLWP WKVxyKJdEBiyxcSro7HbjQNLxACEzE1kG1NtoeDzu9rAGwLGLa7LWnSH0o5nyQ== 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 4WT0gX3jphzY98; Tue, 23 Jul 2024 15:00:08 +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 46NF08ht078763; Tue, 23 Jul 2024 15:00:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46NF084p078758; Tue, 23 Jul 2024 15:00:08 GMT (envelope-from git) Date: Tue, 23 Jul 2024 15:00:08 GMT Message-Id: <202407231500.46NF084p078758@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ae8d58814089 - main - vnet tests: verify that we can load if_epair and if_bridge List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: ae8d58814089308028046ac80aeeb9cbb784bd0a Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ae8d58814089308028046ac80aeeb9cbb784bd0a commit ae8d58814089308028046ac80aeeb9cbb784bd0a Author: Kristof Provost AuthorDate: 2024-07-18 20:36:55 +0000 Commit: Kristof Provost CommitDate: 2024-07-23 13:57:25 +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 --- 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 67fe15fff69c..6da5f2625990 100644 --- a/tests/atf_python/sys/net/vnet.py +++ b/tests/atf_python/sys/net/vnet.py @@ -334,6 +334,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) @@ -451,6 +455,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 fd67385655fc..bd98b02da33f 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 25720c1bcb66..f02dfc22049f 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