From 2db832b1e6bd13a9fd1168b1d314b8c39ac7ea56 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 6 Jan 2014 17:58:25 +0200 Subject: [PATCH] tests: Negative test case for P2P group formation with incorrect PIN Signed-hostap: Jouni Malinen --- tests/hwsim/test_p2p_grpform.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py index 48e063c9f..c673a4c61 100644 --- a/tests/hwsim/test_p2p_grpform.py +++ b/tests/hwsim/test_p2p_grpform.py @@ -405,3 +405,19 @@ def test_grpform_no_5ghz_add_cli4(dev): if int(i_res['freq']) > 4000: raise Exception("Unexpected channel - did not follow world roaming rules") remove_group(dev[0], dev[1]) + +def test_grpform_incorrect_pin(dev): + """P2P GO Negotiation with incorrect PIN""" + dev[1].p2p_listen() + pin = dev[1].wps_read_pin() + addr1 = dev[1].p2p_dev_addr() + if not dev[0].discover_peer(addr1): + raise Exception("Peer not found") + dev[1].p2p_go_neg_auth(dev[0].p2p_dev_addr(), pin, 'display', go_intent=0) + dev[0].request("P2P_CONNECT " + addr1 + " 00000000 enter go_intent=15") + ev = dev[1].wait_event(["P2P-GROUP-FORMATION-FAILURE"], timeout=10) + if ev is None: + raise Exception("Group formation failure timed out") + ev = dev[0].wait_event(["P2P-GROUP-FORMATION-FAILURE"], timeout=5) + if ev is None: + raise Exception("Group formation failure timed out")