mbox series

[0/4] oeqa: selftest: split and create a library

Message ID 20260105-fitimage-v1-0-e319258c4c4f@non.se.com
Headers show
Series oeqa: selftest: split and create a library | expand

Message

Louis Rannou via B4 Relay Jan. 5, 2026, 10:49 a.m. UTC
Take some generic code from the fitimage selftest to create a library
oeqa.utils.fitimage than can be reused in other tests (such as sanity).

The first commit is a fix for missing spaces and the last is adds support
for rsa4096 signatures.

The two mains commit (2nd and 3rd) are organized to make the diff
easier. The 2nd looks at every generic functions ands remove unittest
relative code. While the 3rd makes the move from selftest to utils, keeping
the same architecture.

Signed-off-by: Louis Rannou <louis.rannou@non.se.com>
---
Louis Rannou (4):
      oeqa/selftests: fitimage: fix missing spaces
      oeqa/selftests: fitimage: prepare for split
      oeqa: fitimage: split the selftest and create a generic library
      oeqa/utils: fitimage: rsa4096 signatures

 meta/lib/oeqa/selftest/cases/fitimage.py | 864 +++---------------------------
 meta/lib/oeqa/utils/fitimage.py          | 883 +++++++++++++++++++++++++++++++
 2 files changed, 961 insertions(+), 786 deletions(-)
---
base-commit: f55407185c63c895fa3c4fdf74e6e63ea9517a20
change-id: 20260105-fitimage-609bc669abca

Best regards,

Comments

Freihofer, Adrian Jan. 5, 2026, 1:31 p.m. UTC | #1
Hi Louis

Thank you for this patches.

Patch 1 and patch 4 are fine.

Regarding patches 2 and 3: I expected the series to include an
additional change that adds sanity checks or otherwise delivers a clear
functional benefit. I’m not seeing that yet—so far it looks like
refactoring only.

For example, replacing:

    self.assertIn("Signature check OK", result.output)

with something like:

    def a_function(...):
        if "Signature check OK" not in result.output:
            self.logger.error("Signature verification failed (%s)",
result.output)
            return False
        return True

    self.assertTrue(a_function(...))

seems like a net regression for tests: assertIn is a single line,
produces clear, familiar assertion failures, and includes useful type-
aware output. The new approach adds more code, a custom log message
that may be harder to scan, and an extra assertTrue(...) failure that
is less specific than the original assertion.

Would a small abstraction help here while keeping standard unittest
semantics?

    class FitImageUtils:
        def __init__(self, assertion_provider):
            self._assertion_provider = assertion_provider

        def foo(self, ...):
            ...
            self._assertion_provider.assertIn(...)

Existing tests could use FitImageUtils(self), while non-test users
could pass an object providing equivalent assertion behavior or domain-
specific checks.

So I’m asking for two things:
- Can we keep using standard test assertions (e.g., `assertIn`,
`assertEqual`, etc.)?
- Can you share the patch in this series that adds the promised sanity
checks (or clarify where the concrete benefit is)? If the refactoring
isn’t free for the core/readability, we need to weigh its cost against
the intended gains.


Regards,
Adrian



On Mon, 2026-01-05 at 11:49 +0100, Louis Rannou via B4 Relay wrote:
> [You don't often get email from
> devnull+louis.rannou.non.se.com@kernel.org. Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Take some generic code from the fitimage selftest to create a library
> oeqa.utils.fitimage than can be reused in other tests (such as
> sanity).
> 
> The first commit is a fix for missing spaces and the last is adds
> support
> for rsa4096 signatures.
> 
> The two mains commit (2nd and 3rd) are organized to make the diff
> easier. The 2nd looks at every generic functions ands remove unittest
> relative code. While the 3rd makes the move from selftest to utils,
> keeping
> the same architecture.
> 
> Signed-off-by: Louis Rannou <louis.rannou@non.se.com>
> ---
> Louis Rannou (4):
>       oeqa/selftests: fitimage: fix missing spaces
>       oeqa/selftests: fitimage: prepare for split
>       oeqa: fitimage: split the selftest and create a generic library
>       oeqa/utils: fitimage: rsa4096 signatures
> 
>  meta/lib/oeqa/selftest/cases/fitimage.py | 864 +++------------------
> ---------
>  meta/lib/oeqa/utils/fitimage.py          | 883
> +++++++++++++++++++++++++++++++
>  2 files changed, 961 insertions(+), 786 deletions(-)
> ---
> base-commit: f55407185c63c895fa3c4fdf74e6e63ea9517a20
> change-id: 20260105-fitimage-609bc669abca
> 
> Best regards,
> --
> Louis Rannou <louis.rannou@non.se.com>
>