u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>
Subject: [PATCH 24/45] test: Update tests to use the skip feature
Date: Sun, 25 Sep 2022 09:02:27 -0600	[thread overview]
Message-ID: <20220925150248.2524421-25-sjg@chromium.org> (raw)
In-Reply-To: <20220925150248.2524421-1-sjg@chromium.org>

Some tests currently return 0 when they want to be skipped. Update them to
return -EAGAIN instead, so they are counted as skipped.

A few tests are in two parts, with the latter part being skipped in
certain situations. Split these into two and use the correct condition for
the second part.

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

 test/boot/bootflow.c  |  4 ++--
 test/boot/bootmeth.c  | 13 ++++++++++---
 test/boot/vbe_fixup.c |  2 +-
 test/dm/of_platdata.c |  2 +-
 test/dm/ofnode.c      | 25 +++++++++++++++----------
 5 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 1e8ea754bcd..e1e07082105 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -330,7 +330,7 @@ static int bootflow_system(struct unit_test_state *uts)
 	struct udevice *dev;
 
 	if (!IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR))
-		return 0;
+		return -EAGAIN;
 	ut_assertok(uclass_get_device_by_name(UCLASS_BOOTMETH, "efi_mgr",
 					      &dev));
 	sandbox_set_fake_efi_mgr_dev(dev, true);
@@ -395,7 +395,7 @@ BOOTSTD_TEST(bootflow_iter_disable, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
 static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts)
 {
 	if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
-		return 0;
+		return -EAGAIN;
 
 	ut_assertok(bootstd_test_drop_bootdev_order(uts));
 
diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c
index fb627313396..f2d3a5f3cc4 100644
--- a/test/boot/bootmeth.c
+++ b/test/boot/bootmeth.c
@@ -103,10 +103,17 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
 	ut_asserteq_str("efi syslinux", env_get("bootmeths"));
 	ut_assert_console_end();
 
-	/* Try with global bootmeths */
+	return 0;
+}
+BOOTSTD_TEST(bootmeth_cmd_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
+
+/* Check 'bootmeth order' command with global bootmeths */
+static int bootmeth_cmd_order_glob(struct unit_test_state *uts)
+{
 	if (!IS_ENABLED(CONFIG_BOOTMETH_GLOBAL))
-		return 0;
+		return -EAGAIN;
 
+	console_record_reset_enable();
 	ut_assertok(run_command("bootmeth order \"efi firmware0\"", 0));
 	ut_assert_console_end();
 	ut_assertok(run_command("bootmeth list", 0));
@@ -122,7 +129,7 @@ static int bootmeth_cmd_order(struct unit_test_state *uts)
 
 	return 0;
 }
-BOOTSTD_TEST(bootmeth_cmd_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
+BOOTSTD_TEST(bootmeth_cmd_order_glob, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
 
 /* Check 'bootmeths' env var */
 static int bootmeth_env(struct unit_test_state *uts)
diff --git a/test/boot/vbe_fixup.c b/test/boot/vbe_fixup.c
index 1b488e25ab6..7f0f809499a 100644
--- a/test/boot/vbe_fixup.c
+++ b/test/boot/vbe_fixup.c
@@ -26,7 +26,7 @@ static int vbe_test_fixup(struct unit_test_state *uts)
 	 * flat tree, since device tree fix-ups do not yet support live tree.
 	 */
 	if (!working_fdt)
-		return 0;
+		return -EAGAIN;
 
 	tree = oftree_from_fdt(working_fdt);
 	ut_assert(oftree_valid(tree));
diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c
index 7af798b8d35..a241c427936 100644
--- a/test/dm/of_platdata.c
+++ b/test/dm/of_platdata.c
@@ -150,7 +150,7 @@ static int dm_test_of_plat_dev(struct unit_test_state *uts)
 
 	/* Skip this test if there is no platform data */
 	if (!CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT))
-		return 0;
+		return -EAGAIN;
 
 	/* Record the indexes that are found */
 	memset(found, '\0', sizeof(found));
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 41811ec3bb5..8077affabb7 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -753,10 +753,7 @@ static int make_ofnode_fdt(struct unit_test_state *uts, void *fdt, int size,
 
 static int dm_test_ofnode_root(struct unit_test_state *uts)
 {
-	char fdt[256];
-	oftree tree;
 	ofnode node;
-	int ret;
 
 	/* Check that aliases work on the control FDT */
 	node = ofnode_get_aliases_node("ethernet3");
@@ -765,14 +762,22 @@ static int dm_test_ofnode_root(struct unit_test_state *uts)
 
 	ut_assert(!oftree_valid(oftree_null()));
 
-	ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt), 0));
-	ret = get_oftree(uts, fdt, &tree);
+	return 0;
+}
+DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT);
 
-	/* skip the rest of this test if multiple FDTs are not supported */
-	if (ret == -EOVERFLOW)
-		return 0;
+static int dm_test_ofnode_root_mult(struct unit_test_state *uts)
+{
+	char fdt[256];
+	oftree tree;
+	ofnode node;
 
-	ut_assertok(ret);
+	/* skip this test if multiple FDTs are not supported */
+	if (!IS_ENABLED(CONFIG_OFNODE_MULTI_TREE))
+		return -EAGAIN;
+
+	ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt), 0));
+	ut_assertok(get_oftree(uts, fdt, &tree));
 	ut_assert(oftree_valid(tree));
 
 	/* Make sure they don't work on this new tree */
@@ -791,7 +796,7 @@ static int dm_test_ofnode_root(struct unit_test_state *uts)
 
 	return 0;
 }
-DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT);
+DM_TEST(dm_test_ofnode_root_mult, UT_TESTF_SCAN_FDT);
 
 static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts)
 {
-- 
2.37.3.998.g577e59143f-goog


  parent reply	other threads:[~2022-09-25 15:08 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 15:02 [PATCH 00/45] vbe: Implement the full firmware flow Simon Glass
2022-09-25 15:02 ` [PATCH 01/45] Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE Simon Glass
2022-09-25 15:02 ` [PATCH 02/45] disk: Drop debug messages in part_efi Simon Glass
2022-09-26  6:11   ` Heinrich Schuchardt
2022-09-25 15:02 ` [PATCH 03/45] bloblist: Drop debugging Simon Glass
2022-09-25 15:02 ` [PATCH 04/45] rsa: Avoid warning in padding_pss_verify() Simon Glass
2022-09-26  6:23   ` Heinrich Schuchardt
2022-09-25 15:02 ` [PATCH 05/45] spl: Use binman suffix allow symbols of any SPL etype Simon Glass
2022-09-25 15:02 ` [PATCH 06/45] spl: Split up the board_init_r() function Simon Glass
2022-09-25 15:02 ` [PATCH 07/45] spl: Refactor controls for console output Simon Glass
2022-09-29 15:16   ` Tom Rini
2022-09-25 15:02 ` [PATCH 08/45] spl: Add a separate silence option for SPL Simon Glass
2022-09-25 15:02 ` [PATCH 09/45] CI: Install pyelftools for builds Simon Glass
2022-09-26  6:29   ` Heinrich Schuchardt
2022-09-28 10:20     ` Simon Glass
2022-09-29 15:05       ` Tom Rini
2022-09-29 23:55         ` Simon Glass
2022-09-30 12:56           ` Tom Rini
2022-09-30 13:28             ` Simon Glass
2022-09-25 15:02 ` [PATCH 10/45] binman: Allow obtaining a symbol value Simon Glass
2022-09-25 15:02 ` [PATCH 11/45] binman: Split out looking up a symbol into a function Simon Glass
2022-09-25 15:02 ` [PATCH 12/45] binman: Handle writing ELF symbols in the Entry class Simon Glass
2022-09-25 15:02 ` [PATCH 13/45] binman: Support writing symbols into ELF files Simon Glass
2022-09-25 15:02 ` [PATCH 14/45] dm: blk: Add udevice functions Simon Glass
2022-09-26  0:17   ` AKASHI Takahiro
2022-09-28 10:20     ` Simon Glass
2022-09-29  0:51       ` AKASHI Takahiro
2022-09-29  2:35         ` Simon Glass
2022-09-30  1:54           ` AKASHI Takahiro
2022-09-25 15:02 ` [PATCH 15/45] dm: usb: Update the test to cover reading and writing Simon Glass
2022-09-25 15:02 ` [PATCH 16/45] dm: blk: mmc: Tidy up some Makefile rules for SPL Simon Glass
2022-09-25 15:02 ` [PATCH 17/45] dm: mmc: Allow sandbox emulator to build without writes Simon Glass
2022-09-25 15:02 ` [PATCH 18/45] sandbox: Drop message about writing sandbox state Simon Glass
2022-09-26  6:31   ` Heinrich Schuchardt
2022-09-25 15:02 ` [PATCH 19/45] sandbox: Generalise SPL booting Simon Glass
2022-09-25 15:02 ` [PATCH 20/45] sandbox: Add a way to specify the sandbox executable Simon Glass
2022-09-26  6:49   ` Heinrich Schuchardt
2022-11-07 23:35     ` Simon Glass
2022-09-25 15:02 ` [PATCH 21/45] bootstd: Add a way to set up a bootflow Simon Glass
2022-09-25 15:02 ` [PATCH 22/45] image: Move comment for fit_conf_find_compat() Simon Glass
2022-09-26  6:54   ` Heinrich Schuchardt
2022-09-25 15:02 ` [PATCH 23/45] test: Report skippped tests Simon Glass
2022-09-25 15:02 ` Simon Glass [this message]
2022-09-25 15:02 ` [PATCH 25/45] test: Support tests which can only be run manually Simon Glass
2022-09-26  6:56   ` Heinrich Schuchardt
2022-09-28 10:20     ` Simon Glass
2022-09-25 15:02 ` [PATCH 26/45] image: Add the concept of a phase to FIT Simon Glass
2022-09-25 15:02 ` [PATCH 27/45] image: Allow loading a FIT config for a particular phase Simon Glass
2022-09-25 15:02 ` [PATCH 28/45] image: Correct strncpy() warning with image_set_name() Simon Glass
2022-09-25 15:02 ` [PATCH 29/45] vbe: Rename vbe_fixup to vbe_request Simon Glass
2022-09-25 15:02 ` [PATCH 30/45] vbe: Use a warning for a failed requests Simon Glass
2022-09-25 15:02 ` [PATCH 31/45] spl: Allow multiple loaders of the same type Simon Glass
2022-09-30 16:28   ` Tom Rini
2022-09-30 16:37     ` Simon Glass
2022-09-30 16:39       ` Tom Rini
2022-09-30 16:45         ` Simon Glass
2022-09-30 16:50           ` Tom Rini
2022-09-30 16:55             ` Simon Glass
2022-09-25 15:02 ` [PATCH 32/45] sandbox: Support obtaining the next phase from an image Simon Glass
2022-09-25 15:02 ` [PATCH 33/45] vbe: Support selecting operations by SPL phase Simon Glass
2022-09-25 15:02 ` [PATCH 34/45] vbe: Support reading the next SPL phase via VBE Simon Glass
2022-09-25 15:02 ` [PATCH 35/45] vbe: Move OS implementation into a separate file Simon Glass
2022-09-25 15:02 ` [PATCH 36/45] vbe: Drop the U-Boot prefix from the version Simon Glass
2022-09-25 15:02 ` [PATCH 37/45] vbe: Add Kconfig options for VPL Simon Glass
2022-09-25 15:02 ` [PATCH 38/45] vbe: Add info about the VBE device to the fwupd node Simon Glass
2022-09-25 15:02 ` [PATCH 39/45] sandbox: Add a binman image for VPL Simon Glass
2022-09-25 15:02 ` [PATCH 40/45] vbe: Correct pylint warnings in test_vbe Simon Glass
2022-09-25 15:02 ` [PATCH 41/45] vbe: Use a manual test Simon Glass
2022-09-25 15:02 ` [PATCH 42/45] vbe: Record which phases loaded using VBE Simon Glass
2022-09-25 15:02 ` [PATCH 43/45] vbe: Add docs and a test for the VBE command Simon Glass
2022-09-25 15:02 ` [PATCH 44/45] vbe: Add a subcommand to show the VBE state Simon Glass
2022-09-25 15:02 ` [PATCH 45/45] vbe: Add a test for the VBE flow into U-Boot proper Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220925150248.2524421-25-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).