From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 4/7] test: conftest: don't call .startswith on int
Date: Mon, 13 Apr 2026 09:44:47 +0200 [thread overview]
Message-ID: <20260413074522.1410710-5-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260413074522.1410710-1-a.fatoum@barebox.org>
The returned YAML value may be an integer if quotes are missing, which
will lead to an error when .startswith() is called on it.
Check that the value is a string first and while at it, combine the two
loops to reduce the duplicate code.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
conftest.py | 26 +++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)
diff --git a/conftest.py b/conftest.py
index c27e7a9546a1..6bf92f3afed7 100644
--- a/conftest.py
+++ b/conftest.py
@@ -226,25 +226,17 @@ def strategy(request, target, pytestconfig): # noqa: max-complexity=30
else:
pytest.exit("--blk unsupported for target\n", 1)
+ envopts = {}
+
for i, fw_cfg in enumerate(pytestconfig.option.qemu_fw_cfg):
+ value = fw_cfg.pop()
+ envpath = fw_cfg.pop() if fw_cfg else f"data/fw_cfg{i}"
+
+ envopts[envpath] = value
+
+ for envpath, value in (yaml_env | envopts).items():
if virtio:
- value = fw_cfg.pop()
- envpath = fw_cfg.pop() if fw_cfg else f"data/fw_cfg{i}"
-
- if value.startswith('@'):
- source = f"file='{value[1:]}'"
- else:
- source = f"string='{value}'"
-
- strategy.append_qemu_args(
- '-fw_cfg', f'name=opt/org.barebox.env/{envpath},{source}'
- )
- else:
- pytest.exit("--env unsupported for target\n", 1)
-
- for envpath, value in yaml_env.items():
- if virtio:
- if value.startswith('@'):
+ if isinstance(value, str) and value.startswith('@'):
source = f"file='{value[1:]}'"
else:
source = f"string='{value}'"
--
2.47.3
next prev parent reply other threads:[~2026-04-13 7:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 7:44 [PATCH 0/7] test: Add framebuffer test Ahmad Fatoum
2026-04-13 7:44 ` [PATCH 1/7] ARM: multi_v8_defconfig: enable QEMU ramfb driver Ahmad Fatoum
2026-04-13 7:44 ` [PATCH 2/7] test: enable VirtIO keyboard Ahmad Fatoum
2026-04-13 7:44 ` [PATCH 3/7] commands: fbtest: add flush for single pattern Ahmad Fatoum
2026-04-13 7:44 ` Ahmad Fatoum [this message]
2026-04-13 7:44 ` [PATCH 5/7] test: conftest: set -display none when non-interactive Ahmad Fatoum
2026-04-13 7:44 ` [PATCH 6/7] test: conftest: add qemu feature Ahmad Fatoum
2026-04-13 7:44 ` [PATCH 7/7] test: add framebuffer screenshot testing via QMP screendump Ahmad Fatoum
2026-04-22 8:01 ` [PATCH 0/7] test: Add framebuffer test Sascha Hauer
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=20260413074522.1410710-5-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.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