From 94a2dd0b252719999f3831aded2f6085c020ae96 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 14 Jan 2014 23:31:23 +0200 Subject: [PATCH] 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 --- tests/hwsim/test_ap_hs20.py | 6 ++++++ tests/hwsim/test_ap_qosmap.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index 164c050dd..8be303fda 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -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) diff --git a/tests/hwsim/test_ap_qosmap.py b/tests/hwsim/test_ap_qosmap.py index 59bd4841f..8843b4e26 100644 --- a/tests/hwsim/test_ap_qosmap.py +++ b/tests/hwsim/test_ap_qosmap.py @@ -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)