]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Avoid unnecessary wlantest failures
authorJouni Malinen <j@w1.fi>
Sun, 5 Jan 2014 10:35:13 +0000 (12:35 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 7 Jan 2014 08:45:10 +0000 (10:45 +0200)
It is possible that wlantest has not yet created the BSS entry in all
cases, so interpret failures (no BSS entry being the most likely cause)
as zero counters. Similarly, ignore clear_bss_counters errors since they
are most likely reporting that the BSS was not found and as such, there
was no need to clear the counters anyway.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/wlantest.py

index a934edff6a7ea87e806ff002b5645dfc5dd153c0..305647968477c7437c38351a9b289e859bd58a21 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 #
 # Python class for controlling wlantest
-# Copyright (c) 2013, Jouni Malinen <j@w1.fi>
+# Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi>
 #
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
@@ -50,17 +50,17 @@ class Wlantest:
         return res
 
     def get_bss_counter(self, field, bssid):
-        res = subprocess.check_output([self.wlantest_cli, "get_bss_counter",
-                                       field, bssid]);
+        try:
+            res = subprocess.check_output([self.wlantest_cli, "get_bss_counter",
+                                           field, bssid]);
+        except Exception, e:
+            return 0
         if "FAIL" in res:
-            raise Exception("wlantest_cli command failed")
+            return 0
         return int(res)
 
     def clear_bss_counters(self, bssid):
-        res = subprocess.check_output([self.wlantest_cli, "clear_bss_counters",
-                                       bssid]);
-        if "FAIL" in res:
-            raise Exception("wlantest_cli command failed")
+        subprocess.call([self.wlantest_cli, "clear_bss_counters", bssid]);
 
     def info_sta(self, field, bssid, addr):
         res = subprocess.check_output([self.wlantest_cli, "info_sta",