aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJonathan Afek <jonathan@wizery.com>2016-05-24 11:02:33 (GMT)
committerJouni Malinen <j@w1.fi>2016-05-28 13:33:41 (GMT)
commite2f3f0232f42c2293e4cc9a5b4813d3df55fc3af (patch)
treeb03c3e7b17534c23d40c44f79ee468f8aad635a8 /tests
parent8960afa4bfa423774a8ca58cc21a4a7c1ab6089e (diff)
downloadhostap-e2f3f0232f42c2293e4cc9a5b4813d3df55fc3af.zip
hostap-e2f3f0232f42c2293e4cc9a5b4813d3df55fc3af.tar.gz
hostap-e2f3f0232f42c2293e4cc9a5b4813d3df55fc3af.tar.bz2
tests: Use 10 retries for over-the-air broadcast connectivity
The regular hwsim tests use both unicast and broadcast frames to test the connectivity between 2 interfaces. For real hardware (remote hwsim tests) the broadcast frames will sometimes not be seen by all connected stations since they can be in low power mode during DTIM or because broadcast frames are not ACKed. Use 10 retries for broadcast connectivity tests for real hardware so that the test will pass if we successfully received at least one of them. Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/hostapd.py1
-rw-r--r--tests/hwsim/hwsim_utils.py67
2 files changed, 44 insertions, 24 deletions
diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index a6d4cad..6d6d641 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -119,6 +119,7 @@ class HostapdGlobal:
class Hostapd:
def __init__(self, ifname, bssidx=0, hostname=None, port=8877):
+ self.hostname = hostname
self.host = remotehost.Host(hostname, ifname)
self.ifname = ifname
if hostname is None:
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index 85f54a2..fd5f70c 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -25,6 +25,11 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
dev1.dump_monitor()
dev2.dump_monitor()
+ if dev1.hostname is None and dev2.hostname is None:
+ broadcast_retry_c = 1
+ else:
+ broadcast_retry_c = 10
+
try:
if config:
cmd = "DATA_TEST_CONFIG 1"
@@ -62,18 +67,25 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
raise Exception("Unexpected dev1->dev2 unicast data result")
cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr1, tos)
- if dev1group:
- dev1.group_request(cmd)
- else:
- dev1.request(cmd)
- if dev2group:
- ev = dev2.wait_group_event(["DATA-TEST-RX"], timeout=timeout)
- else:
- ev = dev2.wait_event(["DATA-TEST-RX"], timeout=timeout)
- if ev is None:
- raise Exception("dev1->dev2 broadcast data delivery failed")
- if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr1) not in ev:
- raise Exception("Unexpected dev1->dev2 broadcast data result")
+ for i in xrange(broadcast_retry_c):
+ try:
+ if dev1group:
+ dev1.group_request(cmd)
+ else:
+ dev1.request(cmd)
+ if dev2group:
+ ev = dev2.wait_group_event(["DATA-TEST-RX"],
+ timeout=timeout)
+ else:
+ ev = dev2.wait_event(["DATA-TEST-RX"], timeout=timeout)
+ if ev is None:
+ raise Exception("dev1->dev2 broadcast data delivery failed")
+ if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr1) not in ev:
+ raise Exception("Unexpected dev1->dev2 broadcast data result")
+ break
+ except Exception as e:
+ if i == broadcast_retry_c - 1:
+ raise
cmd = "DATA_TEST_TX {} {} {}".format(addr1, addr2, tos)
if dev2group:
@@ -90,18 +102,25 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
raise Exception("Unexpected dev2->dev1 unicast data result")
cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr2, tos)
- if dev2group:
- dev2.group_request(cmd)
- else:
- dev2.request(cmd)
- if dev1group:
- ev = dev1.wait_group_event(["DATA-TEST-RX"], timeout=timeout)
- else:
- ev = dev1.wait_event(["DATA-TEST-RX"], timeout=timeout)
- if ev is None:
- raise Exception("dev2->dev1 broadcast data delivery failed")
- if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr2) not in ev:
- raise Exception("Unexpected dev2->dev1 broadcast data result")
+ for i in xrange(broadcast_retry_c):
+ try:
+ if dev2group:
+ dev2.group_request(cmd)
+ else:
+ dev2.request(cmd)
+ if dev1group:
+ ev = dev1.wait_group_event(["DATA-TEST-RX"],
+ timeout=timeout)
+ else:
+ ev = dev1.wait_event(["DATA-TEST-RX"], timeout=timeout)
+ if ev is None:
+ raise Exception("dev2->dev1 broadcast data delivery failed")
+ if "DATA-TEST-RX ff:ff:ff:ff:ff:ff {}".format(addr2) not in ev:
+ raise Exception("Unexpected dev2->dev1 broadcast data result")
+ break
+ except Exception as e:
+ if i == broadcast_retry_c - 1:
+ raise
finally:
if config:
if dev1group: