mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] fixup! test: pytest: have --qemu gobble up all remaining arguments
@ 2023-08-23  6:16 Ahmad Fatoum
  2023-08-23  6:16 ` [PATCH 2/2] test: pytest: support formats besides raw for --blk Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-08-23  6:16 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

test: pytest: fix command line parse error when --qemu is missing

Default is None, which is not suitable for iteration in a for loop. Give
it a default of [] instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/conftest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/conftest.py b/test/conftest.py
index 64082869b329..03bf41a93874 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -41,7 +41,7 @@ def pytest_addoption(parser):
     parser.addoption('--blk', action='append', dest='qemu_block',
         default=[], metavar="FILE",
         help=('Pass block device to emulated barebox. Can be specified more than once'))
-    parser.addoption('--qemu', dest='qemu_arg', nargs=argparse.REMAINDER,
+    parser.addoption('--qemu', dest='qemu_arg', nargs=argparse.REMAINDER, default=[],
         help=('Pass all remaining options to QEMU as is'))
 
 @pytest.fixture(scope="session")
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] test: pytest: support formats besides raw for --blk
  2023-08-23  6:16 [PATCH 1/2] fixup! test: pytest: have --qemu gobble up all remaining arguments Ahmad Fatoum
@ 2023-08-23  6:16 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2023-08-23  6:16 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

So far, we hardcoded format=raw to avoid Qemu warnings about having to
guess file type. Instead move format=raw to the start, so other formats
can be appended as necessary. Example:

  pytest --lg-env test/arm/multi_v8_defconfig.yaml --interactive --blk=img.qcow2,format=qcow2

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/conftest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/conftest.py b/test/conftest.py
index 03bf41a93874..12daf3a058ff 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -89,7 +89,7 @@ def strategy(request, target, pytestconfig):
     for i, blk in enumerate(pytestconfig.option.qemu_block):
         if virtio:
             strategy.append_qemu_args(
-                "-drive", f"if=none,file={blk},format=raw,id=hd{i}",
+                "-drive", f"if=none,format=raw,id=hd{i},file={blk}",
                 "-device", f"virtio-blk-{virtio},drive=hd{i}"
             )
         else:
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-23  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23  6:16 [PATCH 1/2] fixup! test: pytest: have --qemu gobble up all remaining arguments Ahmad Fatoum
2023-08-23  6:16 ` [PATCH 2/2] test: pytest: support formats besides raw for --blk Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox