All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] test/py: mmc: Factor out device selection
@ 2019-03-13 16:49 Marek Vasut
  2019-03-13 16:49 ` [U-Boot] [PATCH 2/5] test/py: mmc: Add 'mmc dev' test Marek Vasut
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Marek Vasut @ 2019-03-13 16:49 UTC (permalink / raw)
  To: u-boot

Factor out the 'mmc dev' call so it can be recycled by other tests.

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 | 38 +++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/test/py/tests/test_mmc_rd.py b/test/py/tests/test_mmc_rd.py
index a13bc0a5f6..40ae1a8459 100644
--- a/test/py/tests/test_mmc_rd.py
+++ b/test/py/tests/test_mmc_rd.py
@@ -57,6 +57,32 @@ env__mmc_rd_configs = (
 )
 """
 
+def mmc_dev(u_boot_console, is_emmc, devid, partid):
+    """Run the "mmc dev" command.
+
+    Args:
+        u_boot_console: A U-Boot console connection.
+        is_emmc: Whether the device is eMMC
+        devid: Device ID
+        partid: Partition ID
+
+    Returns:
+        Nothing.
+    """
+
+    # Select MMC device
+    cmd = 'mmc dev %d' % devid
+    if is_emmc:
+        cmd += ' %d' % partid
+    response = u_boot_console.run_command(cmd)
+    assert 'no card present' not in response
+    if is_emmc:
+        partid_response = '(part %d)' % partid
+    else:
+        partid_response = ''
+    good_response = 'mmc%d%s is current device' % (devid, partid_response)
+    assert good_response in response
+
 @pytest.mark.buildconfigspec('cmd_mmc')
 def test_mmc_rd(u_boot_console, env__mmc_rd_config):
     """Test the "mmc read" command.
@@ -86,17 +112,7 @@ def test_mmc_rd(u_boot_console, env__mmc_rd_config):
     addr = '0x%08x' % ram_base
 
     # Select MMC device
-    cmd = 'mmc dev %d' % devid
-    if is_emmc:
-        cmd += ' %d' % partid
-    response = u_boot_console.run_command(cmd)
-    assert 'no card present' not in response
-    if is_emmc:
-        partid_response = '(part %d)' % partid
-    else:
-        partid_response = ''
-    good_response = 'mmc%d%s is current device' % (devid, partid_response)
-    assert good_response in response
+    mmc_dev(u_boot_console, is_emmc, devid, partid)
 
     # Clear target RAM
     if expected_crc32:
-- 
2.20.1

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

end of thread, other threads:[~2019-04-10 12:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 16:49 [U-Boot] [PATCH 1/5] test/py: mmc: Factor out device selection Marek Vasut
2019-03-13 16:49 ` [U-Boot] [PATCH 2/5] test/py: mmc: Add 'mmc dev' test Marek Vasut
2019-03-19  1:23   ` Simon Glass
2019-04-10 12:20   ` [U-Boot] [U-Boot,2/5] " Tom Rini
2019-03-13 16:49 ` [U-Boot] [PATCH 3/5] test/py: mmc: Add 'mmc rescan' test Marek Vasut
2019-03-19  1:23   ` Simon Glass
2019-04-10 12:20   ` [U-Boot] [U-Boot,3/5] " Tom Rini
2019-03-13 16:49 ` [U-Boot] [PATCH 4/5] test/py: mmc: Add 'mmc info' test Marek Vasut
2019-03-19  1:23   ` Simon Glass
2019-04-10 12:20   ` [U-Boot] [U-Boot,4/5] " Tom Rini
2019-03-13 16:49 ` [U-Boot] [PATCH 5/5] test/py: mmc: Add 'mmc read' performance check Marek Vasut
2019-03-19  1:23   ` Simon Glass
2019-04-10 12:20   ` [U-Boot] [U-Boot, " Tom Rini
2019-03-19  1:23 ` [U-Boot] [PATCH 1/5] test/py: mmc: Factor out device selection Simon Glass
2019-04-10 12:20 ` [U-Boot] [U-Boot, " Tom Rini

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.