tests: More WPS/HTTP test coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-08-28 20:33:52 +03:00
parent 5882c011d6
commit 24b7f2822e
5 changed files with 1037 additions and 25 deletions

File diff suppressed because it is too large Load diff

View file

@ -11,6 +11,7 @@ logger = logging.getLogger()
import hwsim_utils
import hostapd
from utils import alloc_fail, fail_test
def check_wpa2_connection(sta, ap, hapd, ssid, mixed=False):
status = sta.get_status()
@ -73,6 +74,11 @@ def test_nfc_wps_config_token(dev, apdev):
dev[0].wait_connected(timeout=15)
check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
with alloc_fail(hapd, 1, "wps_get_oob_cred"):
conf = hapd.request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip()
if "FAIL" not in conf:
raise Exception("Unexpected configuration token received during OOM")
def test_nfc_wps_config_token_init(dev, apdev):
"""NFC tag with configuration token from AP with auto configuration"""
ssid = "test-wps-nfc-conf-token-init"
@ -139,6 +145,13 @@ def test_nfc_wps_password_token_ap(dev, apdev):
if "FAIL" in hapd.request("WPS_NFC_TOKEN WPS"):
raise Exception("Unexpected WPS_NFC_TOKEN WPS failure")
with fail_test(hapd, 1, "os_get_random;wps_nfc_token_gen"):
if "FAIL" not in hapd.request("WPS_NFC_TOKEN WPS"):
raise Exception("Unexpected WPS_NFC_TOKEN success")
with fail_test(hapd, 2, "os_get_random;wps_nfc_token_gen"):
if "FAIL" not in hapd.request("WPS_NFC_TOKEN WPS"):
raise Exception("Unexpected WPS_NFC_TOKEN success")
def test_nfc_wps_handover_init(dev, apdev):
"""Connect to WPS AP with NFC connection handover and move to configured state"""
dev[0].request("SET ignore_old_scan_res 1")
@ -163,6 +176,10 @@ def test_nfc_wps_handover_init(dev, apdev):
dev[0].wait_connected(timeout=15)
check_wpa2_connection(dev[0], apdev[0], hapd, ssid, mixed=True)
with alloc_fail(hapd, 1, "wps_build_nfc_handover_sel"):
if "FAIL" not in hapd.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR"):
raise Exception("Unexpected NFC_GET_HANDOVER_SEL success during OOM")
def test_nfc_wps_handover_errors(dev, apdev):
"""WPS AP NFC handover report error cases"""
ssid = "test-wps-nfc-handover"

View file

@ -79,6 +79,10 @@ def test_discovery(dev):
raise Exception("P2P_FIND with invalid dev_id accepted")
if "FAIL" not in dev[0].p2p_find(dev_type="foo"):
raise Exception("P2P_FIND with invalid dev_type accepted")
if "FAIL" not in dev[0].p2p_find(dev_type="1-foo-2"):
raise Exception("P2P_FIND with invalid dev_type accepted")
if "FAIL" not in dev[0].p2p_find(dev_type="1-11223344"):
raise Exception("P2P_FIND with invalid dev_type accepted")
if "FAIL" not in dev[0].global_request("P2P_PROV_DISC foo pbc"):
raise Exception("Invalid P2P_PROV_DISC accepted")

View file

@ -973,6 +973,8 @@ def test_invalid_p2p_connect_command(dev):
if "FAIL-INVALID-PIN" not in dev[0].request("P2P_CONNECT 00:11:22:33:44:55 1234567"):
raise Exception("Invalid PIN was not rejected")
if "FAIL-INVALID-PIN" not in dev[0].request("P2P_CONNECT 00:11:22:33:44:55 12345678a"):
raise Exception("Invalid PIN was not rejected")
if "FAIL-CHANNEL-UNSUPPORTED" not in dev[0].request("P2P_CONNECT 00:11:22:33:44:55 pin freq=3000"):
raise Exception("Unsupported channel not reported")

View file

@ -64,6 +64,7 @@ long_tests = [ "ap_roam_open",
"ap_wps_iteration",
"ap_wps_iteration_error",
"ap_wps_pbc_timeout",
"ap_wps_http_timeout",
"p2p_go_move_reg_change",
"p2p_go_move_active",
"p2p_go_move_scm",