[PATCH] fixup! test: py: add TLV integration tests

Jonas Rebmann jre at pengutronix.de
Tue Oct 14 08:26:35 PDT 2025


Hi Ahmad

On 2025-10-13 14:00, Ahmad Fatoum wrote:
> 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.

My patch "test: py: add TLV integration tests" intentionally only
changes the test case. I think we should separate those things.

> Cc: Jonas Rebmann <jre at pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum at 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")
>   

Could you move this change to a separate patch which is not a fixup?

> 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

And only leave this as fixup to the change on the test case?

The reason it bothers me is that I'd like TLV signature without the
integration tests to be easily backportable.

Regards,
Jonas

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



More information about the barebox mailing list