mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] test: pytest: have --qemu gobble up all remaining arguments
@ 2023-08-22  7:48 Ahmad Fatoum
  2023-08-23  5:53 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-08-22  7:48 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Passing extra arguments to Qemu was a bit cumbersome so far:

  pytest --qemu=-device --qemu=virtio-rng-pci

Improve upon this by having --qemu just gobble all remaining arguments:

  pytest --qemu -device virtio-rng-pci

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/conftest.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/conftest.py b/test/conftest.py
index d2eef5156423..64082869b329 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -1,5 +1,6 @@
 import pytest
 import os
+import argparse
 from .py import helper
 
 
@@ -40,9 +41,8 @@ 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', action='append', dest='qemu_arg',
-        default=[], metavar="option",
-        help=('Pass option to QEMU as is'))
+    parser.addoption('--qemu', dest='qemu_arg', nargs=argparse.REMAINDER,
+        help=('Pass all remaining options to QEMU as is'))
 
 @pytest.fixture(scope="session")
 def strategy(request, target, pytestconfig):
-- 
2.39.2




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

* Re: [PATCH] test: pytest: have --qemu gobble up all remaining arguments
  2023-08-22  7:48 [PATCH] test: pytest: have --qemu gobble up all remaining arguments Ahmad Fatoum
@ 2023-08-23  5:53 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-08-23  5:53 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Aug 22, 2023 at 09:48:48AM +0200, Ahmad Fatoum wrote:
> Passing extra arguments to Qemu was a bit cumbersome so far:
> 
>   pytest --qemu=-device --qemu=virtio-rng-pci
> 
> Improve upon this by having --qemu just gobble all remaining arguments:
> 
>   pytest --qemu -device virtio-rng-pci
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  test/conftest.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/test/conftest.py b/test/conftest.py
> index d2eef5156423..64082869b329 100644
> --- a/test/conftest.py
> +++ b/test/conftest.py
> @@ -1,5 +1,6 @@
>  import pytest
>  import os
> +import argparse
>  from .py import helper
>  
>  
> @@ -40,9 +41,8 @@ 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', action='append', dest='qemu_arg',
> -        default=[], metavar="option",
> -        help=('Pass option to QEMU as is'))
> +    parser.addoption('--qemu', dest='qemu_arg', nargs=argparse.REMAINDER,
> +        help=('Pass all remaining options to QEMU as is'))
>  
>  @pytest.fixture(scope="session")
>  def strategy(request, target, pytestconfig):
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22  7:48 [PATCH] test: pytest: have --qemu gobble up all remaining arguments Ahmad Fatoum
2023-08-23  5:53 ` Sascha Hauer

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