From patchwork Wed Jan 3 13:58:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1881965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=f0ZDPfg+; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=Nr9Yd2rD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T4rtv6vNTz1ydd for ; Thu, 4 Jan 2024 00:59:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=T38DD2H6ytE3DNiU1mmh/1UbhLK0AiPRSgqzY1rzdkE=; b=f0ZDPfg+z7mQQS cL6EImLxz44cLzyuv8+vcJRHVZ0ZWNaoic1DOMdzq0xDuF+S27bcKQDZsKkZcPqy8+5V5iAExAmQT x1lxS6LOGkqcVx+KFJ7RSHJTelV8lP4/6fzENVsZxMoXtnFPCeBw5+wfv0kWTIiQWASzWYY1+h/mK bhStpyBS2uWFK8NMfIUYjHRleypWhrm0sFvAYLD+KzqW0B5n2NOvXISo3Xd/x0y2Hm0p5jcRqy6S7 EYPHycOxA5x7jgIltlVAgmI/GD9f0JUMa531bDiVojSk2njkpZVhjSjScq7C4nzFvEY7zHxZxt6UZ eQ6O71BXV4D91Zpt7aAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rL1lR-00B2Vm-23; Wed, 03 Jan 2024 13:58:33 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:242:246e::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rL1lN-00B2UL-0H for hostap@lists.infradead.org; Wed, 03 Jan 2024 13:58:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=1TzpbTyrrf9gd5ACOQr7R7hlhfXGB6vQe6xgpCIG+ds=; t=1704290306; x=1705499906; b=Nr9Yd2rDmfrE7J6JOIe6VBcMjkmt8yaf/h+sMtjXDxSrXYzxW2uukkbsPZ5d8CMc+/A9R+WmiFn BjLv49NFxXmNXcR5mU9Uub8NbwNQGYfxeuz0Wc7EMVEOBakno3d1a8aL0dbZ8gzWGwaFed7SlY+7i 1ARfy5xnoNQYDLIQ9s5Jo60sMijcByTQbQeHjCwmcpPdcAbtnmz0z3N5ULNp9Eru3krW0Z/DT0dKB TCj1+tcZJA+2/mGgzrDxQD1GXz2KZvmuXQ8Du2CbLrTCZSTml1yva+BViMvGyMno1ImxFud2VHpiE hhazNTQm+PCGMYaOBDPeP6qmT9CgbVNO81YQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rL1lH-00000003838-0MNW; Wed, 03 Jan 2024 14:58:23 +0100 From: Johannes Berg To: hostap@lists.infradead.org Cc: Johannes Berg Subject: [PATCH] tests: hwsim: kernel: add a test for kunit Date: Wed, 3 Jan 2024 14:58:21 +0100 Message-ID: <20240103145820.2c39860ffa9c.Iecbc3fa660e78e8339d25231c12750dd00caf1f4@changeid> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240103_055829_406050_E771979D X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Johannes Berg Add a test that runs the cfg80211/mac80211 kunit tests (they must be built as modules to run at this point), and checks the results. The test is skipped if all the modules fail to load. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg Add a test that runs the cfg80211/mac80211 kunit tests (they must be built as modules to run at this point), and checks the results. The test is skipped if all the modules fail to load. Signed-off-by: Johannes Berg --- tests/hwsim/test_kernel.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/hwsim/test_kernel.py b/tests/hwsim/test_kernel.py index d8bb3fb8b3c5..5d007cb705cf 100644 --- a/tests/hwsim/test_kernel.py +++ b/tests/hwsim/test_kernel.py @@ -10,9 +10,11 @@ import hostapd import binascii import os, time import struct +import subprocess, re from test_wnm import expect_ack from tshark import run_tshark from utils import clear_regdom, long_duration_test +from utils import HwsimSkip def _test_kernel_bss_leak(dev, apdev, deauth): ssid = "test-bss-leak" @@ -148,3 +150,17 @@ def test_kernel_reg_disconnect(dev, apdev): finally: dev[0].request("DISCONNECT") clear_regdom(hapd, dev) + +def test_kernel_kunit(dev, apdev): + modules = ('cfg80211-tests', 'mac80211-tests') + results = (subprocess.call(['modprobe', mod], stderr=subprocess.PIPE) + for mod in modules) + + if all((r != 0 for r in results)): + raise HwsimSkip("KUnit tests not available") + + dmesg = subprocess.check_output(['dmesg']) + fail_rx = re.compile(b'fail:[^0]') + for line in dmesg.split(b'\n'): + if fail_rx.search(line): + raise Exception(f'kunit test failed: {line.decode("utf-8")}')