* [PATCH v2 1/3] test-runner: allow infinite process wait
@ 2022-07-19 18:52 James Prestwood
2022-07-19 18:52 ` [PATCH v2 2/3] test-runner: start dbus with --start James Prestwood
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: James Prestwood @ 2022-07-19 18:52 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
subprocess.Popen's wait() method was overwritten to be non-blocking but
in certain circumstances you do want to wait forever. Fix this to allow
timeout=None, which calls the parent wait() method directly.
---
tools/utils.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/utils.py b/tools/utils.py
index bc030230..7a182848 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -246,6 +246,10 @@ class Process(subprocess.Popen):
# Override wait() so it can do so non-blocking
def wait(self, timeout=10):
+ if timeout == None:
+ super().wait()
+ return
+
Namespace.non_block_wait(self.__wait, timeout, 1)
self._cleanup()
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2 2/3] test-runner: start dbus with --start 2022-07-19 18:52 [PATCH v2 1/3] test-runner: allow infinite process wait James Prestwood @ 2022-07-19 18:52 ` James Prestwood 2022-07-19 18:52 ` [PATCH v2 3/3] test-runner: automatically find PCI passthrough config James Prestwood 2022-07-19 19:33 ` [PATCH v2 1/3] test-runner: allow infinite process wait Denis Kenzior 2 siblings, 0 replies; 4+ messages in thread From: James Prestwood @ 2022-07-19 18:52 UTC (permalink / raw) To: iwd; +Cc: James Prestwood Starts dbus-daemon as well as sets the right environment variables so IWD can start (and any other dbus services). --- tools/run-tests | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) v2: - Rebased so it would apply cleanly. diff --git a/tools/run-tests b/tools/run-tests index 8f84c844..e45ffe46 100755 --- a/tools/run-tests +++ b/tools/run-tests @@ -1037,7 +1037,12 @@ atexit.register(exit_vm) runner.prepare_environment() if runner.args.start: - os.system(runner.args.start) + ctx = TestContext(runner.args) + ctx.start_dbus() + os.chdir(runner.args.testhome) + os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = ctx.dbus_address + + subprocess.run([runner.args.start]) else: run_tests(runner.args) -- 2.34.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] test-runner: automatically find PCI passthrough config 2022-07-19 18:52 [PATCH v2 1/3] test-runner: allow infinite process wait James Prestwood 2022-07-19 18:52 ` [PATCH v2 2/3] test-runner: start dbus with --start James Prestwood @ 2022-07-19 18:52 ` James Prestwood 2022-07-19 19:33 ` [PATCH v2 1/3] test-runner: allow infinite process wait Denis Kenzior 2 siblings, 0 replies; 4+ messages in thread From: James Prestwood @ 2022-07-19 18:52 UTC (permalink / raw) To: iwd; +Cc: James Prestwood When PCI adapters are properly configured they should exist in the vfio-pci system tree. It is assumed any devices configured as such are used for test-runner. This removes the need for a hw.conf file to be supplied, but still is required for USB adapters. Because of this the --hw option was updated to allow no value, or a file path. --- tools/runner.py | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/tools/runner.py b/tools/runner.py index f5667959..a96627de 100644 --- a/tools/runner.py +++ b/tools/runner.py @@ -116,6 +116,9 @@ class RunnerCoreArgParse(ArgumentParser): help='Writes PASS/FAIL to results file') self.add_argument('--hw', '-w', type=str, + nargs='?', + const=True, + action='store', help='Use physical adapters for tests (passthrough)') self.add_argument('--testhome', help=SUPPRESS) self.add_argument('--monitor-parent', help=SUPPRESS) @@ -382,18 +385,18 @@ class QemuRunner(RunnerAbstract): self._prepare_outfiles() if args.hw: - hw_conf = ConfigParser() - hw_conf.read(args.hw) + if os.path.isfile(args.hw): + hw_conf = ConfigParser() + hw_conf.read(args.hw) - if hw_conf.has_section('USBAdapters'): - # The actual key name of the adapter - # doesn't matter since all we need is the - # bus/address. This gets named by the kernel - # anyways once in the VM. - usb_adapters = [v for v in hw_conf['USBAdapters'].values()] + if hw_conf.has_section('USBAdapters'): + # The actual key name of the adapter + # doesn't matter since all we need is the + # bus/address. This gets named by the kernel + # anyways once in the VM. + usb_adapters = [v for v in hw_conf['USBAdapters'].values()] - if hw_conf.has_section('PCIAdapters'): - pci_adapters = [v for v in hw_conf['PCIAdapters'].values()] + pci_adapters = self._find_pci_adapters() kern_log = "ignore_loglevel" if "kernel" in args.verbose else "quiet" @@ -473,6 +476,25 @@ class QemuRunner(RunnerAbstract): self.cmdline = qemu_cmdline + def _find_pci_adapters(self): + adapters = [] + + try: + files = os.listdir('/sys/module/vfio_pci/drivers/pci:vfio-pci') + except: + return None + + for bus_addr in files: + if not bus_addr.startswith('0000:'): + continue + + adapters.append(bus_addr.replace('0000:', '')) + + if len(adapters) == 0: + return None + + return adapters + def prepare_environment(self): mounts = [ MountInfo('debugfs', 'debugfs', '/sys/kernel/debug', '', 0) ] -- 2.34.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/3] test-runner: allow infinite process wait 2022-07-19 18:52 [PATCH v2 1/3] test-runner: allow infinite process wait James Prestwood 2022-07-19 18:52 ` [PATCH v2 2/3] test-runner: start dbus with --start James Prestwood 2022-07-19 18:52 ` [PATCH v2 3/3] test-runner: automatically find PCI passthrough config James Prestwood @ 2022-07-19 19:33 ` Denis Kenzior 2 siblings, 0 replies; 4+ messages in thread From: Denis Kenzior @ 2022-07-19 19:33 UTC (permalink / raw) To: James Prestwood, iwd Hi James, On 7/19/22 13:52, James Prestwood wrote: > subprocess.Popen's wait() method was overwritten to be non-blocking but > in certain circumstances you do want to wait forever. Fix this to allow > timeout=None, which calls the parent wait() method directly. > --- > tools/utils.py | 4 ++++ > 1 file changed, 4 insertions(+) > All applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-19 19:36 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-07-19 18:52 [PATCH v2 1/3] test-runner: allow infinite process wait James Prestwood 2022-07-19 18:52 ` [PATCH v2 2/3] test-runner: start dbus with --start James Prestwood 2022-07-19 18:52 ` [PATCH v2 3/3] test-runner: automatically find PCI passthrough config James Prestwood 2022-07-19 19:33 ` [PATCH v2 1/3] test-runner: allow infinite process wait Denis Kenzior
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox