commit ebd712af4e8b48ffc1c5e3139cbc1d0999aeeb6e
parent 9c72d2f5462e70f93d3a9dc397cd1950ffd69634
Author: James Prestwood <prestwoj@gmail.com>
Date: Tue, 20 Oct 2020 11:02:44 -0700
auto-t: no hostapd instance graceful failure
If a test does not need any hostapd instances but still loads
hostapd.py for some reason we want to gracefully throw an
exception rather than fail in some other manor.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py
@@ -32,6 +32,10 @@ class HostapdCLI:
def _init_hostapd(self, config=None):
global ctrl_count
interface = None
+ self.ctrl_sock = None
+
+ if not ctx.hostapd:
+ raise Exception("No hostapd instances are configured")
if not config and len(ctx.hostapd.instances) > 1:
raise Exception('config must be provided if more than one hostapd instance exists')
@@ -110,6 +114,9 @@ class HostapdCLI:
raise Exception('timeout waiting for control response')
def _del_hostapd(self, force=False):
+ if not self.ctrl_sock:
+ return
+
self.ctrl_sock.close()
os.remove(self.local_ctrl)