tests: Add some delay before wlantest operations
authorJouni Malinen <j@w1.fi>
Tue, 14 Jan 2014 21:31:23 +0000 (23:31 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 14 Jan 2014 22:09:56 +0000 (00:09 +0200)
Since wlantest is a separate process that is not synchronized with rest
of the test components, there can be some latency in it having the STA
entries and counters updated. There is a race condition between this
happening and then test script clearing or fetching data. Make this race
condition less likely to cause bogus test failures by adding some wait
between these operations.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_ap_hs20.py
tests/hwsim/test_ap_qosmap.py

index 164c050..8be303f 100644 (file)
@@ -205,6 +205,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
 
     dev[0].request("SET hessid " + bssid2)
     dev[0].scan(freq="2412")
+    time.sleep(0.03)
     check_probe_resp(wt, bssid, bssid2)
 
     logger.info("Check probe request filtering based on access network type")
@@ -214,6 +215,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
     dev[0].request("SET hessid 00:00:00:00:00:00")
     dev[0].request("SET access_network_type 14")
     dev[0].scan(freq="2412")
+    time.sleep(0.03)
     check_probe_resp(wt, bssid2, bssid)
 
     wt.clear_bss_counters(bssid)
@@ -221,6 +223,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
     dev[0].request("SET hessid 00:00:00:00:00:00")
     dev[0].request("SET access_network_type 1")
     dev[0].scan(freq="2412")
+    time.sleep(0.03)
     check_probe_resp(wt, bssid, bssid2)
 
     logger.info("Check probe request filtering based on HESSID and ANT")
@@ -230,6 +233,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
     dev[0].request("SET hessid " + bssid)
     dev[0].request("SET access_network_type 14")
     dev[0].scan(freq="2412")
+    time.sleep(0.03)
     check_probe_resp(wt, bssid2, bssid)
 
     wt.clear_bss_counters(bssid)
@@ -237,6 +241,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
     dev[0].request("SET hessid " + bssid2)
     dev[0].request("SET access_network_type 14")
     dev[0].scan(freq="2412")
+    time.sleep(0.03)
     check_probe_resp(wt, bssid, None)
     check_probe_resp(wt, bssid2, None)
 
@@ -245,6 +250,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
     dev[0].request("SET hessid " + bssid)
     dev[0].request("SET access_network_type 1")
     dev[0].scan(freq="2412")
+    time.sleep(0.03)
     check_probe_resp(wt, bssid, None)
     check_probe_resp(wt, bssid2, None)
 
index 59bd484..8843b4e 100644 (file)
@@ -23,6 +23,7 @@ def check_qos_map(ap, dev, dscp, tid, ap_tid=None):
     wt = Wlantest()
     wt.clear_sta_counters(bssid, sta)
     hwsim_utils.test_connectivity(dev.ifname, ap['ifname'], dscp=dscp)
+    time.sleep(0.02)
     [ tx, rx ] = wt.get_tid_counters(bssid, sta)
     if tx[tid] == 0:
         logger.info("Expected TX DSCP " + str(dscp) + " with TID " + str(tid) + " but counters: " + str(tx))
@@ -41,6 +42,7 @@ def test_ap_qosmap(dev, apdev):
     params['qos_map_set'] = '53,2,22,6,8,15,0,7,255,255,16,31,32,39,255,255,40,47,48,55'
     hostapd.add_ap(apdev[0]['ifname'], params)
     dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412")
+    time.sleep(0.1)
     check_qos_map(apdev[0], dev[0], 53, 2)
     check_qos_map(apdev[0], dev[0], 22, 6)
     check_qos_map(apdev[0], dev[0], 8, 0)