diff mbox

[1/9] tests: Support p2p group interfaces in hwsim remote tests

Message ID 1463663210-15610-1-git-send-email-jonathan@wizery.com
State Changes Requested
Headers show

Commit Message

Jonathan Afek May 19, 2016, 1:06 p.m. UTC
Start using the wpa_supplicant remote udp interface for the
control and monitor sockets for p2p group interfaces so
that p2p tests would work on real hardware.
Also have the group requests and events show in the test log
with the hostname and the interface name of the group interface.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
---
 tests/hwsim/wpasupplicant.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

Comments

Jouni Malinen May 28, 2016, 10:12 a.m. UTC | #1
On Thu, May 19, 2016 at 04:06:42PM +0300, Jonathan Afek wrote:
> Start using the wpa_supplicant remote udp interface for the
> control and monitor sockets for p2p group interfaces so
> that p2p tests would work on real hardware.
> Also have the group requests and events show in the test log
> with the hostname and the interface name of the group interface.

> diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
> @@ -755,7 +765,7 @@ class WpaSupplicant:
>              while True:
>                  while self.gctrl_mon.pending():
>                      ev = self.gctrl_mon.recv()
> -                    logger.debug(self.group_ifname + ": " + ev)
> +                    logger.debug(self.group_dbg + "(group): " + ev)

This breaks grpform_ext_listen_oper:

START grpform_ext_listen_oper 1/1
Traceback (most recent call last):
  File "/hostap/tests/hwsim/run-tests.py", line 451, in main
    t(dev)
  File "hostap/tests/hwsim/test_p2p_grpform.py", line 185, in test_grpform_ext_listen_oper
    _test_grpform_ext_listen_oper(dev)
  File "hostap/tests/hwsim/test_p2p_grpform.py", line 213, in _test_grpform_ext_listen_oper
    if "OK" not in wpas.group_request("STOP_AP"):
  File "hostap/tests/hwsim/wpasupplicant.py", line 166, in group_request
    logger.debug(self.group_dbg + ": CTRL(group): " + cmd)
AttributeError: WpaSupplicant instance has no attribute 'group_dbg'
Exception: WpaSupplicant instance has no attribute 'group_dbg'
FAIL grpform_ext_listen_oper 1.659165 2016-05-28 10:09:06.065236
failed tests: grpform_ext_listen_oper
Jonathan Afek May 29, 2016, 11:59 a.m. UTC | #2
On Sat, May 28, 2016 at 1:12 PM, Jouni Malinen <j@w1.fi> wrote:

> This breaks grpform_ext_listen_oper:
sending a fix patch
diff mbox

Patch

diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index f26124d..bee447a 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -158,8 +158,12 @@  class WpaSupplicant:
 
     def group_request(self, cmd):
         if self.group_ifname and self.group_ifname != self.ifname:
-            logger.debug(self.group_ifname + ": CTRL: " + cmd)
-            gctrl = wpaspy.Ctrl(os.path.join(wpas_ctrl, self.group_ifname))
+            if self.hostname is None:
+                gctrl = wpaspy.Ctrl(os.path.join(wpas_ctrl, self.group_ifname))
+            else:
+                port = self.get_ctrl_iface_port(self.group_ifname)
+                gctrl = wpaspy.Ctrl(self.hostname, port)
+            logger.debug(self.group_dbg + ": CTRL(group): " + cmd)
             return gctrl.request(cmd)
         return self.request(cmd)
 
@@ -574,7 +578,13 @@  class WpaSupplicant:
         res['ifname'] = s[2]
         self.group_ifname = s[2]
         try:
-            self.gctrl_mon = wpaspy.Ctrl(os.path.join(wpas_ctrl, self.group_ifname))
+            if self.hostname is None:
+                self.gctrl_mon = wpaspy.Ctrl(os.path.join(wpas_ctrl, self.group_ifname))
+                self.group_dbg = self.group_ifname
+            else:
+                port = self.get_ctrl_iface_port(self.group_ifname)
+                self.gctrl_mon = wpaspy.Ctrl(self.hostname, port)
+                self.group_dbg = self.hostname + "/" + self.group_ifname
             self.gctrl_mon.attach()
         except:
             logger.debug("Could not open monitor socket for group interface")
@@ -755,7 +765,7 @@  class WpaSupplicant:
             while True:
                 while self.gctrl_mon.pending():
                     ev = self.gctrl_mon.recv()
-                    logger.debug(self.group_ifname + ": " + ev)
+                    logger.debug(self.group_dbg + "(group): " + ev)
                     for event in events:
                         if event in ev:
                             return ev