tests: Make TDLS tests more robust

Wait for hostapd to report connection completion before performing
connectivity test to avoid race conditions especially with UML
time-travel.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-12-26 11:39:12 +02:00
parent 3204795d7a
commit f0825655c4

View file

@ -30,6 +30,8 @@ def connectivity(dev, hapd):
def connect_2sta(dev, ssid, hapd): def connect_2sta(dev, ssid, hapd):
dev[0].connect(ssid, psk="12345678", scan_freq="2412") dev[0].connect(ssid, psk="12345678", scan_freq="2412")
dev[1].connect(ssid, psk="12345678", scan_freq="2412") dev[1].connect(ssid, psk="12345678", scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
connectivity(dev, hapd) connectivity(dev, hapd)
def connect_2sta_wpa2_psk(dev, hapd): def connect_2sta_wpa2_psk(dev, hapd):
@ -43,6 +45,8 @@ def connect_2sta_wpa_psk_mixed(dev, hapd):
scan_freq="2412") scan_freq="2412")
dev[1].connect("test-wpa-mixed-psk", psk="12345678", proto="WPA2", dev[1].connect("test-wpa-mixed-psk", psk="12345678", proto="WPA2",
scan_freq="2412") scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
connectivity(dev, hapd) connectivity(dev, hapd)
def connect_2sta_wep(dev, hapd): def connect_2sta_wep(dev, hapd):
@ -50,11 +54,15 @@ def connect_2sta_wep(dev, hapd):
scan_freq="2412") scan_freq="2412")
dev[1].connect("test-wep", key_mgmt="NONE", wep_key0='"hello"', dev[1].connect("test-wep", key_mgmt="NONE", wep_key0='"hello"',
scan_freq="2412") scan_freq="2412")
hapd.wait_sta()
hapd.wait_sta()
connectivity(dev, hapd) connectivity(dev, hapd)
def connect_2sta_open(dev, hapd, scan_freq="2412"): def connect_2sta_open(dev, hapd, scan_freq="2412"):
dev[0].connect("test-open", key_mgmt="NONE", scan_freq=scan_freq) dev[0].connect("test-open", key_mgmt="NONE", scan_freq=scan_freq)
dev[1].connect("test-open", key_mgmt="NONE", scan_freq=scan_freq) dev[1].connect("test-open", key_mgmt="NONE", scan_freq=scan_freq)
hapd.wait_sta()
hapd.wait_sta()
connectivity(dev, hapd) connectivity(dev, hapd)
def wlantest_setup(hapd): def wlantest_setup(hapd):