From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v2 06/15] auto-t: iwd.py: update to work with test-runner rewrite
Date: Fri, 28 Aug 2020 09:40:41 -0700 [thread overview]
Message-ID: <20200828164050.1456-7-prestwoj@gmail.com> (raw)
In-Reply-To: <20200828164050.1456-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3510 bytes --]
The class initializer was changed to make starting IWD on by default.
This allows us to not have multiple places where IWD is started. You
can still pass False which will initialize the class but not start
IWD itself. The configuration director was also chaged to /tmp by
default. This was done by all tests requiring main.conf anyways, so
we might as well make it the default.
---
autotests/util/iwd.py | 48 ++++++++++++++-----------------------------
1 file changed, 15 insertions(+), 33 deletions(-)
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index ef1ea80e..37daaeef 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -15,7 +15,7 @@ import weakref
from abc import ABCMeta, abstractmethod
from enum import Enum
-import wiphy
+from config import ctx
IWD_STORAGE_DIR = '/var/lib/iwd'
IWD_CONFIG_DIR = '/etc/iwd'
@@ -873,7 +873,10 @@ class DeviceList(collections.Mapping):
class IWD(AsyncOpAbstract):
- ''''''
+ '''
+ Start an IWD instance. By default IWD will be started and with the
+ config directory set to /tmp.
+ '''
_bus = dbus.SystemBus()
_object_manager_if = None
@@ -882,40 +885,22 @@ class IWD(AsyncOpAbstract):
_devices = None
_instance = None
- def __init__(self, start_iwd_daemon = False,
- iwd_config_dir = IWD_CONFIG_DIR):
+ def __init__(self, start_iwd_daemon = True, iwd_config_dir = '/tmp'):
global mainloop
mainloop = GLib.MainLoop()
- if start_iwd_daemon:
- args = []
- iwd_wiphys = [wname for wname, wiphy in wiphy.wiphy_map.items()
- if wiphy.use == 'iwd']
- whitelist = ','.join(iwd_wiphys)
-
- if os.environ.get('IWD_TEST_VALGRIND', None) == 'on':
- args.append('valgrind')
- args.append('--leak-check=full')
- args.append('--log-file=/tmp/valgrind.log')
-
- os.environ["CONFIGURATION_DIRECTORY"] = iwd_config_dir;
-
- args.append('iwd')
- args.append('-p')
- args.append(whitelist)
- args.append('-d')
-
- import subprocess
- iwd_proc = subprocess.Popen(args)
+ self._iwd_proc = None
- self._iwd_proc = iwd_proc
+ if start_iwd_daemon:
+ self._iwd_proc = ctx.start_iwd(iwd_config_dir)
tries = 0
while not self._bus.name_has_owner(IWD_SERVICE):
- if os.environ['IWD_TEST_TIMEOUTS'] == 'on':
+ if ctx.args.gdb == 'None':
if tries > 100:
if start_iwd_daemon:
- iwd_proc.terminate()
+ self._iwd_proc.kill()
+ self._iwd_proc = None
raise TimeoutError('IWD has failed to start')
tries += 1
time.sleep(0.1)
@@ -935,12 +920,9 @@ class IWD(AsyncOpAbstract):
self._known_networks = None
self._devices = None
- self._iwd_proc.terminate()
- self._iwd_proc.wait()
-
- self._iwd_proc = None
-
- del os.environ["CONFIGURATION_DIRECTORY"]
+ if self._iwd_proc is not None:
+ self._iwd_proc.kill()
+ self._iwd_proc = None
@property
def _object_manager(self):
--
2.21.1
next prev parent reply other threads:[~2020-08-28 16:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 16:40 [PATCH v2 00/15] Test Runner rewrite James Prestwood
2020-08-28 16:40 ` [PATCH v2 01/15] auto-t: prepare autotests for test-runner re-write James Prestwood
2020-08-28 16:40 ` [PATCH v2 02/15] auto-t: introduce pure python " James Prestwood
2020-08-28 16:40 ` [PATCH v2 03/15] auto-t: hostapd.py: update to work with test-runner rewrite James Prestwood
2020-08-28 16:40 ` [PATCH v2 04/15] auto-t: testutil.py: " James Prestwood
2020-08-28 16:40 ` [PATCH v2 05/15] auto-t: ofono.py: fix timeout cleanup and wait for service James Prestwood
2020-08-28 16:40 ` James Prestwood [this message]
2020-08-28 16:40 ` [PATCH v2 07/15] auto-t: iwd.py: fix multiple timeout cleanup issues James Prestwood
2020-08-28 16:40 ` [PATCH v2 08/15] auto-t: remove wiphy.py James Prestwood
2020-08-28 16:40 ` [PATCH v2 09/15] auto-t: fix hidden network test James Prestwood
2020-08-28 16:40 ` [PATCH v2 10/15] auto-t: fix testSAE autoconnect_test.py James Prestwood
2020-08-28 16:40 ` [PATCH v2 11/15] auto-t: skip ofono tests if ofonod isn't running James Prestwood
2020-08-28 16:40 ` [PATCH v2 12/15] auto-t: replace hard-coded interfaces James Prestwood
2020-08-28 16:40 ` [PATCH v2 13/15] auto-t: remove device.wait_for_connected James Prestwood
2020-08-28 16:40 ` [PATCH v2 14/15] tools: post test-runner rewrite cleanup James Prestwood
2020-08-28 16:40 ` [PATCH v2 15/15] doc: update test runner docs James Prestwood
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=20200828164050.1456-7-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