aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-12-24 11:40:54 (GMT)
committerJouni Malinen <j@w1.fi>2015-12-24 11:40:54 (GMT)
commite85bb01998b6fc3dfb53186608d545d68922d9f2 (patch)
tree15f626ee46f35ef0b963fc6bed2928570a59741c
parenta67e7e533ab542c0faa43758541c3bbed5bae6b6 (diff)
downloadhostap-e85bb01998b6fc3dfb53186608d545d68922d9f2.zip
hostap-e85bb01998b6fc3dfb53186608d545d68922d9f2.tar.gz
hostap-e85bb01998b6fc3dfb53186608d545d68922d9f2.tar.bz2
tests: Move P2P-REMOVE-AND-REFORM-GROUP cases more robust
Wait for the AP-DISABLED and AP-ENABLED group events before reading the current group operation frequency after P2P-REMOVE-AND-REFORM-GROUP. This reduces a possibility of a race condition making a test case fail with the returned frequency being 0 when reading this before the reformed group is fully up. This may help avoid false error reports for the following test cases: p2p_go_move_reg_change p2p_go_move_scm p2p_go_move_scm_peer_supports p2p_go_move_scm_multi. Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_p2p_channel.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py
index 512f91b..78e85d2 100644
--- a/tests/hwsim/test_p2p_channel.py
+++ b/tests/hwsim/test_p2p_channel.py
@@ -675,6 +675,14 @@ def test_p2p_channel_5ghz_165_169_us(dev):
finally:
set_country("00")
+def wait_go_down_up(dev):
+ ev = dev.wait_group_event(["AP-DISABLED"], timeout=5)
+ if ev is None:
+ raise Exception("AP-DISABLED not seen after P2P-REMOVE-AND-REFORM-GROUP")
+ ev = dev.wait_group_event(["AP-ENABLED"], timeout=5)
+ if ev is None:
+ raise Exception("AP-ENABLED not seen after P2P-REMOVE-AND-REFORM-GROUP")
+
def test_p2p_go_move_reg_change(dev, apdev):
"""P2P GO move due to regulatory change"""
try:
@@ -702,6 +710,8 @@ def test_p2p_go_move_reg_change(dev, apdev):
timeout=10)
if ev is None:
raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
+ if "P2P-REMOVE-AND-REFORM-GROUP" in ev:
+ wait_go_down_up(dev[0])
freq2 = dev[0].get_group_status_field('freq')
if freq1 == freq2:
@@ -801,6 +811,8 @@ def _test_p2p_go_move_scm(dev, apdev):
"AP-CSA-FINISHED"], timeout=3)
if ev is None:
raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
+ if "P2P-REMOVE-AND-REFORM-GROUP" in ev:
+ wait_go_down_up(dev[0])
freq = dev[0].get_group_status_field('freq')
if freq != '2462':
@@ -847,6 +859,8 @@ def _test_p2p_go_move_scm_peer_supports(dev, apdev):
"AP-CSA-FINISHED"], timeout=3)
if ev is None:
raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
+ if "P2P-REMOVE-AND-REFORM-GROUP" in ev:
+ wait_go_down_up(dev[0])
freq = dev[0].get_group_status_field('freq')
if freq != '2462':
@@ -945,6 +959,8 @@ def _test_p2p_go_move_scm_multi(dev, apdev):
"AP-CSA-FINISHED"], timeout=3)
if ev is None:
raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
+ if "P2P-REMOVE-AND-REFORM-GROUP" in ev:
+ wait_go_down_up(dev[0])
freq = dev[0].get_group_status_field('freq')
if freq != '2462':
@@ -959,6 +975,8 @@ def _test_p2p_go_move_scm_multi(dev, apdev):
"AP-CSA-FINISHED"], timeout=5)
if ev is None:
raise Exception("(2) P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
+ if "P2P-REMOVE-AND-REFORM-GROUP" in ev:
+ wait_go_down_up(dev[0])
freq = dev[0].get_group_status_field('freq')
if freq != '2437':