[U-Boot] [PATCH 5/6] test/py: replace cmd_repeat.sh with Python

Stephen Warren swarren at wwwdotorg.org
Wed Nov 18 04:20:03 CET 2015


From: Stephen Warren <swarren at nvidia.com>

This moves this test into the new infra-structure, and also allows it to
work on real hardware, not just sandbox.

Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
 test/cmd_repeat.sh | 29 -----------------------------
 test/py/test_md.py | 10 ++++++++++
 2 files changed, 10 insertions(+), 29 deletions(-)
 delete mode 100755 test/cmd_repeat.sh

diff --git a/test/cmd_repeat.sh b/test/cmd_repeat.sh
deleted file mode 100755
index 990e79900f47..000000000000
--- a/test/cmd_repeat.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# Test for U-Boot cli including command repeat
-
-BASE="$(dirname $0)"
-. $BASE/common.sh
-
-run_test() {
-	./${OUTPUT_DIR}/u-boot <<END
-setenv ctrlc_ignore y
-md 0
-
-reset
-END
-}
-check_results() {
-	echo "Check results"
-
-	grep -q 00000100 ${tmp} || fail "Command did not repeat"
-}
-
-echo "Test CLI repeat"
-echo
-tmp="$(tempfile)"
-build_uboot
-run_test >${tmp}
-check_results ${tmp}
-rm ${tmp}
-echo "Test passed"
diff --git a/test/py/test_md.py b/test/py/test_md.py
index 49cdd2685234..9667fd4f2217 100644
--- a/test/py/test_md.py
+++ b/test/py/test_md.py
@@ -10,3 +10,13 @@ def test_md(uboot_console):
     uboot_console.run_command("mw " + addr + " " + val)
     response = uboot_console.run_command("md " + addr + " 10")
     assert(expected_response in response)
+
+ at pytest.mark.buildconfigspec("cmd_memory")
+def test_md_repeat(uboot_console):
+    addr_base = "%08x" % uboot_console.config.ram_base
+    words = 0x10
+    addr_repeat = "%08x" % (uboot_console.config.ram_base + (words * 4))
+    uboot_console.run_command("md %s %x" % (addr_base, words))
+    response = uboot_console.run_command("")
+    expected_response = addr_repeat + ": "
+    assert(expected_response in response)
-- 
1.9.1



More information about the U-Boot mailing list