Browse Source

tests: Verify STATUS-WPS passphrase on GO

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 11 years ago
parent
commit
f44c45ac7f
2 changed files with 18 additions and 8 deletions
  1. 2 0
      tests/hwsim/test_p2p_autogo.py
  2. 16 8
      tests/hwsim/wpasupplicant.py

+ 2 - 0
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])

+ 16 - 8
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