From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 10/11] test-runner: Use DBus for hwsim radios
Date: Thu, 17 Dec 2020 11:36:10 -0800 [thread overview]
Message-ID: <20201217193611.1177006-10-prestwoj@gmail.com> (raw)
In-Reply-To: <20201217193611.1177006-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]
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.
---
tools/test-runner | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/tools/test-runner b/tools/test-runner
index 16628399..7bd15a28 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -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_cipher = config.get('cipher_disable', False)
- if self.disable_cipher:
- args.append('--cipher-disable')
- args.append(self.disable_cipher)
+ self.disable_iftype = config.get('iftype_disable', None)
+ self.disable_cipher = config.get('cipher_disable', None)
- Process(args, wait=True)
+ self._radio = hwsim.radios.create(name, p2p_device=True,
+ iftype_disable=self.disable_iftype,
+ cipher_disable=self.disable_cipher)
- 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__()
--
2.26.2
next prev parent reply other threads:[~2020-12-17 19:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 19:36 [PATCH 01/11] hwsim: add --no-register option James Prestwood
2020-12-17 19:36 ` [PATCH 02/11] hwsim: check pending_create_msg before replying James Prestwood
2020-12-17 19:36 ` [PATCH 03/11] auto-t: fix hwsim.py to use Destroy rather than Remove James Prestwood
2020-12-17 19:36 ` [PATCH 04/11] hwsim: change radio Create() to take a dictionary James Prestwood
2020-12-17 19:36 ` [PATCH 05/11] auto-t: update hwsim radio create to use dictionary James Prestwood
2020-12-17 19:36 ` [PATCH 06/11] test-runner: add wait_for_dbus_service James Prestwood
2020-12-17 19:36 ` [PATCH 07/11] test-runner: start hwsim always (optionally --no-register) James Prestwood
2020-12-17 19:36 ` [PATCH 08/11] hwsim: add iftype/cipher disabling through DBus James Prestwood
2020-12-17 19:36 ` [PATCH 09/11] auto-t: add iftype/cipher disable to hwsim.py James Prestwood
2020-12-17 19:36 ` James Prestwood [this message]
2020-12-17 19:36 ` [PATCH 11/11] auto-t: fix hwsim.py spoof frame James Prestwood
2020-12-18 2:15 ` [PATCH 01/11] hwsim: add --no-register option Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201217193611.1177006-10-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox