Browse Source

tests: Dump control interface sockets during FST operations

This makes it less likely to hit issues with running out of control
interface TX queue when running multiple FST test in a row. Number of
the FST operation sequences seemed to leave quite a few event messages
pending in one of the attached control interface sockets for wlan5 which
could result in test failure if the buffer space ran out and some of the
wpa_supplicant events were not delivered.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 9 years ago
parent
commit
8fb84690ae
1 changed files with 28 additions and 0 deletions
  1. 28 0
      tests/hwsim/fst_module_aux.py

+ 28 - 0
tests/hwsim/fst_module_aux.py

@@ -256,11 +256,13 @@ class FstDevice:
         function"""
         function"""
         if self.peer_obj is None:
         if self.peer_obj is None:
             raise Exception("Peer wasn't added before starting session")
             raise Exception("Peer wasn't added before starting session")
+        self.dump_monitor()
         grp = ' ' + self.fst_group if self.fst_group != '' else ''
         grp = ' ' + self.fst_group if self.fst_group != '' else ''
         sid = self.grequest("FST-MANAGER SESSION_ADD" + grp)
         sid = self.grequest("FST-MANAGER SESSION_ADD" + grp)
         sid = sid.strip()
         sid = sid.strip()
         if sid.startswith("FAIL"):
         if sid.startswith("FAIL"):
             raise Exception("Cannot add FST session with groupid ==" + grp)
             raise Exception("Cannot add FST session with groupid ==" + grp)
+        self.dump_monitor()
         return sid
         return sid
 
 
     def set_session_param(self, params):
     def set_session_param(self, params):
@@ -316,6 +318,7 @@ class FstDevice:
         in "self" while others are passed to this function explicitly. If
         in "self" while others are passed to this function explicitly. If
         old_iface is None, current iface is used; if old_iface is an empty
         old_iface is None, current iface is used; if old_iface is an empty
         string."""
         string."""
+        self.dump_monitor()
         oldiface = old_iface if old_iface is not None else self.iface
         oldiface = old_iface if old_iface is not None else self.iface
         s = self.set_session_param(sid + ' old_ifname=' + oldiface)
         s = self.set_session_param(sid + ' old_ifname=' + oldiface)
         if not s.startswith("OK"):
         if not s.startswith("OK"):
@@ -336,6 +339,7 @@ class FstDevice:
             s = self.set_session_param(sid + " llt=" + self.fst_llt)
             s = self.set_session_param(sid + " llt=" + self.fst_llt)
             if not s.startswith("OK"):
             if not s.startswith("OK"):
                 raise Exception("Cannot set FST session llt:" + s)
                 raise Exception("Cannot set FST session llt:" + s)
+        self.dump_monitor()
 
 
     def send_iface_attach_request(self, ifname, group, llt, priority):
     def send_iface_attach_request(self, ifname, group, llt, priority):
         request = "FST-ATTACH " + ifname + ' ' + group
         request = "FST-ATTACH " + ifname + ' ' + group
@@ -508,6 +512,7 @@ class FstDevice:
         Returns: REASON_SWITCH - the session has been transferred successfully
         Returns: REASON_SWITCH - the session has been transferred successfully
         or a REASON_... reported by the reset event."""
         or a REASON_... reported by the reset event."""
         request = "FST-MANAGER SESSION_TRANSFER"
         request = "FST-MANAGER SESSION_TRANSFER"
+        self.dump_monitor()
         if sid != '':
         if sid != '':
             request += ' ' + sid
             request += ' ' + sid
         s = self.grequest(request)
         s = self.grequest(request)
@@ -527,6 +532,7 @@ class FstDevice:
                 raise Exception("Unrecognized FST event: " % ev)
                 raise Exception("Unrecognized FST event: " % ev)
             if event['new_state'] == 'INITIAL':
             if event['new_state'] == 'INITIAL':
                 result = event['reason']
                 result = event['reason']
+        self.dump_monitor()
         return result
         return result
 
 
     def wait_for_tear_down(self):
     def wait_for_tear_down(self):
@@ -674,6 +680,11 @@ class FstAP (FstDevice):
     def get_ssid(self):
     def get_ssid(self):
         return self.ssid
         return self.ssid
 
 
+    def dump_monitor(self):
+        """Dump control interface monitor events"""
+        if self.instance:
+            self.instance.dump_monitor()
+
 #
 #
 # FstSTA class
 # FstSTA class
 #
 #
@@ -704,9 +715,11 @@ class FstSTA (FstDevice):
         the STA will be removed when the fst wpa_supplicant process is killed by
         the STA will be removed when the fst wpa_supplicant process is killed by
         fstap.cleanup()."""
         fstap.cleanup()."""
         h = self.get_instance()
         h = self.get_instance()
+        h.dump_monitor()
         if len(self.fst_group) != 0:
         if len(self.fst_group) != 0:
             self.remove_all_sessions()
             self.remove_all_sessions()
             self.send_iface_detach_request(self.iface)
             self.send_iface_detach_request(self.iface)
+            h.dump_monitor()
         h.interface_remove(self.iface)
         h.interface_remove(self.iface)
         h.close_ctrl()
         h.close_ctrl()
         del h
         del h
@@ -751,8 +764,10 @@ class FstSTA (FstDevice):
         no_wait=True. Note, request("SCAN_RESULTS") can be used to get all the
         no_wait=True. Note, request("SCAN_RESULTS") can be used to get all the
         results at once."""
         results at once."""
         h = self.get_instance()
         h = self.get_instance()
+        h.dump_monitor()
         h.scan(None, freq, no_wait, only_new)
         h.scan(None, freq, no_wait, only_new)
         r = h.get_bss('0')
         r = h.get_bss('0')
+        h.dump_monitor()
         return r
         return r
 
 
     def connect(self, ap, **kwargs):
     def connect(self, ap, **kwargs):
@@ -761,7 +776,9 @@ class FstSTA (FstDevice):
             raise Exception("Bad AP object to connect to")
             raise Exception("Bad AP object to connect to")
         h = self.get_instance()
         h = self.get_instance()
         hap = ap.get_instance()
         hap = ap.get_instance()
+        h.dump_monitor()
         h.connect(ap.get_ssid(), **kwargs)
         h.connect(ap.get_ssid(), **kwargs)
+        h.dump_monitor()
         self.connected = ap
         self.connected = ap
 
 
     def connect_to_external_ap(self, ap, ssid, check_connection=True, **kwargs):
     def connect_to_external_ap(self, ap, ssid, check_connection=True, **kwargs):
@@ -769,6 +786,7 @@ class FstSTA (FstDevice):
         if not isinstance(ap, hostapd.Hostapd):
         if not isinstance(ap, hostapd.Hostapd):
             raise Exception("Bad AP object to connect to")
             raise Exception("Bad AP object to connect to")
         h = self.get_instance()
         h = self.get_instance()
+        h.dump_monitor()
         h.connect(ssid, **kwargs)
         h.connect(ssid, **kwargs)
         self.connected = ap
         self.connected = ap
         if check_connection:
         if check_connection:
@@ -776,17 +794,20 @@ class FstSTA (FstDevice):
             if ev is None:
             if ev is None:
                 self.connected = None
                 self.connected = None
                 raise Exception("No connection event received from %s" % ssid)
                 raise Exception("No connection event received from %s" % ssid)
+            h.dump_monitor()
 
 
     def disconnect(self, check_disconnect=True):
     def disconnect(self, check_disconnect=True):
         """Disconnects from the AP the station is currently connected to"""
         """Disconnects from the AP the station is currently connected to"""
         if self.connected is not None:
         if self.connected is not None:
             h = self.get_instance()
             h = self.get_instance()
+            h.dump_monitor()
             h.request("DISCONNECT")
             h.request("DISCONNECT")
             if check_disconnect:
             if check_disconnect:
                 hap = self.connected.get_instance()
                 hap = self.connected.get_instance()
                 ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
                 ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
                 if ev is None:
                 if ev is None:
                     raise Exception("No disconnection event received from %s" % self.connected.get_ssid())
                     raise Exception("No disconnection event received from %s" % self.connected.get_ssid())
+                h.dump_monitor()
             self.connected = None
             self.connected = None
 
 
 
 
@@ -795,10 +816,17 @@ class FstSTA (FstDevice):
         to"""
         to"""
         if self.connected is not None:
         if self.connected is not None:
             h = self.get_instance()
             h = self.get_instance()
+            h.dump_monitor()
             h.request("DISCONNECT")
             h.request("DISCONNECT")
             if check_disconnect:
             if check_disconnect:
                 hap = self.connected
                 hap = self.connected
                 ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
                 ev = hap.wait_event([ "AP-STA-DISCONNECTED" ], timeout=10)
                 if ev is None:
                 if ev is None:
                     raise Exception("No disconnection event received from AP")
                     raise Exception("No disconnection event received from AP")
+                h.dump_monitor()
             self.connected = None
             self.connected = None
+
+    def dump_monitor(self):
+        """Dump control interface monitor events"""
+        if self.instance:
+            self.instance.dump_monitor()