[PATCH 00/17] dm: test: Add unit tests for SPL

Simon Glass sjg at chromium.org
Sat Oct 3 17:25:17 CEST 2020


U-Boot has about 700 tests but only a handful of these target SPL. This
is partly because SPL has limited functionality and does not have a
command interface to initiate tests.

The current SPL tests are targeted at sandbox_spl and are initiated from
pytest.

With SPL tests written in C, we can check the behaviour of of-platdata
more easily, since the test can check things directly rather than printing
out information for pytest to check.

This series adds support for SPL tests written in C, targeted at the
sandbox_spl build.

It includes quite a bit of minor refactoring to get everything working.


Simon Glass (17):
  dtoc: Extract inner loop from output_node()
  dtoc: Use a namedtuple for _links
  dm: core: Expand the comment for DM_GET_DEVICE()
  dm: core: Avoid void * in the of-platdata structs
  dm: Avoid using #ifdef for CONFIG_OF_LIVE
  dm: test: Sort the Makefile
  dm: test: Update Makefile conditions
  dm: test: Make use of CONFIG_UNIT_TEST
  dm: test: Disable some tests that should not run in SPL
  dm: test: Build tests for SPL
  dm: test: Update the test runner to support of-platdata
  dm: test: Add a way to run SPL tests
  dm: test: Add a very simple of-platadata test
  Makefile: Generate a symbol file for u-boot-spl
  pytest: Collect SPL unit tests
  test: Run SPL unit tests
  Azure/GitLab/Travis: Add SPL unit tests

 .azure-pipelines.yml              |   2 +-
 .gitlab-ci.yml                    |   2 +-
 .travis.yml                       |   2 +-
 Makefile                          |   2 +-
 arch/sandbox/cpu/spl.c            |   8 +++
 arch/sandbox/cpu/start.c          |   9 +++
 arch/sandbox/include/asm/state.h  |   1 +
 common/board_r.c                  |  19 +++---
 configs/sandbox_spl_defconfig     |   2 +-
 drivers/core/Makefile             |   2 +-
 drivers/core/root.c               |  27 +++-----
 include/asm-generic/global_data.h |  13 +++-
 include/dm/of.h                   |   9 +--
 include/dm/platdata.h             |  17 ++++-
 include/dt-structs.h              |   8 ++-
 include/test/test.h               |  11 ++++
 scripts/Makefile.spl              |   8 ++-
 test/Kconfig                      |  10 +++
 test/Makefile                     |  24 ++++---
 test/dm/Makefile                  |  13 ++--
 test/dm/of_platdata.c             |  19 ++++++
 test/dm/test-main.c               |  45 +++++++------
 test/py/conftest.py               |  14 ++--
 test/py/tests/test_spl.py         |  29 +++++++++
 test/run                          |   2 +-
 tools/dtoc/dtb_platdata.py        | 103 +++++++++++++++++-------------
 26 files changed, 267 insertions(+), 134 deletions(-)
 create mode 100644 test/dm/of_platdata.c
 create mode 100644 test/py/tests/test_spl.py

-- 
2.28.0.806.g8561365e88-goog



More information about the U-Boot mailing list