From: Jouni Malinen Date: Sun, 5 Jan 2014 10:35:13 +0000 (+0200) Subject: tests: Avoid unnecessary wlantest failures X-Git-Tag: hostap_2_1~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fce6ddd8d070573d0bd5543364b2160a0b4bb4df;p=thirdparty%2Fhostap.git 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 --- diff --git a/tests/hwsim/wlantest.py b/tests/hwsim/wlantest.py index a934edff6..305647968 100644 --- a/tests/hwsim/wlantest.py +++ b/tests/hwsim/wlantest.py @@ -1,7 +1,7 @@ #!/usr/bin/python # # Python class for controlling wlantest -# Copyright (c) 2013, Jouni Malinen +# Copyright (c) 2013-2014, Jouni Malinen # # 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",