]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hwsim tests: Check kernel messages for warnings/bugs
authorJohannes Berg <johannes.berg@intel.com>
Mon, 4 Nov 2013 09:00:36 +0000 (10:00 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 5 Nov 2013 08:17:35 +0000 (10:17 +0200)
When a test passes but the kernel printed warnings, consider
the test to have failed.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

tests/hwsim/check_kernel.py [new file with mode: 0644]
tests/hwsim/run-tests.py

diff --git a/tests/hwsim/check_kernel.py b/tests/hwsim/check_kernel.py
new file mode 100644 (file)
index 0000000..30f6718
--- /dev/null
@@ -0,0 +1,22 @@
+# kernel message checker module
+#
+# Copyright (c) 2013, Intel Corporation
+#
+# Author: Johannes Berg <johannes@sipsolutions.net>
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+#
+"""
+Tests for kernel messages to find if there were any issues in them.
+"""
+
+import re
+
+issue = re.compile('(\[[0-9 .]*\] )?(WARNING:|BUG:).*')
+
+def check_kernel(logfile):
+    for line in open(logfile, 'r'):
+        if issue.match(line):
+            return False
+    return True
index 08706f615dba6ba69d5e38fe2e5a26fc7f513b63..e921d74f2f7e38f551bf86ddfdd3b3f083b16503 100755 (executable)
@@ -21,6 +21,7 @@ sys.path.append('../../wpaspy')
 
 from wpasupplicant import WpaSupplicant
 from hostapd import HostapdGlobal
+from check_kernel import check_kernel
 
 def reset_devs(dev, apdev):
     hapd = HostapdGlobal()
@@ -286,15 +287,12 @@ def main():
                 else:
                     res = t(dev)
                 if res == "skip":
-                    skipped.append(name)
                     result = "SKIP"
                 else:
-                    passed.append(name)
                     result = "PASS"
             except Exception, e:
                 logger.info(e)
                 result = "FAIL"
-                failed.append(name)
             for d in dev:
                 try:
                     d.request("NOTE TEST-STOP " + name)
@@ -314,6 +312,18 @@ def main():
 
         end = datetime.now()
         diff = end - start
+
+        if result == 'PASS' and args.dmesg:
+            if not check_kernel(os.path.join(args.logdir, name + '.dmesg')):
+                result = 'FAIL'
+
+        if result == 'PASS':
+            passed.append(name)
+        elif result == 'SKIP':
+            skipped.append(name)
+        else:
+            failed.append(name)
+
         report(conn, args.prefill, args.build, args.commit, run, name, result, diff.total_seconds())
         result = "{} {} {} {}".format(result, name, diff.total_seconds(), end)
         logger.info(result)