mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +01:00
test-runner: Use DBus for hwsim radios
Use the hwsim DBus API rather than command line. This both is faster and more dynamic than doing so with the command line. This also avoids tracking the radio ID since we can just hang on to the radio Dbus object directly.
This commit is contained in:
parent
55e7caa8e0
commit
01c108938e
@ -41,7 +41,6 @@ TIOCSTTY = 0x540E
|
||||
|
||||
config = None
|
||||
intf_id = 0
|
||||
rad_id = 0
|
||||
|
||||
TEST_MAX_TIMEOUT = 120
|
||||
|
||||
@ -314,35 +313,26 @@ class VirtualRadio(Radio):
|
||||
than the command line.
|
||||
'''
|
||||
def __init__(self, name, config=None):
|
||||
global rad_id
|
||||
|
||||
super().__init__(name)
|
||||
|
||||
self.disable_cipher = None
|
||||
self.disable_iftype = None
|
||||
|
||||
args = ['hwsim', '--create', '--name', self.name, '--nointerface', '--p2p']
|
||||
hwsim = importlib.import_module('hwsim').Hwsim()
|
||||
|
||||
if config:
|
||||
self.disable_iftype = config.get('iftype_disable', False)
|
||||
if self.disable_iftype:
|
||||
args.append('--iftype-disable')
|
||||
args.append(self.disable_iftype)
|
||||
self.disable_iftype = config.get('iftype_disable', None)
|
||||
self.disable_cipher = config.get('cipher_disable', None)
|
||||
|
||||
self.disable_cipher = config.get('cipher_disable', False)
|
||||
if self.disable_cipher:
|
||||
args.append('--cipher-disable')
|
||||
args.append(self.disable_cipher)
|
||||
self._radio = hwsim.radios.create(name, p2p_device=True,
|
||||
iftype_disable=self.disable_iftype,
|
||||
cipher_disable=self.disable_cipher)
|
||||
|
||||
Process(args, wait=True)
|
||||
|
||||
self.id = rad_id
|
||||
rad_id += 1
|
||||
super().__init__(self._radio.name)
|
||||
|
||||
def __del__(self):
|
||||
super().__del__()
|
||||
|
||||
Process(['hwsim', '--destroy=%s' % self.id])
|
||||
self._radio.remove()
|
||||
self._radio = None
|
||||
|
||||
def __str__(self):
|
||||
ret = super().__str__()
|
||||
|
Loading…
Reference in New Issue
Block a user