From: Simon Glass Date: Fri, 6 Mar 2026 18:12:48 +0000 (-0700) Subject: binman: test: Fix code coverage for iMX8 and cst bintool X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cab35362d7720975e7869d2bc3cc23cec73b376;p=thirdparty%2Fu-boot.git binman: test: Fix code coverage for iMX8 and cst bintool Three files are currently missing test coverage: nxp_imx8mcst, nxp_imx8mimage and cst Add test methods to cover all missing code paths, trying to reuse the same .dts files where possible. This brings all three files to 100% coverage. Signed-off-by: Simon Glass --- diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 612237d0b41..9cc1a97f95c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -7899,6 +7899,112 @@ fdt fdtmap Extract the devicetree blob from the fdtmap """Test that binman can produce an iMX8 image""" self._DoTestFile('vendor/nxp_imx8.dts') + def testNxpImx8ImageMissing(self): + """Test that binman produces an iMX8 image if mkimage is missing""" + with terminal.capture() as (_, stderr): + self._DoTestFile('vendor/nxp_imx8.dts', + force_missing_bintools='mkimage') + err = stderr.getvalue() + self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage") + + def testNxpImx8ImagePos(self): + """Test SetImagePos for iMX8 image""" + with terminal.capture() as (_, stderr): + self._DoTestFile('vendor/nxp_imx8.dts', update_dtb=True, + force_missing_bintools='mkimage') + err = stderr.getvalue() + self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage") + + def testNxpImx8mCSTNormal(self): + """Test CST signing with IVT-format input (normal auth, no unlock)""" + # Create fake IVT blob: magic(4) + padding(20) + signsize_addr(4) + # + padding(36) = 64 bytes + ivt_data = struct.pack('; nxp,loader-address = <0x10>; + + u-boot { + }; }; }; }; diff --git a/tools/binman/test/vendor/nxp_imx8_csf.dts b/tools/binman/test/vendor/nxp_imx8_csf.dts new file mode 100644 index 00000000000..148f4668bb9 --- /dev/null +++ b/tools/binman/test/vendor/nxp_imx8_csf.dts @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + nxp-imx8mcst { + args; + nxp,loader-address = <0x10>; + + blob { + filename = "imx8m-ivt.bin"; + }; + + imagename { + type = "section"; + + u-boot { + }; + }; + }; + }; +}; diff --git a/tools/binman/test/vendor/nxp_imx8_csf_fast_auth.dts b/tools/binman/test/vendor/nxp_imx8_csf_fast_auth.dts new file mode 100644 index 00000000000..af35f2569df --- /dev/null +++ b/tools/binman/test/vendor/nxp_imx8_csf_fast_auth.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + nxp-imx8mcst { + args; + nxp,loader-address = <0x10>; + nxp,fast-auth; + nxp,unlock; + + blob { + filename = "imx8m-fit.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/vendor/nxp_imx8_imagename.dts b/tools/binman/test/vendor/nxp_imx8_imagename.dts new file mode 100644 index 00000000000..58dd1ca3d5d --- /dev/null +++ b/tools/binman/test/vendor/nxp_imx8_imagename.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + nxp-imx8mimage { + args; /* TODO: Needed by mkimage etype superclass */ + nxp,boot-from = "sd"; + nxp,rom-version = <1>; + nxp,loader-address = <0x10>; + + u-boot { + }; + + imagename { + type = "section"; + + u-boot { + }; + }; + }; + }; +};