From 84512f8c9b423236e1fe0696616625e397dfb0de Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 25 Dec 2014 15:51:10 +0200 Subject: [PATCH] tests: Support older tshark versions The -Y command line argument may need to be replaced with -R when an older tshark version is used. Signed-off-by: Jouni Malinen --- tests/hwsim/test_cfg80211.py | 11 ++++++++++- tests/hwsim/test_p2p_channel.py | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_cfg80211.py b/tests/hwsim/test_cfg80211.py index 3e57d08d1..239b5105f 100644 --- a/tests/hwsim/test_cfg80211.py +++ b/tests/hwsim/test_cfg80211.py @@ -95,7 +95,16 @@ def test_cfg80211_tx_frame(dev, apdev, params): pass if cmd: - freq = cmd.stdout.read().splitlines() + (out,err) = cmd.communicate() + res = cmd.wait() + if res == 1: + arg[3] = '-R' + cmd = subprocess.Popen(arg, stdout=subprocess.PIPE, + stderr=open('/dev/null', 'w')) + (out,err) = cmd.communicate() + res = cmd.wait() + + freq = out.splitlines() if len(freq) != 2: raise Exception("Unexpected number of Action frames (%d)" % len(freq)) if freq[0] != "2422": diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py index e980e7a59..19cad6ea9 100644 --- a/tests/hwsim/test_p2p_channel.py +++ b/tests/hwsim/test_p2p_channel.py @@ -144,8 +144,17 @@ def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params): pass if cmd: + (out,err) = cmd.communicate() + res = cmd.wait() + if res == 1: + arg[3] = '-R' + cmd = subprocess.Popen(arg, stdout=subprocess.PIPE, + stderr=open('/dev/null', 'w')) + (out,err) = cmd.communicate() + res = cmd.wait() + last = None - for l in cmd.stdout.read().splitlines(): + for l in out.splitlines(): if "Operating Channel:" not in l: continue last = l