All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: U-Boot Custodians <u-boot-custodians@lists.denx.de>,
	Simon Glass <sjg@chromium.org>
Subject: [PATCH v2 53/71] sandbox: Allow SPI flash bootdevs to be disabled for tests
Date: Sat,  7 Jan 2023 19:50:29 -0700	[thread overview]
Message-ID: <20230108025047.522240-54-sjg@chromium.org> (raw)
In-Reply-To: <20230108025047.522240-1-sjg@chromium.org>

Most tests don't want these and they can create a lot of noise. Add a way
to disable them. Use that in tests, with a flag provided to enable them
for tests that need this feature.

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

(no changes since v1)

 arch/sandbox/cpu/state.c         | 14 ++++++++++++++
 arch/sandbox/include/asm/state.h |  1 +
 arch/sandbox/include/asm/test.h  | 14 ++++++++++++++
 include/test/test.h              | 19 +++++++++++++++++++
 test/test-main.c                 |  1 +
 5 files changed, 49 insertions(+)

diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index 76e65741424..4105fd5366e 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -460,6 +460,20 @@ bool sandbox_eth_enabled(void)
 	return !state->disable_eth;
 }
 
+void sandbox_sf_set_enable_bootdevs(bool enable)
+{
+	struct sandbox_state *state = state_get_current();
+
+	state->disable_sf_bootdevs = !enable;
+}
+
+bool sandbox_sf_bootdev_enabled(void)
+{
+	struct sandbox_state *state = state_get_current();
+
+	return !state->disable_sf_bootdevs;
+}
+
 int state_init(void)
 {
 	state = &main_state;
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index f125fb87af7..59a20595f51 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -97,6 +97,7 @@ struct sandbox_state {
 	bool handle_signals;		/* Handle signals within sandbox */
 	bool autoboot_keyed;		/* Use keyed-autoboot feature */
 	bool disable_eth;		/* Disable Ethernet devices */
+	bool disable_sf_bootdevs;	/* Don't bind SPI flash bootdevs */
 
 	/* Pointer to information for each SPI bus/cs */
 	struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 1c522e38f3d..4853dc948f3 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -360,4 +360,18 @@ void sandbox_set_eth_enable(bool enable);
  */
 bool sandbox_eth_enabled(void);
 
+/**
+ * sandbox_sf_bootdev_enabled() - Check if SPI flash bootdevs should be bound
+ *
+ * Returns: true if sandbox should bind bootdevs for SPI flash, false if not
+ */
+bool sandbox_sf_bootdev_enabled(void);
+
+/**
+ * sandbox_sf_set_enable_bootdevs() - Enable / disable the SPI flash bootdevs
+ *
+ * @enable: true to bind the SPI flash bootdevs, false to skip
+ */
+void sandbox_sf_set_enable_bootdevs(bool enable);
+
 #endif
diff --git a/include/test/test.h b/include/test/test.h
index 752897cf06f..838e3ce8a8f 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -72,6 +72,7 @@ enum {
 	 */
 	UT_TESTF_MANUAL		= BIT(8),
 	UT_TESTF_ETH_BOOTDEV	= BIT(9),	/* enable Ethernet bootdevs */
+	UT_TESTF_SF_BOOTDEV	= BIT(10),	/* enable SPI flash bootdevs */
 };
 
 /**
@@ -222,4 +223,22 @@ static inline bool test_eth_bootdev_enabled(void)
 	return enabled;
 }
 
+/* Allow SPI flash bootdev to be ignored for testing purposes */
+static inline bool test_sf_bootdev_enabled(void)
+{
+	bool enabled = true;
+
+#ifdef CONFIG_SANDBOX
+	enabled = sandbox_sf_bootdev_enabled();
+#endif
+	return enabled;
+}
+
+static inline void test_sf_set_enable_bootdevs(bool enable)
+{
+#ifdef CONFIG_SANDBOX
+	sandbox_sf_set_enable_bootdevs(enable);
+#endif
+}
+
 #endif /* __TEST_TEST_H */
diff --git a/test/test-main.c b/test/test-main.c
index 9d0f6643d5e..ea959f4e859 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -309,6 +309,7 @@ static int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
 		 * only set this if we know the ethernet uclass will be created
 		 */
 		eth_set_enable_bootdevs(test->flags & UT_TESTF_ETH_BOOTDEV);
+		test_sf_set_enable_bootdevs(test->flags & UT_TESTF_SF_BOOTDEV);
 		ut_assertok(dm_extended_scan(false));
 	}
 
-- 
2.39.0.314.g84b9a713c41-goog


  parent reply	other threads:[~2023-01-08  3:07 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-08  2:49 [PATCH v2 00/71] bootstd: Allow migration from distro_bootcmd scripts Simon Glass
2023-01-08  2:49 ` [PATCH v2 01/71] dm: core: Correct ordering of uclasses IDs Simon Glass
2023-01-08  2:49 ` [PATCH v2 02/71] dm: core: Support sorting devices with dm tree Simon Glass
2023-01-08  2:49 ` [PATCH v2 03/71] dm: test: Correct assertion in dm_test_part() Simon Glass
2023-01-08  2:49 ` [PATCH v2 04/71] lib: Add a function to split a string into substrings Simon Glass
2023-01-08  2:49 ` [PATCH v2 05/71] bootstd: Remove special-case code for boot_targets Simon Glass
2023-01-08  2:49 ` [PATCH v2 06/71] bootstd: Simplify locating existing bootdevs Simon Glass
2023-01-08  2:49 ` [PATCH v2 07/71] test: Fix the help for the ut command Simon Glass
2023-01-08  2:49 ` [PATCH v2 08/71] test: Drop duplicate restore of DM state Simon Glass
2023-01-08  2:49 ` [PATCH v2 09/71] sandbox: mmc: Start off with a zeroed file Simon Glass
2023-01-08  2:49 ` [PATCH v2 10/71] vbe: Avoid a build failure when bloblist is not enabled Simon Glass
2023-01-08  2:49 ` [PATCH v2 11/71] vbe: sandbox: Drop VBE node in chosen Simon Glass
2023-01-08  2:49 ` [PATCH v2 12/71] dm: part: Update test to use mmc2 Simon Glass
2023-01-08  2:49 ` [PATCH v2 13/71] dm: test: Correct ordering of DM setup Simon Glass
2023-01-08  2:49 ` [PATCH v2 14/71] ide: Drop non-DM code for BLK Simon Glass
2023-01-08  2:49 ` [PATCH v2 15/71] dm: mmc: Use bootdev_setup_sibling_blk() Simon Glass
2023-01-08  2:49 ` [PATCH v2 16/71] bootstd: Add a default method to get bootflows Simon Glass
2023-01-08  2:49 ` [PATCH v2 17/71] sandbox: Allow ethernet to be disabled at runtime Simon Glass
2023-01-08  2:49 ` [PATCH v2 18/71] sandbox: Allow ethernet bootdevs to be disabled for tests Simon Glass
2023-01-08  2:49 ` [PATCH v2 19/71] sandbox: Enable the Ethernet bootdev Simon Glass
2023-01-08  2:49 ` [PATCH v2 20/71] lib: Support printing an error string Simon Glass
2023-01-08  2:49 ` [PATCH v2 21/71] event: Correct duplicate log message in event_notify() Simon Glass
2023-01-08  2:49 ` [PATCH v2 22/71] efi: Improve logging in efi_disk Simon Glass
2023-01-13 20:35   ` Heinrich Schuchardt
2023-01-13 20:40     ` Tom Rini
2023-01-13 20:49       ` Heinrich Schuchardt
2023-01-13 22:40       ` Simon Glass
2023-01-13 22:52         ` Heinrich Schuchardt
2023-01-08  2:49 ` [PATCH v2 23/71] bootstd: Add the concept of a bootdev hunter Simon Glass
2023-01-08  2:50 ` [PATCH v2 24/71] bootstd: Support running bootdev hunters Simon Glass
2023-01-08  2:50 ` [PATCH v2 25/71] dm: usb: Drop some dead code Simon Glass
2023-01-08  2:50 ` [PATCH v2 26/71] dm: usb: Mark the device name as alloced when binding Simon Glass
2023-01-08  2:50 ` [PATCH v2 27/71] test: Add a generic function to skip delays Simon Glass
2023-01-08  2:50 ` [PATCH v2 28/71] bootstd: Add a USB hunter Simon Glass
2023-01-08  2:50 ` [PATCH v2 29/71] bootstd: Add an MMC hunter Simon Glass
2023-01-08  2:50 ` [PATCH v2 30/71] net: Add a function to run dhcp Simon Glass
2023-01-10 17:03   ` Ramon Fried
2023-01-08  2:50 ` [PATCH v2 31/71] bootstd: Add a hunter for ethernet Simon Glass
2023-01-08  2:50 ` [PATCH v2 32/71] part: Add a function to find the first bootable partition Simon Glass
2023-01-08  2:50 ` [PATCH v2 33/71] bootstd: Only scan bootable partitions Simon Glass
2023-01-08  2:50 ` [PATCH v2 34/71] scsi: Correct allocation of block-device name Simon Glass
2023-01-08  2:50 ` [PATCH v2 35/71] scsi: Remove all children of SCSI devices before rescanning Simon Glass
2023-01-08  2:50 ` [PATCH v2 36/71] bootstd: Add a SCSI bootdev Simon Glass
2023-01-08  2:50 ` [PATCH v2 37/71] bootstd: Add an IDE bootdev Simon Glass
2023-01-08  2:50 ` [PATCH v2 38/71] bootstd: Add an NVMe bootdev Simon Glass
2023-01-08  2:50 ` [PATCH v2 39/71] virtio: Avoid repeating a long expression Simon Glass
2023-01-08  2:50 ` [PATCH v2 40/71] virtio: Fix returning -ENODEV Simon Glass
2023-01-08  2:50 ` [PATCH v2 41/71] virtio: Avoid strange behaviour on removal Simon Glass
2023-01-08  2:50 ` [PATCH v2 42/71] virtio: Add a block device Simon Glass
2023-01-08  2:50 ` [PATCH v2 43/71] bootstd: Add a virtio bootdev Simon Glass
2023-01-08  2:50 ` [PATCH v2 44/71] ata: Don't try to use non-existent ports Simon Glass
2023-01-08  2:50 ` [PATCH v2 45/71] bootstd: Rename bootdev checkers Simon Glass
2023-01-08  2:50 ` [PATCH v2 46/71] bootstd: Allow reading an EFI file from the network Simon Glass
2023-01-08  2:50 ` [PATCH v2 47/71] bootstd: Include the device tree in the bootflow Simon Glass
2023-01-08  2:50 ` [PATCH v2 48/71] bootstd: Support reading the device tree with EFI Simon Glass
2023-01-08 10:25   ` Mark Kettenis
2023-01-13 18:00     ` Simon Glass
2023-01-08  2:50 ` [PATCH v2 49/71] bootstd: Set the distro_bootpart env var with scripts Simon Glass
2023-01-08  2:50 ` [PATCH v2 50/71] bootstd: Update docs on bootmeth_try_file() for sandbox Simon Glass
2023-01-08  2:50 ` [PATCH v2 51/71] bootstd: Move label parsing into its own function Simon Glass
2023-01-08  2:50 ` [PATCH v2 52/71] bootstd: Add a new bootmeth method to set the bootflow Simon Glass
2023-01-08  2:50 ` Simon Glass [this message]
2023-01-08  2:50 ` [PATCH v2 54/71] bootstd: Add a SPI flash bootdev Simon Glass
2023-01-08  2:50 ` [PATCH v2 55/71] bootstd: Support reading a script from network or SPI flash Simon Glass
2023-01-08  2:50 ` [PATCH v2 56/71] bootstd: Treat DHCP and PXE as bootdev labels Simon Glass
2023-01-08  2:50 ` [PATCH v2 57/71] bootstd: Use hunters when scanning for bootflows Simon Glass
2023-01-08  2:50 ` [PATCH v2 58/71] bootstd: Allow hunting for bootdevs of a given priority Simon Glass
2023-01-08  2:50 ` [PATCH v2 59/71] bootstd: Add a new pre-scan priority for bootdevs Simon Glass
2023-01-08  2:50 ` [PATCH v2 60/71] bootstd: Allow hunting for a bootdev by label Simon Glass
2023-01-08  2:50 ` [PATCH v2 61/71] bootstd: Allow iterating to the next label in a list Simon Glass
2023-01-08  2:50 ` [PATCH v2 63/71] extension: Refactor to allow non-command usage Simon Glass
2023-01-08  2:50 ` [PATCH v2 64/71] bootstd: Add a hunter for the extension feature Simon Glass
2023-01-08  2:50 ` [PATCH v2 65/71] bootstd: Switch bootdev scanning to use labels Simon Glass
2023-01-08  2:50 ` [PATCH v2 66/71] bootstd: Allow scanning a single bootdev label Simon Glass
2023-01-08  2:50 ` [PATCH v2 67/71] bootstd: Drop the old bootflow_scan_first() Simon Glass
2023-01-08  2:50 ` [PATCH v2 68/71] bootstd: Record the bootdevs used during scanning Simon Glass
2023-01-08  2:50 ` [PATCH v2 69/71] bootstd: Add a little more logging of bootflows Simon Glass
2023-01-08  2:50 ` [PATCH v2 70/71] bootstd: Update documentation for new features Simon Glass
2023-01-08  2:50 ` [PATCH v2 71/71] rockchip: Convert rockpro64-rk3399 to use standard boot Simon Glass
2023-01-16  9:54   ` Kever Yang
2023-01-13 19:54 ` [PATCH v2 00/71] bootstd: Allow migration from distro_bootcmd scripts Heinrich Schuchardt
2023-01-13 20:32   ` Mark Kettenis
2023-01-13 21:05     ` Simon Glass
2023-01-14  1:58       ` Peter Robinson
2023-01-13 20:47   ` Tom Rini
2023-01-17 13:57 ` Tom Rini
2023-01-17 16:07   ` 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=20230108025047.522240-54-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot-custodians@lists.denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.