public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 00/26] test: spl: Test some load methods
@ 2023-10-12  1:56 Sean Anderson
  2023-10-12  1:56 ` [PATCH 01/26] spl: legacy: Fix referencing _image_binary_end Sean Anderson
                   ` (27 more replies)
  0 siblings, 28 replies; 83+ messages in thread
From: Sean Anderson @ 2023-10-12  1:56 UTC (permalink / raw)
  To: u-boot, Tom Rini
  Cc: Heinrich Schuchardt, Harald Seiler, Simon Glass, Sean Anderson,
	uboot-imx, Anatolij Gustschin, Fabio Estevam, Fabio Estevam,
	Heiko Schocher, Jaehoon Chung, Jagan Teki, Joe Hershberger,
	Marek Vasut, Mayuresh Chitale, Michael Trimarchi, Nitin Garg,
	Peng Fan, Ramon Fried, Roger Quadros, Stefano Babic, Vignesh R,
	Ye Li

This series adds some tests for various SPL load methods, with the intent of
helping debug v6 of [1]. With that in mind, notable omissions include NAND and
ROMAPI, which both lack sandbox implementations, and OS_BOOT, which I have
deferred due to its complexity. Semihosting is also omitted, but I think we can
test that with qemu.

In order to test all of these methods, we must first generate suitable images,
possibly on filesystems. While other tests have historically generated these
images using external tools (e.g. mkimage, mkfs, etc.), I have chosen to
generate them on the fly. This is for a few reasons:

- By removing external dependencies on pytest to create certain files, the tests
  become self-contained. This makes them easier to iterate on and debug.
- By generating tests at runtime, we can dynamically vary the content. This
  helps detect test failures, as even if tests are loaded to the same location,
  the expected content will be different.
- We are not testing the image parsers themselves (e.g. spl_load_simple_fit or
  fs_read) but rather the load methods (e.g. spl_mmc_load_image). It is
  unnecessary to exercise full functionality or generate 100% correct images.
- By reducing functionality to only what is necessary, the complexity of various
  formats can often be greatly reduced.

This series depends on [2-3], which are small fixes identified through this
patch set. The organization of patches in this series is as follows:

- General fixes for bugs which are unlikely to be triggered outside of this
  series
- Changes to IMX8 container images to facilitate testing
- General prep. work, particularly regarding linker issues
- The tests themselves

Mostly-passing CI at [4]; I have since fixed the typo/missing cast.

[1] https://lore.kernel.org/all/20230731224304.111081-1-sean.anderson@seco.com/
[2] https://lore.kernel.org/all/20230930204246.515254-1-seanga2@gmail.com/
[3] https://lore.kernel.org/all/20231008014748.1987840-1-seanga2@gmail.com/
[4] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18091


Sean Anderson (26):
  spl: legacy: Fix referencing _image_binary_end
  spl: nor: Don't allocate header on stack
  spl: fit: Fix entry point for SPL_LOAD_FIT_FULL
  arm: imx: Fix i.MX8 container load address
  arm: imx: Add newlines after error messages
  arm: imx: Add function to validate i.MX8 containers
  arm: imx: Check header before calling spl_load_imx_container
  Move i.MX8 container image loading support to common/spl
  spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same time
  lib: acpi: Fix linking SPL when ACPIGEN is enabled
  fs: ext4: Fix building ext4 in SPL if write is enabled
  fs: Compile in sandbox filesystem in SPL if it is enabled
  net: Fix compiling SPL when fastboot is enabled
  net: bootp: Move port numbers to header
  net: bootp: Fall back to BOOTP from DHCP when unit testing
  spl: Don't cache devices when UNIT_TEST is enabled
  spl: Use map_sysmem where appropriate
  test: spl: Split tests up and use some configs
  test: spl: Fix spl_test_load not failing if fname doesn't exist
  test: spl: Add functions to create images
  test: spl: Add functions to create filesystems
  test: spl: Add a test for spl_blk_load_image
  test: spl: Add a test for the MMC load method
  test: spl: Add a test for the NET load method
  test: spl: Add a test for the NOR load method
  test: spl: Add a test for the SPI load method

 .azure-pipelines.yml                          |   4 +
 .gitlab-ci.yml                                |   7 +
 MAINTAINERS                                   |   2 +
 arch/arm/include/asm/mach-imx/ahab.h          |   2 +-
 arch/arm/mach-imx/Kconfig                     |  13 -
 arch/arm/mach-imx/Makefile                    |   2 +-
 arch/arm/mach-imx/cmd_dek.c                   |   4 +-
 arch/arm/mach-imx/ele_ahab.c                  |   4 +-
 arch/arm/mach-imx/image-container.c           |   4 +-
 arch/arm/mach-imx/imx8/ahab.c                 |   4 +-
 arch/arm/mach-imx/spl_imx_romapi.c            |   8 +-
 arch/sandbox/cpu/spl.c                        |   3 +
 arch/sandbox/cpu/start.c                      |   9 +-
 arch/sandbox/cpu/u-boot-spl.lds               |   2 +
 arch/sandbox/include/asm/spl.h                |   3 +
 common/spl/Kconfig                            |  15 +
 common/spl/Makefile                           |   1 +
 common/spl/spl.c                              |   4 +-
 common/spl/spl_blk_fs.c                       |   6 +-
 common/spl/spl_ext.c                          |   4 +-
 common/spl/spl_fat.c                          |  13 +-
 common/spl/spl_fit.c                          |  40 +-
 .../spl/spl_imx_container.c                   |  12 +-
 common/spl/spl_legacy.c                       |   8 +-
 common/spl/spl_mmc.c                          |  11 +-
 common/spl/spl_nand.c                         |   4 +-
 common/spl/spl_net.c                          |  10 +-
 common/spl/spl_nor.c                          |  18 +-
 common/spl/spl_spi.c                          |  18 +-
 configs/deneb_defconfig                       |   2 +
 configs/giedi_defconfig                       |   2 +
 configs/imx8qm_mek_defconfig                  |   2 +
 configs/imx8qxp_mek_defconfig                 |   2 +
 configs/sandbox_noinst_defconfig              |  31 +-
 configs/sandbox_spl_defconfig                 |   8 +
 configs/sandbox_vpl_defconfig                 |   1 +
 drivers/core/Makefile                         |   1 +
 drivers/core/root.c                           |   2 +-
 drivers/i2c/Makefile                          |   2 +-
 drivers/i2c/i2c-emul-uclass.c                 |   2 +-
 drivers/serial/sandbox.c                      |   2 +-
 drivers/sysreset/sysreset_sandbox.c           |   2 +-
 drivers/usb/gadget/f_sdp.c                    |   4 +-
 dts/Kconfig                                   |   8 +-
 fs/Makefile                                   |   1 +
 include/configs/sandbox.h                     |   3 +
 include/ext4fs.h                              |   1 +
 include/ext_common.h                          |  14 +
 .../image.h => include/imx_container.h        |   9 +
 include/spl.h                                 |  14 +
 include/test/spl.h                            | 155 ++++
 lib/Kconfig                                   |   6 +
 lib/Makefile                                  |   1 +
 net/Makefile                                  |   4 +-
 net/bootp.c                                   |   9 +-
 net/bootp.h                                   |   3 +
 net/net.c                                     |   4 +-
 test/Kconfig                                  |   1 +
 test/Makefile                                 |   5 +-
 test/image/Kconfig                            |  50 ++
 test/image/Makefile                           |   7 +-
 test/image/spl_load.c                         | 693 ++++++++++++++++--
 test/image/spl_load_fs.c                      | 423 +++++++++++
 test/image/spl_load_net.c                     | 252 +++++++
 test/image/spl_load_nor.c                     |  39 +
 test/image/spl_load_os.c                      |  76 ++
 test/image/spl_load_spi.c                     |  41 ++
 test/py/tests/test_spl.py                     |  10 +
 test/test-main.c                              |   2 +-
 69 files changed, 1966 insertions(+), 163 deletions(-)
 rename arch/arm/mach-imx/parse-container.c => common/spl/spl_imx_container.c (92%)
 rename arch/arm/include/asm/mach-imx/image.h => include/imx_container.h (82%)
 create mode 100644 include/test/spl.h
 create mode 100644 test/image/Kconfig
 create mode 100644 test/image/spl_load_fs.c
 create mode 100644 test/image/spl_load_net.c
 create mode 100644 test/image/spl_load_nor.c
 create mode 100644 test/image/spl_load_os.c
 create mode 100644 test/image/spl_load_spi.c

-- 
2.37.1


^ permalink raw reply	[flat|nested] 83+ messages in thread

end of thread, other threads:[~2023-10-15  8:25 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12  1:56 [PATCH 00/26] test: spl: Test some load methods Sean Anderson
2023-10-12  1:56 ` [PATCH 01/26] spl: legacy: Fix referencing _image_binary_end Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:30     ` Sean Anderson
2023-10-12 15:28       ` Simon Glass
2023-10-12  1:56 ` [PATCH 02/26] spl: nor: Don't allocate header on stack Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  7:26     ` Michael Nazzareno Trimarchi
2023-10-12  1:56 ` [PATCH 03/26] spl: fit: Fix entry point for SPL_LOAD_FIT_FULL Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:28     ` Sean Anderson
2023-10-12 15:20       ` Tom Rini
2023-10-12 15:28       ` Simon Glass
2023-10-12  1:56 ` [PATCH 04/26] arm: imx: Fix i.MX8 container load address Sean Anderson
2023-10-12  1:56 ` [PATCH 05/26] arm: imx: Add newlines after error messages Sean Anderson
2023-10-12  7:33   ` Heinrich Schuchardt
2023-10-12  1:56 ` [PATCH 06/26] arm: imx: Add function to validate i.MX8 containers Sean Anderson
2023-10-12  1:56 ` [PATCH 07/26] arm: imx: Check header before calling spl_load_imx_container Sean Anderson
2023-10-12  7:44   ` Heinrich Schuchardt
2023-10-13  0:48     ` Sean Anderson
2023-10-12 16:40   ` Tom Rini
2023-10-13  1:39     ` Sean Anderson
2023-10-13 12:55       ` Tom Rini
2023-10-12  1:56 ` [PATCH 08/26] Move i.MX8 container image loading support to common/spl Sean Anderson
2023-10-12  1:56 ` [PATCH 09/26] spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same time Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:22     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 10/26] lib: acpi: Fix linking SPL when ACPIGEN is enabled Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:56 ` [PATCH 11/26] fs: ext4: Fix building ext4 in SPL if write " Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:56 ` [PATCH 12/26] fs: Compile in sandbox filesystem in SPL if it " Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  6:39   ` Heinrich Schuchardt
2023-10-12 14:15     ` Sean Anderson
2023-10-12 14:50       ` Tom Rini
2023-10-12 14:52       ` Tom Rini
2023-10-12  1:56 ` [PATCH 13/26] net: Fix compiling SPL when fastboot " Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  6:52   ` Heinrich Schuchardt
2023-10-12 14:16     ` Sean Anderson
2023-10-12 14:52   ` Tom Rini
2023-10-12  1:56 ` [PATCH 14/26] net: bootp: Move port numbers to header Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  6:53   ` Heinrich Schuchardt
2023-10-12  1:56 ` [PATCH 15/26] net: bootp: Fall back to BOOTP from DHCP when unit testing Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  7:16   ` Heinrich Schuchardt
2023-10-12 14:18     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 16/26] spl: Don't cache devices when UNIT_TEST is enabled Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:18     ` Sean Anderson
2023-10-12  7:23   ` Heinrich Schuchardt
2023-10-12 14:19     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 17/26] spl: Use map_sysmem where appropriate Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:56 ` [PATCH 18/26] test: spl: Split tests up and use some configs Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:56 ` [PATCH 19/26] test: spl: Fix spl_test_load not failing if fname doesn't exist Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:56 ` [PATCH 20/26] test: spl: Add functions to create images Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-13 19:44   ` [SPAM] " Xavier Drudis Ferran
2023-10-14 14:37     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 21/26] test: spl: Add functions to create filesystems Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:11     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 22/26] test: spl: Add a test for spl_blk_load_image Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:56 ` [PATCH 23/26] test: spl: Add a test for the MMC load method Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:12     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 24/26] test: spl: Add a test for the NET " Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:11     ` Sean Anderson
2023-10-12  1:56 ` [PATCH 25/26] test: spl: Add a test for the NOR " Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  4:16     ` Sean Anderson
2023-10-12 15:28       ` Simon Glass
2023-10-12  1:56 ` [PATCH 26/26] test: spl: Add a test for the SPI " Sean Anderson
2023-10-12  3:41   ` Simon Glass
2023-10-12  1:59 ` [PATCH 00/26] test: spl: Test some load methods Sean Anderson
2023-10-12  3:41 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox