From fce6ddd8d070573d0bd5543364b2160a0b4bb4df Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 5 Jan 2014 12:35:13 +0200 Subject: [PATCH] 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 --- tests/hwsim/wlantest.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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",