[PATCH] tests: hwsim: kernel: add a test for kunit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johannes Berg <johannes.berg@xxxxxxxxx>

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 <johannes.berg@xxxxxxxxx>
---
 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")}')
-- 
2.43.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux