From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Jonas Rebmann <jre@pengutronix.de>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! test: py: add TLV integration tests
Date: Mon, 13 Oct 2025 14:00:30 +0200 [thread overview]
Message-ID: <20251013120031.761008-1-a.fatoum@pengutronix.de> (raw)
test: py: tlv: skip when crcmod is missing
TLV tests shouldn't fail the test suite if the dependencies for the
generator scripts are not available.
Therefore, have the script return 127 as specific error code and skip
the test in that case.
While at it, also drop the currently unused import for mkPredefinedCrcFun.
Cc: Jonas Rebmann <jre@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/bareboxtlv-generator/bareboxtlv-generator.py | 8 +++++++-
test/py/test_tlv.py | 6 +++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/bareboxtlv-generator/bareboxtlv-generator.py b/scripts/bareboxtlv-generator/bareboxtlv-generator.py
index 5f9285a80630..6174fe91cdd4 100755
--- a/scripts/bareboxtlv-generator/bareboxtlv-generator.py
+++ b/scripts/bareboxtlv-generator/bareboxtlv-generator.py
@@ -2,9 +2,15 @@
import argparse
import struct
+import sys
import yaml
-from crcmod.predefined import mkPredefinedCrcFun
+
+try:
+ from crcmod.predefined import mkPredefinedCrcFun
+except ModuleNotFoundError:
+ print("Error: missing crcmod dependency", file=sys.stderr)
+ sys.exit(127)
_crc32_mpeg = mkPredefinedCrcFun("crc-32-mpeg")
diff --git a/test/py/test_tlv.py b/test/py/test_tlv.py
index 963f3749b33b..79f9f9d01bbb 100644
--- a/test/py/test_tlv.py
+++ b/test/py/test_tlv.py
@@ -2,11 +2,8 @@ import os
import re
import subprocess
from pathlib import Path
-from crcmod.predefined import mkPredefinedCrcFun
from .helper import skip_disabled
-_crc32_mpeg = mkPredefinedCrcFun("crc-32-mpeg")
-
import pytest
@@ -14,6 +11,9 @@ class _TLV_Testdata:
def generator(self, args, check=True):
cmd = [os.sys.executable, str(self.generator_py)] + args
res = subprocess.run(cmd, text=True)
+ if res.returncode == 127:
+ pytest.skip("test skipped due to missing host dependencies")
+
if check and res.returncode != 0:
raise RuntimeError(f"generator failed ({res.returncode}): {res.stdout}\n{res.stderr}")
return res
--
2.47.3
next reply other threads:[~2025-10-13 12:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 12:00 Ahmad Fatoum [this message]
2025-10-14 15:26 ` Jonas Rebmann
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=20251013120031.761008-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jre@pengutronix.de \
/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