tests: Use single channel scans to speed up test cases

A full scan in these specific test cases does not add anything to the
coverage, so use a single channel scan for the station connection to
remove undesired extra time needed for a full scan.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-11-02 11:22:16 +02:00
parent de684a2b83
commit c65f23ab64
4 changed files with 33 additions and 20 deletions

View file

@ -19,7 +19,8 @@ def test_ap_change_ssid(dev, apdev):
params = hostapd.wpa2_params(ssid="test-wpa2-psk-start", params = hostapd.wpa2_params(ssid="test-wpa2-psk-start",
passphrase="12345678") passphrase="12345678")
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
id = dev[0].connect("test-wpa2-psk-start", psk="12345678") id = dev[0].connect("test-wpa2-psk-start", psk="12345678",
scan_freq="2412")
dev[0].request("DISCONNECT") dev[0].request("DISCONNECT")
logger.info("Change SSID dynamically") logger.info("Change SSID dynamically")

View file

@ -22,7 +22,7 @@ def eap_connect(dev, method, identity, anonymous_identity=None, password=None,
identity=identity, anonymous_identity=anonymous_identity, identity=identity, anonymous_identity=anonymous_identity,
password=password, phase1=phase1, phase2=phase2, password=password, phase1=phase1, phase2=phase2,
ca_cert=ca_cert, domain_suffix_match=domain_suffix_match, ca_cert=ca_cert, domain_suffix_match=domain_suffix_match,
wait_connect=False) wait_connect=False, scan_freq="2412")
ev = dev.wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10) ev = dev.wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
if ev is None: if ev is None:
raise Exception("Association and EAP start timed out") raise Exception("Association and EAP start timed out")
@ -163,7 +163,7 @@ def test_ap_wpa2_eap_tls_neg_incorrect_trust_root(dev, apdev):
identity="DOMAIN\mschapv2 user", anonymous_identity="ttls", identity="DOMAIN\mschapv2 user", anonymous_identity="ttls",
password="password", phase2="auth=MSCHAPV2", password="password", phase2="auth=MSCHAPV2",
ca_cert="auth_serv/ca-incorrect.pem", ca_cert="auth_serv/ca-incorrect.pem",
wait_connect=False) wait_connect=False, scan_freq="2412")
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10) ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
if ev is None: if ev is None:
@ -214,7 +214,7 @@ def test_ap_wpa2_eap_tls_neg_suffix_match(dev, apdev):
password="password", phase2="auth=MSCHAPV2", password="password", phase2="auth=MSCHAPV2",
ca_cert="auth_serv/ca.pem", ca_cert="auth_serv/ca.pem",
domain_suffix_match="incorrect.example.com", domain_suffix_match="incorrect.example.com",
wait_connect=False) wait_connect=False, scan_freq="2412")
ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10) ev = dev[0].wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
if ev is None: if ev is None:

View file

@ -26,10 +26,12 @@ def test_ap_pmf_required(dev, apdev):
params["ieee80211w"] = "2"; params["ieee80211w"] = "2";
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, psk="12345678", ieee80211w="1", dev[0].connect(ssid, psk="12345678", ieee80211w="1",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
dev[1].connect(ssid, psk="12345678", ieee80211w="2", dev[1].connect(ssid, psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname'])
hapd = hostapd.Hostapd(apdev[0]['ifname']) hapd = hostapd.Hostapd(apdev[0]['ifname'])
hapd.request("SA_QUERY " + dev[0].p2p_interface_addr()) hapd.request("SA_QUERY " + dev[0].p2p_interface_addr())
@ -56,10 +58,12 @@ def test_ap_pmf_optional(dev, apdev):
params["ieee80211w"] = "1"; params["ieee80211w"] = "1";
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, psk="12345678", ieee80211w="1", dev[0].connect(ssid, psk="12345678", ieee80211w="1",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
dev[1].connect(ssid, psk="12345678", ieee80211w="2", dev[1].connect(ssid, psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname'])
wt.require_ap_pmf_optional(apdev[0]['bssid']) wt.require_ap_pmf_optional(apdev[0]['bssid'])
wt.require_sta_pmf(apdev[0]['bssid'], dev[0].p2p_interface_addr()) wt.require_sta_pmf(apdev[0]['bssid'], dev[0].p2p_interface_addr())
@ -76,10 +80,12 @@ def test_ap_pmf_optional_2akm(dev, apdev):
params["ieee80211w"] = "1"; params["ieee80211w"] = "1";
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, psk="12345678", ieee80211w="1", dev[0].connect(ssid, psk="12345678", ieee80211w="1",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
dev[1].connect(ssid, psk="12345678", ieee80211w="2", dev[1].connect(ssid, psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname'])
wt.require_ap_pmf_optional(apdev[0]['bssid']) wt.require_ap_pmf_optional(apdev[0]['bssid'])
wt.require_sta_pmf(apdev[0]['bssid'], dev[0].p2p_interface_addr()) wt.require_sta_pmf(apdev[0]['bssid'], dev[0].p2p_interface_addr())
@ -98,11 +104,13 @@ def test_ap_pmf_negative(dev, apdev):
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, psk="12345678", ieee80211w="1", dev[0].connect(ssid, psk="12345678", ieee80211w="1",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
try: try:
dev[1].connect(ssid, psk="12345678", ieee80211w="2", dev[1].connect(ssid, psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2") key_mgmt="WPA-PSK WPA-PSK-SHA256", proto="WPA2",
scan_freq="2412")
hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname']) hwsim_utils.test_connectivity(dev[1].ifname, apdev[0]['ifname'])
raise Exception("PMF required STA connected to no PMF AP") raise Exception("PMF required STA connected to no PMF AP")
except Exception, e: except Exception, e:

View file

@ -26,8 +26,8 @@ def connectivity(dev, ap_ifname):
hwsim_utils.test_connectivity(dev[1].ifname, ap_ifname) hwsim_utils.test_connectivity(dev[1].ifname, ap_ifname)
def connect_2sta(dev, ssid, ap_ifname): def connect_2sta(dev, ssid, ap_ifname):
dev[0].connect(ssid, psk="12345678") dev[0].connect(ssid, psk="12345678", scan_freq="2412")
dev[1].connect(ssid, psk="12345678") dev[1].connect(ssid, psk="12345678", scan_freq="2412")
connectivity(dev, ap_ifname) connectivity(dev, ap_ifname)
def connect_2sta_wpa2_psk(dev, ap_ifname): def connect_2sta_wpa2_psk(dev, ap_ifname):
@ -37,18 +37,22 @@ def connect_2sta_wpa_psk(dev, ap_ifname):
connect_2sta(dev, "test-wpa-psk", ap_ifname) connect_2sta(dev, "test-wpa-psk", ap_ifname)
def connect_2sta_wpa_psk_mixed(dev, ap_ifname): def connect_2sta_wpa_psk_mixed(dev, ap_ifname):
dev[0].connect("test-wpa-mixed-psk", psk="12345678", proto="WPA") dev[0].connect("test-wpa-mixed-psk", psk="12345678", proto="WPA",
dev[1].connect("test-wpa-mixed-psk", psk="12345678", proto="WPA2") scan_freq="2412")
dev[1].connect("test-wpa-mixed-psk", psk="12345678", proto="WPA2",
scan_freq="2412")
connectivity(dev, ap_ifname) connectivity(dev, ap_ifname)
def connect_2sta_wep(dev, ap_ifname): def connect_2sta_wep(dev, ap_ifname):
dev[0].connect("test-wep", key_mgmt="NONE", wep_key0='"hello"') dev[0].connect("test-wep", key_mgmt="NONE", wep_key0='"hello"',
dev[1].connect("test-wep", key_mgmt="NONE", wep_key0='"hello"') scan_freq="2412")
dev[1].connect("test-wep", key_mgmt="NONE", wep_key0='"hello"',
scan_freq="2412")
connectivity(dev, ap_ifname) connectivity(dev, ap_ifname)
def connect_2sta_open(dev, ap_ifname): def connect_2sta_open(dev, ap_ifname):
dev[0].connect("test-open", key_mgmt="NONE") dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412")
dev[1].connect("test-open", key_mgmt="NONE") dev[1].connect("test-open", key_mgmt="NONE", scan_freq="2412")
connectivity(dev, ap_ifname) connectivity(dev, ap_ifname)
def wlantest_setup(): def wlantest_setup():