Hi Petr,

On 2026-10-10T14:24:46, Petr Hodina via B4 Relay
<[email protected]> wrote:
> binman: test: Check compression of generated fit fdt images
>
> Add testFitFdtCompressed, which builds a FIT with lzma-compressed fdt
> images and checks that each embedded image.

Please finish this sentenc and also mention testFitFdtBadCompression,
since this patch adds two tests?

>
> Signed-off-by: Petr Hodina <[email protected]>
>
> tools/binman/ftest.py | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)

> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> @@ -4357,6 +4357,35 @@ class TestFunctional(unittest.TestCase):
> +        entry_args = {'of-list': 'test-fdt1 test-fdt2',
> +                      'default-dt': 'test-fdt2'}
> +        extra_indirs = [os.path.join(self._indir, TEST_FDT_SUBDIR)]
> +        data = self._DoReadFileDtb('fit/fdt_lzma.dts', entry_args=entry_args,
> +                                   extra_indirs=extra_indirs)[0]
> +        fit_data = data[len(U_BOOT_DATA):-len(U_BOOT_NODTB_DATA)]
> +        dtb = fdt.Fdt.FromData(fit_data)
> +        dtb.Scan()
> +        for seq, expected in ((1, TEST_FDT1_DATA), (2, TEST_FDT2_DATA)):
> +            fnode = dtb.GetNode('/images/fdt-%d' % seq)
> +            self.assertEqual('lzma', fnode.props['compression'].value)
> +            comp = fnode.props['data'].bytes
> +            self.assertNotEqual(expected, comp)
> +            self.assertEqual(expected, bintool.decompress(comp))

Most of this duplicates the setup in CheckFitFdt(), which already
takes a dts argument. You could add an optional decomp argument (e.g.
the bintool) to CheckFitFdt() and have _CheckFdt() run the data
through it before comparing. The compressed case would then also get
the existing checks for the description, the hash subnode and the
configurations, which this test currently skips. What do you think?

Regards,
Simon

Reply via email to