From f44c45ac7f7ff208b3de84dafd784a9aae7b43ea Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 6 Apr 2014 16:52:14 +0300 Subject: [PATCH] tests: Verify STATUS-WPS passphrase on GO Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_autogo.py | 2 ++ tests/hwsim/wpasupplicant.py | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index c8f298235..479a00473 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -257,6 +257,8 @@ def test_autogo_tdls(dev): def test_autogo_legacy(dev): """P2P autonomous GO and legacy clients""" res = autogo(dev[0]) + if dev[0].get_group_status_field("passphrase", extra="WPS") != res['passphrase']: + raise Exception("passphrase mismatch") logger.info("Connect P2P client") connect_cli(dev[0], dev[1]) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index e65bf0c83..48d8b4776 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -249,8 +249,12 @@ class WpaSupplicant: raise Exception("Association with the AP timed out") self.dump_monitor() - def get_status(self): - res = self.request("STATUS") + def get_status(self, extra=None): + if extra: + extra = "-" + extra + else: + extra = "" + res = self.request("STATUS" + extra) lines = res.splitlines() vals = dict() for l in lines: @@ -261,14 +265,18 @@ class WpaSupplicant: logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l) return vals - def get_status_field(self, field): - vals = self.get_status() + def get_status_field(self, field, extra=None): + vals = self.get_status(extra) if field in vals: return vals[field] return None - def get_group_status(self): - res = self.group_request("STATUS") + def get_group_status(self, extra=None): + if extra: + extra = "-" + extra + else: + extra = "" + res = self.group_request("STATUS" + extra) lines = res.splitlines() vals = dict() for l in lines: @@ -276,8 +284,8 @@ class WpaSupplicant: vals[name] = value return vals - def get_group_status_field(self, field): - vals = self.get_group_status() + def get_group_status_field(self, field, extra=None): + vals = self.get_group_status(extra) if field in vals: return vals[field] return None