tests: Optimize tshark operations for new versions

The wlan_mgt to wlan renaming is already included in most recent tshark
versions, so replace the backwards compatibility option to prefer the
new version so that current versions do not need to take the performance
hit.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-12-27 00:02:05 +02:00
parent a48a60ea47
commit 985718135f

View File

@ -88,7 +88,9 @@ def _run_tshark(filename, filter, display=None, wait=True):
def run_tshark(filename, filter, display=None, wait=True): def run_tshark(filename, filter, display=None, wait=True):
if display is None: display = [] if display is None: display = []
try: try:
return _run_tshark(filename, filter, display, wait) return _run_tshark(filename, filter.replace('wlan_mgt', 'wlan'),
[x.replace('wlan_mgt', 'wlan') for x in display],
wait)
except UnknownFieldsException as e: except UnknownFieldsException as e:
all_wlan_mgt = True all_wlan_mgt = True
for f in e.fields: for f in e.fields:
@ -97,9 +99,7 @@ def run_tshark(filename, filter, display=None, wait=True):
break break
if not all_wlan_mgt: if not all_wlan_mgt:
raise raise
return _run_tshark(filename, filter.replace('wlan_mgt', 'wlan'), return _run_tshark(filename, filter, display, wait)
[x.replace('wlan_mgt', 'wlan') for x in display],
wait)
def run_tshark_json(filename, filter): def run_tshark_json(filename, filter):
arg = ["tshark", "-r", filename, arg = ["tshark", "-r", filename,