tests: Add some delay before wlantest operations

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>
This commit is contained in:
Jouni Malinen 2014-01-14 23:31:23 +02:00
parent b21df6e779
commit 94a2dd0b25
2 changed files with 8 additions and 0 deletions

View file

@ -205,6 +205,7 @@ def test_ap_interworking_scan_filtering(dev, apdev):
dev[0].request("SET hessid " + bssid2) dev[0].request("SET hessid " + bssid2)
dev[0].scan(freq="2412") dev[0].scan(freq="2412")
time.sleep(0.03)
check_probe_resp(wt, bssid, bssid2) check_probe_resp(wt, bssid, bssid2)
logger.info("Check probe request filtering based on access network type") 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 hessid 00:00:00:00:00:00")
dev[0].request("SET access_network_type 14") dev[0].request("SET access_network_type 14")
dev[0].scan(freq="2412") dev[0].scan(freq="2412")
time.sleep(0.03)
check_probe_resp(wt, bssid2, bssid) check_probe_resp(wt, bssid2, bssid)
wt.clear_bss_counters(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 hessid 00:00:00:00:00:00")
dev[0].request("SET access_network_type 1") dev[0].request("SET access_network_type 1")
dev[0].scan(freq="2412") dev[0].scan(freq="2412")
time.sleep(0.03)
check_probe_resp(wt, bssid, bssid2) check_probe_resp(wt, bssid, bssid2)
logger.info("Check probe request filtering based on HESSID and ANT") 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 hessid " + bssid)
dev[0].request("SET access_network_type 14") dev[0].request("SET access_network_type 14")
dev[0].scan(freq="2412") dev[0].scan(freq="2412")
time.sleep(0.03)
check_probe_resp(wt, bssid2, bssid) check_probe_resp(wt, bssid2, bssid)
wt.clear_bss_counters(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 hessid " + bssid2)
dev[0].request("SET access_network_type 14") dev[0].request("SET access_network_type 14")
dev[0].scan(freq="2412") dev[0].scan(freq="2412")
time.sleep(0.03)
check_probe_resp(wt, bssid, None) check_probe_resp(wt, bssid, None)
check_probe_resp(wt, bssid2, 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 hessid " + bssid)
dev[0].request("SET access_network_type 1") dev[0].request("SET access_network_type 1")
dev[0].scan(freq="2412") dev[0].scan(freq="2412")
time.sleep(0.03)
check_probe_resp(wt, bssid, None) check_probe_resp(wt, bssid, None)
check_probe_resp(wt, bssid2, None) check_probe_resp(wt, bssid2, None)

View file

@ -23,6 +23,7 @@ def check_qos_map(ap, dev, dscp, tid, ap_tid=None):
wt = Wlantest() wt = Wlantest()
wt.clear_sta_counters(bssid, sta) wt.clear_sta_counters(bssid, sta)
hwsim_utils.test_connectivity(dev.ifname, ap['ifname'], dscp=dscp) hwsim_utils.test_connectivity(dev.ifname, ap['ifname'], dscp=dscp)
time.sleep(0.02)
[ tx, rx ] = wt.get_tid_counters(bssid, sta) [ tx, rx ] = wt.get_tid_counters(bssid, sta)
if tx[tid] == 0: if tx[tid] == 0:
logger.info("Expected TX DSCP " + str(dscp) + " with TID " + str(tid) + " but counters: " + str(tx)) 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' 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) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412") 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], 53, 2)
check_qos_map(apdev[0], dev[0], 22, 6) check_qos_map(apdev[0], dev[0], 22, 6)
check_qos_map(apdev[0], dev[0], 8, 0) check_qos_map(apdev[0], dev[0], 8, 0)