]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Skip test cases properly if tshark is not available
authorJouni Malinen <j@w1.fi>
Fri, 4 Dec 2020 09:43:45 +0000 (11:43 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 4 Dec 2020 09:43:45 +0000 (11:43 +0200)
Instead of trying to process empty results, mark the test case as
skipped if tshark is not available.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/tshark.py

index d6a57f0a35090f940cda2ef80c6a7fa8044393ab..32cdf4701ec30654240931d65190e41477800b2f 100644 (file)
@@ -12,6 +12,8 @@ import subprocess
 import logging
 logger = logging.getLogger()
 
+from utils import *
+
 class UnknownFieldsException(Exception):
     def __init__(self, fields):
         Exception.__init__(self, "unknown tshark fields %s" % ','.join(fields))
@@ -41,6 +43,8 @@ def _run_tshark(filename, filter, display=None, wait=True):
                                stderr=subprocess.PIPE)
     except Exception as e:
         logger.info("Could run run tshark check: " + str(e))
+        if "No such file or directory: 'tshark'" in str(e):
+            raise HwsimSkip("No tshark available")
         cmd = None
         return None
 
@@ -111,6 +115,8 @@ def run_tshark_json(filename, filter):
                                stderr=subprocess.PIPE)
     except Exception as e:
         logger.info("Could run run tshark: " + str(e))
+        if "No such file or directory: 'tshark'" in str(e):
+            raise HwsimSkip("No tshark available")
         return None
     output = cmd.communicate()
     out = output[0].decode()