diff mbox series

[1/2] oe-selftest: fitimage: allow relaxed node checks

Message ID 20260228-fit_loadables-v1-1-3027ec37930d@valla.it
State Under Review
Headers show
Series fitimage: add ability to include arbitrary loadables | expand

Commit Message

Francesco Valla Feb. 27, 2026, 11:37 p.m. UTC
Add the ability to test for the existence of a property in a FIT image
node without enforcing a specific value. This allows to ensure that
properties for which a value cannot be determined (e.g.: because they
are arch- or machine-dependent) are anyhow present.

Signed-off-by: Francesco Valla <francesco@valla.it>
---
 meta/lib/oeqa/selftest/cases/fitimage.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Adrian Freihofer March 1, 2026, 2:20 p.m. UTC | #1
Hi Francesco

Thank you for the nice patches. Also thank you for separating this
change into a separate patch to make it more obvious that this is
potentially a bit controversial.

This looks like a risky change to me. Having a variable set to None by
accident is a common error which the test should catch. Just allowing
that is probably not the right approach.

Is it really not possible to make the tests providing the correct
reference values in the dict which compared against the output?

Regards,
Adrian

On Sat, 2026-02-28 at 00:37 +0100, Francesco Valla via
lists.openembedded.org wrote:
> Add the ability to test for the existence of a property in a FIT
> image
> node without enforcing a specific value. This allows to ensure that
> properties for which a value cannot be determined (e.g.: because they
> are arch- or machine-dependent) are anyhow present.
> 
> Signed-off-by: Francesco Valla <francesco@valla.it>
> ---
>  meta/lib/oeqa/selftest/cases/fitimage.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py
> b/meta/lib/oeqa/selftest/cases/fitimage.py
> index
> 0f2d9d17dbe6a452261566a1421cc41d10809399..2aff5c84c8fa10c43ccf008859f
> db7c4958bfbe7 100644
> --- a/meta/lib/oeqa/selftest/cases/fitimage.py
> +++ b/meta/lib/oeqa/selftest/cases/fitimage.py
> @@ -209,6 +209,7 @@ class FitImageTestCase(OESelftestTestCase):
>  
>          This function recursively checks if the required dictionary
> (`req_dict`) is a subset of the found dictionary (`found_dict`).
>          It supports nested dictionaries, strings, lists, and sets as
> values.
> +        If the value of one element in the required dictionary is
> None, only the presence of the key is checked.
>  
>          Args:
>              found_dict (dict): The dictionary to search within.
> @@ -224,7 +225,7 @@ class FitImageTestCase(OESelftestTestCase):
>                  self.assertLessEqual(set(value),
> set(found_dict[key]))
>              elif isinstance(value, set):
>                  self.assertLessEqual(value, found_dict[key])
> -            else:
> +            elif value is not None:
>                  self.assertEqual(value, found_dict[key])
>  
>      def _check_its_file(self, bb_vars, its_file_path):
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#232120):
> https://lists.openembedded.org/g/openembedded-core/message/232120
> Mute This Topic: https://lists.openembedded.org/mt/118051540/4454582
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/openembedded-core/unsub [
> adrian.freihofer@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py
index 0f2d9d17dbe6a452261566a1421cc41d10809399..2aff5c84c8fa10c43ccf008859fdb7c4958bfbe7 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -209,6 +209,7 @@  class FitImageTestCase(OESelftestTestCase):
 
         This function recursively checks if the required dictionary (`req_dict`) is a subset of the found dictionary (`found_dict`).
         It supports nested dictionaries, strings, lists, and sets as values.
+        If the value of one element in the required dictionary is None, only the presence of the key is checked.
 
         Args:
             found_dict (dict): The dictionary to search within.
@@ -224,7 +225,7 @@  class FitImageTestCase(OESelftestTestCase):
                 self.assertLessEqual(set(value), set(found_dict[key]))
             elif isinstance(value, set):
                 self.assertLessEqual(value, found_dict[key])
-            else:
+            elif value is not None:
                 self.assertEqual(value, found_dict[key])
 
     def _check_its_file(self, bb_vars, its_file_path):