3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

auto-t: only call set_value for changed values in default()

The default() method was added for convenience but was extending the
test times significantly when the hostapd config was lengthy. This
was because it called set_value for every value regardless if it
had changed. Instead store the current configuration and in default()
only reset values that differ.
This commit is contained in:
James Prestwood 2023-12-06 12:17:52 -08:00 committed by Denis Kenzior
parent 65a03d8049
commit d756e60f24

View File

@ -75,6 +75,8 @@ class HostapdCLI(object):
if self._default_config.get('vendor_elements', None) == None: if self._default_config.get('vendor_elements', None) == None:
self._default_config['vendor_elements'] = '' self._default_config['vendor_elements'] = ''
self._current_config = self._default_config.copy()
if not self.interface: if not self.interface:
raise Exception('config %s not found' % config) raise Exception('config %s not found' % config)
@ -170,6 +172,8 @@ class HostapdCLI(object):
if self._default_config.get(key, None) == None: if self._default_config.get(key, None) == None:
raise Exception("Untracked setting '%s'! Please set default in hostapd config" % key) raise Exception("Untracked setting '%s'! Please set default in hostapd config" % key)
self._current_config[key] = value
cmd = self.cmdline + ['set', key, value] cmd = self.cmdline + ['set', key, value]
ctx.start_process(cmd).wait() ctx.start_process(cmd).wait()
@ -200,7 +204,10 @@ class HostapdCLI(object):
def default(self): def default(self):
for k, v in self._default_config.items(): for k, v in self._default_config.items():
self.set_value(k, v) # Only bother setting the value if it differs
if self._current_config[k] != v:
self.set_value(k, v)
self._current_config[k] = v
self.reload() self.reload()