tests: Avoid unnecessary wlantest failures

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>
This commit is contained in:
Jouni Malinen 2014-01-05 12:35:13 +02:00
parent 356d1488c4
commit fce6ddd8d0

View 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",