From 52358b08f5b9288a575c5c79e9aa4148cf3daae6 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 10 Dec 2016 22:35:49 +0200 Subject: [PATCH] tests: P2P device discovery and peer changing device name Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_discovery.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index 40f170b21..a510a4ab7 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -702,3 +702,31 @@ def test_discovery_while_cli_p2p_dev(dev, apdev, params): wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') wpas.interface_add(iface) run_discovery_while_cli(wpas, dev, params) + +def test_discovery_device_name_change(dev): + """P2P device discovery and peer changing device name""" + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add("wlan5") + wpas.set("device_name", "test-a") + wpas.p2p_listen() + dev[0].p2p_find(social=True) + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=15) + if ev is None: + raise Exception("Peer not found") + if "new=1" not in ev: + raise Exception("Incorrect new event: " + ev) + if "name='test-a'" not in ev: + raise Exception("Unexpected device name(1): " + ev) + + # Verify that new P2P-DEVICE-FOUND event is indicated when the peer changes + # its device name. + wpas.set("device_name", "test-b") + ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=15) + if ev is None: + raise Exception("Peer update not seen") + if "new=0" not in ev: + raise Exception("Incorrect update event: " + ev) + if "name='test-b'" not in ev: + raise Exception("Unexpected device name(2): " + ev) + wpas.p2p_stop_find() + dev[0].p2p_stop_find()