Browse Source

tests: FST AP configuration and OOM

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 9 years ago
parent
commit
d99ed42a15
2 changed files with 21 additions and 1 deletions
  1. 3 1
      tests/hwsim/fst_module_aux.py
  2. 18 0
      tests/hwsim/test_fst_module.py

+ 3 - 1
tests/hwsim/fst_module_aux.py

@@ -590,7 +590,7 @@ class FstAP (FstDevice):
         self.global_instance = hostapd.HostapdGlobal()
         self.global_instance = hostapd.HostapdGlobal()
         FstDevice.__init__(self, iface, fst_group, fst_pri, fst_llt, rsn)
         FstDevice.__init__(self, iface, fst_group, fst_pri, fst_llt, rsn)
 
 
-    def start(self):
+    def start(self, return_early=False):
         """Starts AP the "standard" way as it was intended by hostapd tests.
         """Starts AP the "standard" way as it was intended by hostapd tests.
         This will work only when FST supports fully dynamically loading
         This will work only when FST supports fully dynamically loading
         parameters in hostapd."""
         parameters in hostapd."""
@@ -609,6 +609,8 @@ class FstAP (FstDevice):
             raise Exception("Could not ping FST hostapd")
             raise Exception("Could not ping FST hostapd")
         self.reg_ctrl.start()
         self.reg_ctrl.start()
         self.get_global_instance()
         self.get_global_instance()
+        if return_early:
+            return self.hapd
         if len(self.fst_group) != 0:
         if len(self.fst_group) != 0:
             self.send_iface_attach_request(self.iface, self.fst_group,
             self.send_iface_attach_request(self.iface, self.fst_group,
                                            self.fst_llt, self.fst_pri)
                                            self.fst_llt, self.fst_pri)

+ 18 - 0
tests/hwsim/test_fst_module.py

@@ -1925,3 +1925,21 @@ def test_fst_proto(dev, apdev, test_params):
             fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
             fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
         except:
         except:
             pass
             pass
+
+def test_fst_ap_config_oom(dev, apdev, test_params):
+    """FST AP configuration and OOM"""
+    ap1 = fst_module_aux.FstAP(apdev[0]['ifname'], 'fst_11a', 'a',
+                               fst_test_common.fst_test_def_chan_a,
+                               fst_test_common.fst_test_def_group,
+                               fst_test_common.fst_test_def_prio_low)
+    hapd = ap1.start(return_early=True)
+    with alloc_fail(hapd, 1, "fst_group_create"):
+        res = ap1.grequest("FST-ATTACH %s %s" % (ap1.iface, ap1.fst_group))
+        if not res.startswith("FAIL"):
+            raise Exception("FST-ATTACH succeeded unexpectedly")
+
+    with alloc_fail(hapd, 1, "fst_group_create_mb_ie"):
+        res = ap1.grequest("FST-ATTACH %s %s" % (ap1.iface, ap1.fst_group))
+        # This is allowed to complete currently
+
+    ap1.stop()