tests: Make test_discovery report PD failures with more detail

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-03-30 16:10:04 +02:00
parent 5b06bdf795
commit b12b7c7a1f

View file

@ -33,12 +33,15 @@ def test_discovery(dev):
dev[0].request("P2P_PROV_DISC " + addr1 + " display")
ev1 = dev[1].wait_event(["P2P-PROV-DISC-SHOW-PIN"], timeout=15)
if ev1 is None:
raise Exception("Provision discovery timed out")
raise Exception("Provision discovery timed out (display/dev1)")
if addr0 not in ev1:
raise Exception("Dev0 not in provision discovery event")
ev0 = dev[0].wait_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=15)
ev0 = dev[0].wait_event(["P2P-PROV-DISC-ENTER-PIN",
"P2P-PROV-DISC-FAILURE"], timeout=15)
if ev0 is None:
raise Exception("Provision discovery timed out")
raise Exception("Provision discovery timed out (display/dev0)")
if "P2P-PROV-DISC-FAILURE" in ev0:
raise Exception("Provision discovery failed (display/dev0)")
if addr1 not in ev0:
raise Exception("Dev1 not in provision discovery event")
@ -46,12 +49,15 @@ def test_discovery(dev):
dev[0].request("P2P_PROV_DISC " + addr1 + " keypad")
ev1 = dev[1].wait_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=15)
if ev1 is None:
raise Exception("Provision discovery timed out")
raise Exception("Provision discovery timed out (keypad/dev1)")
if addr0 not in ev1:
raise Exception("Dev0 not in provision discovery event")
ev0 = dev[0].wait_event(["P2P-PROV-DISC-SHOW-PIN"], timeout=15)
ev0 = dev[0].wait_event(["P2P-PROV-DISC-SHOW-PIN", "P2P-PROV-DISC-FAILURE"],
timeout=15)
if ev0 is None:
raise Exception("Provision discovery timed out")
raise Exception("Provision discovery timed out (keypad/dev0)")
if "P2P-PROV-DISC-FAILURE" in ev0:
raise Exception("Provision discovery failed (keypad/dev0)")
if addr1 not in ev0:
raise Exception("Dev1 not in provision discovery event")
@ -59,12 +65,15 @@ def test_discovery(dev):
dev[0].request("P2P_PROV_DISC " + addr1 + " pbc")
ev1 = dev[1].wait_event(["P2P-PROV-DISC-PBC-REQ"], timeout=15)
if ev1 is None:
raise Exception("Provision discovery timed out")
raise Exception("Provision discovery timed out (pbc/dev1)")
if addr0 not in ev1:
raise Exception("Dev0 not in provision discovery event")
ev0 = dev[0].wait_event(["P2P-PROV-DISC-PBC-RESP"], timeout=15)
ev0 = dev[0].wait_event(["P2P-PROV-DISC-PBC-RESP", "P2P-PROV-DISC-FAILURE"],
timeout=15)
if ev0 is None:
raise Exception("Provision discovery timed out")
raise Exception("Provision discovery timed out (pbc/dev0)")
if "P2P-PROV-DISC-FAILURE" in ev0:
raise Exception("Provision discovery failed (pbc/dev0)")
if addr1 not in ev0:
raise Exception("Dev1 not in provision discovery event")