[PATCH v2 00/39] efi: Add a test for EFI bootmeth

Simon Glass sjg at chromium.org
Tue Aug 6 14:58:11 CEST 2024


The test coverage for the EFI bootmeth is incomplete since it does not
actually boot the application.

This series creates a simple test for this purpose. It includes a
surprising number patches to make this work:

- sandbox memory-mapping conflict with PCI
- the fix for that causes the mbr test to crash as it sets up pointers
  instead of addresses for its 'mmc' commands
- the mmc and read commands which cast addresses to pointers
- ANSI output from the EFI loader confusing the unit-testing checker
- bug in bootdev_next_prio() which causes an infinite loop in EFI test
- Hang in sandbox virtio due to EFI probing all block devices
- a tricky bug to do with USB keyboard and stdio
- a few other minor things

Changes in v2:
- Fix 'use' typo
- Add many new patches to resolve all the outstanding test issues

Simon Glass (39):
  nvmxip: Drop the message on probe
  nvmxip: Avoid probing on boot
  bootstd: Add UT_TESTF_CONSOLE_REC to bootflow tests
  test/py: Fix some pylint warnings in test_ut.py
  scripts: Update pylint.base
  bootstd: Create a function to reset USB
  usb: Drop old non-DM code
  log: Add a new log category for the console
  usb: Add DEV_FLAGS_DM to stdio for USB keyboard
  dm: usb: Deal with USB keyboard persisting across tests
  test: mbr: Adjust test to use lower-case hex
  test: mbr: Adjust test to drop 0x
  sandbox: Change the range used for memory-mapping tags
  sandbox: Update cpu to use logging
  sandbox: Unmap old tags
  sandbox: Add some debugging to pci_io
  sandbox: Implement reference counting for address mapping
  mmc: Use map_sysmem() with buffers in the mmc command
  read: Use map_sysmem() with buffers in the read command
  cmd: Fix memory-mapping in cmp command
  test: mbr: Unmap the buffers after use
  test: mbr: Use a constant for the block size
  test: mbr: Use RAM for the buffers
  test: mbr: Drop a duplicate test
  efi: Use puts() in cout so that console recording works
  efi_loader: Put back copyright message
  efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE
  efi_loader: Shorten the app rules
  efi_loader: Shorten the app rules further
  efi: Show the vendor in helloworld
  Revert "bootdev: avoid infinite probe loop"
  bootstd: Make bootdev_next_prio() continue after failure
  efi: Use the same filename for all sandbox builds
  bootstd: Add debugging for efi bootmeth
  efi: Disable ANSI output for tests
  efi: Add a test app
  efi: Avoid using sandbox virtio devices
  test: Set up an image suitable for EFI testing
  efi: Add a test for the efi bootmeth

 arch/arm/lib/Makefile               |   2 +-
 arch/riscv/lib/Makefile             |   2 +-
 arch/sandbox/cpu/cpu.c              |  38 ++-
 arch/sandbox/cpu/state.c            |   9 +-
 arch/sandbox/dts/test.dts           |   2 +-
 arch/sandbox/include/asm/state.h    |   3 +
 arch/sandbox/lib/pci_io.c           |   9 +-
 arch/x86/lib/Makefile               |   2 +-
 boot/bootdev-uclass.c               |  23 +-
 boot/bootmeth_efi.c                 |  11 +-
 cmd/Kconfig                         |  14 +-
 cmd/mem.c                           |  26 +-
 cmd/mmc.c                           |  15 +-
 cmd/read.c                          |  10 +-
 cmd/usb.c                           |  20 --
 common/console.c                    |  36 +++
 common/log.c                        |   1 +
 common/usb_kbd.c                    |  74 +----
 configs/octeontx2_95xx_defconfig    |   2 +-
 configs/octeontx2_96xx_defconfig    |   2 +-
 configs/octeontx_81xx_defconfig     |   2 +-
 configs/octeontx_83xx_defconfig     |   2 +-
 doc/arch/sandbox/sandbox.rst        |  21 +-
 doc/develop/uefi/uefi.rst           |   2 +-
 drivers/mtd/nvmxip/nvmxip-uclass.c  |  10 +-
 drivers/usb/Kconfig                 |   3 +-
 include/console.h                   |   8 +
 include/efi_default_filename.h      |  25 +-
 include/efi_loader.h                |  21 +-
 include/log.h                       |   2 +
 include/usb.h                       |  20 +-
 lib/efi_loader/Kconfig              |  22 ++
 lib/efi_loader/Makefile             |  47 +--
 lib/efi_loader/efi_console.c        |  28 +-
 lib/efi_loader/efi_disk.c           |  14 +-
 lib/efi_loader/helloworld.c         |   6 +
 lib/efi_loader/testapp.c            |  68 ++++
 scripts/pylint.base                 | 461 ++++++++++++++++------------
 test/boot/bootdev.c                 |  37 ++-
 test/boot/bootflow.c                | 119 +++++--
 test/boot/bootstd_common.c          |  12 +
 test/boot/bootstd_common.h          |   8 +
 test/cmd/mbr.c                      | 132 ++++----
 test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes
 test/py/tests/test_efi_fit.py       |   2 +-
 test/py/tests/test_efi_loader.py    |   2 +-
 test/py/tests/test_ut.py            | 146 +++++----
 test/test-main.c                    |  38 +++
 48 files changed, 949 insertions(+), 610 deletions(-)
 create mode 100644 lib/efi_loader/testapp.c
 create mode 100644 test/py/tests/bootstd/flash1.img.xz

-- 
2.34.1



More information about the U-Boot mailing list