From 4bb67cf7320d4749b42986a707d97c587b83430c Mon Sep 17 00:00:00 2001 From: Rahix Date: Thu, 15 Feb 2024 22:27:33 +0100 Subject: [PATCH] selftest: Add test for the u-boot crc32 workaround Signed-off-by: Rahix --- selftest/testmachines.py | 5 +++++ selftest/tests/test_board.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/selftest/testmachines.py b/selftest/testmachines.py index f1508d5d..0ae73466 100644 --- a/selftest/testmachines.py +++ b/selftest/testmachines.py @@ -272,6 +272,11 @@ def _init_pre_connect(self) -> Iterator: shift eval "$var=\\"$*\\"" } +function crc32() { + printf "crc32 for %s ... %s ==> " "$1" "$1" + sleep 0.2 + echo "deadb33f" +} function boot() { echo "Pretending to boot Linux..." echo "" diff --git a/selftest/tests/test_board.py b/selftest/tests/test_board.py index b57ee4a3..3b4f5ae1 100644 --- a/selftest/tests/test_board.py +++ b/selftest/tests/test_board.py @@ -59,6 +59,14 @@ def test_uboot_simple_control(tbot_context: tbot.Context) -> None: assert out == "FOO" +def test_uboot_crc32_workaround(tbot_context: tbot.Context) -> None: + with tbot_context.request(testmachines.MockhwBoardUBoot) as ub: + if ub.prompt != "=> ": + pytest.skip("Wrong U-Boot prompt for crc32 workaround test.") + ub.exec0("crc32", "0x10000008", "0x42") + assert ub.exec0("echo", "Hello World") == "Hello World\n" + + def test_linux_boot(tbot_context: tbot.Context) -> None: with tbot_context.request(testmachines.MockhwBoardLinux) as lnx: out = lnx.exec0("echo", "Hello World")