Browse Source

tests: Make wpas_ctrl_many_networks more robust under valgrind

It is possible for a low powered CPU to take excessively long time to
delete 1000 network blocks when running under valgrind. This would have
resulted in the test case failing and the following reset operation
timing out which would then stop the test sequence completely.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
874057da4e
2 changed files with 6 additions and 2 deletions
  1. 4 0
      tests/hwsim/test_wpas_ctrl.py
  2. 2 2
      tests/hwsim/wpasupplicant.py

+ 4 - 0
tests/hwsim/test_wpas_ctrl.py

@@ -238,6 +238,10 @@ def test_wpas_ctrl_many_networks(dev, apdev):
     res = dev[0].request("LIST_NETWORKS LAST_ID=%d" % (id - 2))
     if str(id) not in res:
         raise Exception("Last added network was not present when using LAST_ID")
+    # This command can take a very long time under valgrind testing on a low
+    # power CPU, so increase the command timeout significantly to avoid issues
+    # with the test case failing and following reset operation timing out.
+    dev[0].request("REMOVE_NETWORK all", timeout=60)
 
 def test_wpas_ctrl_dup_network(dev, apdev):
     """wpa_supplicant ctrl_iface DUP_NETWORK"""

+ 2 - 2
tests/hwsim/wpasupplicant.py

@@ -75,9 +75,9 @@ class WpaSupplicant:
         self.remove_ifname()
         self.global_request("INTERFACE_REMOVE " + ifname)
 
-    def request(self, cmd):
+    def request(self, cmd, timeout=10):
         logger.debug(self.ifname + ": CTRL: " + cmd)
-        return self.ctrl.request(cmd)
+        return self.ctrl.request(cmd, timeout=timeout)
 
     def global_request(self, cmd):
         if self.global_iface is None: