public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v6 00/12] efi: Add a test for EFI bootmeth
@ 2024-09-26 21:59 Simon Glass
  2024-09-26 21:59 ` [PATCH v6 01/12] efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE Simon Glass
                   ` (7 more replies)
  0 siblings, 8 replies; 36+ messages in thread
From: Simon Glass @ 2024-09-26 21:59 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Heinrich Schuchardt, Tom Rini, Ilias Apalodimas, Simon Glass,
	Albert Aribaud, Bin Meng

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 few
patches to make this work:

- ANSI output from the EFI loader confusing the unit-testing checker
- Hang in sandbox virtio due to EFI probing all block devices

Other necessary fixes have been split out into two other series.

Changes in v6:
- Expand the debug messages to be more descriptive
- Drop the patch to disable sandbox virtio blk with EFI
- Add new patch to disable the sandbox virtio blk device
- Deal with sandbox CONFIG_LOGF_FUNC
- Rebase on -next
- Drop patches previously applied
- Drop mention of helloworld since it is no-longer used by this test

Changes in v5:
- Drop the Fixes tag

Changes in v4:
- Add efi_loader tag to some patches
- Split out non-EFI patches into a different series

Changes in v3:
- Drop the extra- rules since scripts/Makefile.lib takes care of it
- Add new patch to drop crt0/relocal extra- rules
- Put back the Linaro copyright accidentally removed

Changes in v2:
- Reword commit message
- Use 'Firmware vendor' instead of just 'Vendor'
- Add many new patches to resolve all the outstanding test issues

Simon Glass (12):
  efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE
  efi: arm: x86: riscv: Drop crt0/relocal extra- rules
  efi_loader: Shorten the app rules
  efi_loader: Shorten the app rules further
  efi_loader: Show the vendor in helloworld
  efi: Use the same filename for all sandbox builds
  bootstd: Add debugging for efi bootmeth
  efi_loader: Disable ANSI output for tests
  efi_loader: Add a test app
  sandbox: virtio: Disable the sandbox virtio blk device
  test: efi: boot: Set up an image suitable for EFI testing
  test: efi: boot: Add a test for the efi bootmeth

 arch/Kconfig                        |   3 +-
 arch/arm/lib/Makefile               |   8 ----
 arch/riscv/lib/Makefile             |   4 --
 arch/sandbox/dts/test.dts           |   2 +-
 arch/x86/lib/Makefile               |  16 -------
 boot/bootmeth_efi.c                 |  11 ++++-
 cmd/Kconfig                         |  14 +-----
 configs/octeontx2_95xx_defconfig    |   2 +-
 configs/octeontx2_96xx_defconfig    |   2 +-
 configs/octeontx_81xx_defconfig     |   2 +-
 configs/octeontx_83xx_defconfig     |   2 +-
 doc/develop/uefi/uefi.rst           |   2 +-
 include/efi_default_filename.h      |  24 +---------
 include/efi_loader.h                |  21 ++++++++-
 lib/efi_loader/Kconfig              |  22 +++++++++
 lib/efi_loader/Makefile             |  47 ++++++-------------
 lib/efi_loader/efi_console.c        |  26 +++++++----
 lib/efi_loader/helloworld.c         |   3 ++
 lib/efi_loader/testapp.c            |  68 ++++++++++++++++++++++++++++
 test/boot/bootdev.c                 |  18 +++++++-
 test/boot/bootflow.c                |  65 +++++++++++++++++++++++++-
 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            |  52 ++++++++++++++++++---
 25 files changed, 294 insertions(+), 124 deletions(-)
 create mode 100644 lib/efi_loader/testapp.c
 create mode 100644 test/py/tests/bootstd/flash1.img.xz

-- 
2.43.0


^ permalink raw reply	[flat|nested] 36+ messages in thread
* [PATCH v6 08/12] efi_loader: Disable ANSI output for tests
@ 2024-09-26 22:02 Simon Glass
  0 siblings, 0 replies; 36+ messages in thread
From: Simon Glass @ 2024-09-26 22:02 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Ilias Apalodimas, Heinrich Schuchardt, Simon Glass

We don't want ANSI characters written in tests since it is a pain to
check the output with ut_assert_nextline() et al.

Provide a way to tests to request that ANSI characters not be sent.

Add a proper function comment while we are here, to encourage others.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 include/efi_loader.h         | 21 ++++++++++++++++++++-
 lib/efi_loader/efi_console.c | 26 +++++++++++++++++---------
 2 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index f84852e384f..82b90ee0f1d 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -531,8 +531,27 @@ efi_status_t efi_bootmgr_delete_boot_option(u16 boot_index);
 efi_status_t efi_bootmgr_run(void *fdt);
 /* search the boot option index in BootOrder */
 bool efi_search_bootorder(u16 *bootorder, efi_uintn_t num, u32 target, u32 *index);
-/* Set up console modes */
+
+/**
+ * efi_setup_console_size() - update the mode table.
+ *
+ * By default the only mode available is 80x25. If the console has at least 50
+ * lines, enable mode 80x50. If we can query the console size and it is neither
+ * 80x25 nor 80x50, set it as an additional mode.
+ */
 void efi_setup_console_size(void);
+
+/**
+ * efi_console_set_ansi() - Set whether ANSI characters should be emitted
+ *
+ * These characters mess up tests which use ut_assert_nextline(). Call this
+ * function to tell efi_loader not to emit these characters when starting up the
+ * terminal
+ *
+ * @allow_ansi: Allow emitting ANSI characters
+ */
+void efi_console_set_ansi(bool allow_ansi);
+
 /* Set up load options from environment variable */
 efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var,
 				      u16 **load_options);
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index cea50c748aa..569fc9199bc 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -30,6 +30,17 @@ struct cout_mode {
 
 __maybe_unused static struct efi_object uart_obj;
 
+/*
+ * suppress emission of ANSI codes for use by unit tests. Leave it as 0 for the
+ * default behaviour
+ */
+static bool no_ansi;
+
+void efi_console_set_ansi(bool allow_ansi)
+{
+	no_ansi = !allow_ansi;
+}
+
 static struct cout_mode efi_cout_modes[] = {
 	/* EFI Mode 0 is 80x25 and always present */
 	{
@@ -348,13 +359,6 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)
 	return 0;
 }
 
-/**
- * efi_setup_console_size() - update the mode table.
- *
- * By default the only mode available is 80x25. If the console has at least 50
- * lines, enable mode 80x50. If we can query the console size and it is neither
- * 80x25 nor 80x50, set it as an additional mode.
- */
 void efi_setup_console_size(void)
 {
 	int rows = 25, cols = 80;
@@ -362,8 +366,12 @@ void efi_setup_console_size(void)
 
 	if (IS_ENABLED(CONFIG_VIDEO))
 		ret = query_vidconsole(&rows, &cols);
-	if (ret)
-		ret = query_console_serial(&rows, &cols);
+	if (ret) {
+		if (no_ansi)
+			ret = 0;
+		else
+			ret = query_console_serial(&rows, &cols);
+	}
 	if (ret)
 		return;
 
-- 
2.43.0


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

end of thread, other threads:[~2024-10-18 16:52 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 21:59 [PATCH v6 00/12] efi: Add a test for EFI bootmeth Simon Glass
2024-09-26 21:59 ` [PATCH v6 01/12] efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE Simon Glass
2024-09-26 21:59 ` [PATCH v6 02/12] efi: arm: x86: riscv: Drop crt0/relocal extra- rules Simon Glass
2024-09-26 21:59 ` [PATCH v6 03/12] efi_loader: Shorten the app rules Simon Glass
2024-09-26 21:59 ` [PATCH v6 04/12] efi_loader: Shorten the app rules further Simon Glass
2024-09-26 21:59 ` [PATCH v6 05/12] efi_loader: Show the vendor in helloworld Simon Glass
2024-09-27 11:59   ` Ilias Apalodimas
2024-09-27 12:33     ` Simon Glass
2024-09-26 21:59 ` [PATCH v6 06/12] efi: Use the same filename for all sandbox builds Simon Glass
2024-09-30 23:18   ` Heinrich Schuchardt
2024-10-17 23:23     ` Simon Glass
2024-10-18  0:17       ` Tom Rini
2024-10-18  3:05         ` Simon Glass
2024-10-18  3:40           ` Heinrich Schuchardt
2024-10-18 15:02             ` Simon Glass
2024-10-18 16:51               ` Heinrich Schuchardt
2024-09-26 21:59 ` [PATCH v6 07/12] bootstd: Add debugging for efi bootmeth Simon Glass
2024-09-26 21:59 ` [PATCH v6 08/12] efi_loader: Disable ANSI output for tests Simon Glass
2024-09-30 23:38   ` Heinrich Schuchardt
2024-10-01  0:24     ` Tom Rini
2024-10-01  2:34       ` Heinrich Schuchardt
2024-10-01 18:02         ` Tom Rini
2024-10-01 22:18           ` Heinrich Schuchardt
2024-10-01 23:14             ` Tom Rini
2024-10-11 22:16             ` Simon Glass
2024-10-11 22:28               ` Tom Rini
2024-10-13 19:33                 ` Simon Glass
2024-10-14  2:25                   ` Tom Rini
2024-10-14 19:13                     ` Simon Glass
2024-10-01  7:49       ` Peter Robinson
2024-10-01 14:28         ` Tom Rini
2024-10-11 22:18     ` Simon Glass
2024-10-11 22:54       ` Tom Rini
2024-10-11 23:45         ` Heinrich Schuchardt
2024-10-12  0:36           ` Tom Rini
  -- strict thread matches above, loose matches on Subject: below --
2024-09-26 22:02 Simon Glass

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