diff mbox series

[U-Boot,3/5] test/py: mmc: Add 'mmc rescan' test

Message ID 20190313164929.32753-3-marek.vasut+renesas@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show
Series [U-Boot,1/5] test/py: mmc: Factor out device selection | expand

Commit Message

Marek Vasut March 13, 2019, 4:49 p.m. UTC
Add test for 'mmc rescan' subcommand. This tests whether the
system can switch to a specific card and then rescan the card.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
---
 test/py/tests/test_mmc_rd.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Simon Glass March 19, 2019, 1:23 a.m. UTC | #1
On Thu, 14 Mar 2019 at 00:49, Marek Vasut <marek.vasut@gmail.com> wrote:
>
> Add test for 'mmc rescan' subcommand. This tests whether the
> system can switch to a specific card and then rescan the card.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  test/py/tests/test_mmc_rd.py | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini April 10, 2019, 12:20 p.m. UTC | #2
On Wed, Mar 13, 2019 at 05:49:27PM +0100, Marek Vasut wrote:

> Add test for 'mmc rescan' subcommand. This tests whether the
> system can switch to a specific card and then rescan the card.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/py/tests/test_mmc_rd.py b/test/py/tests/test_mmc_rd.py
index 1337074d3f..86a57aafe5 100644
--- a/test/py/tests/test_mmc_rd.py
+++ b/test/py/tests/test_mmc_rd.py
@@ -104,6 +104,32 @@  def test_mmc_dev(u_boot_console, env__mmc_rd_config):
     # Select MMC device
     mmc_dev(u_boot_console, is_emmc, devid, partid)
 
+@pytest.mark.buildconfigspec('cmd_mmc')
+def test_mmc_rescan(u_boot_console, env__mmc_rd_config):
+    """Test the "mmc rescan" command.
+
+    Args:
+        u_boot_console: A U-Boot console connection.
+        env__mmc_rd_config: The single MMC configuration on which
+            to run the test. See the file-level comment above for details
+            of the format.
+
+    Returns:
+        Nothing.
+    """
+
+    is_emmc = env__mmc_rd_config['is_emmc']
+    devid = env__mmc_rd_config['devid']
+    partid = env__mmc_rd_config.get('partid', 0)
+
+    # Select MMC device
+    mmc_dev(u_boot_console, is_emmc, devid, partid)
+
+    # Rescan MMC device
+    cmd = 'mmc rescan'
+    response = u_boot_console.run_command(cmd)
+    assert 'no card present' not in response
+
 @pytest.mark.buildconfigspec('cmd_mmc')
 def test_mmc_rd(u_boot_console, env__mmc_rd_config):
     """Test the "mmc read" command.