summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2023-10-10 08:54:17 -0400
committerTom Rini <[email protected]>2023-10-10 08:54:17 -0400
commit833ff23047c50e4053fb1bda21f4e2c9f6a3aa6a (patch)
tree422a1ac1688b75a6c4edcbaa2024346acbaddfb8 /test/py
parentd9bb6d779b69c2548891e568e5e2a23e1b7eedaa (diff)
parent3f876cb7c57511174d1b6a3e089443ccbaf236ec (diff)
Merge branch '2023-10-09-assorted-fixes'
- Cleanup how we pick what to launch in SPL, a few test changes, some TI K3 platform updates, top-level Makefile fixes and related cleanup, correct a problem with LMB overlap, other assorted fixes.
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/test_sleep.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/py/tests/test_sleep.py b/test/py/tests/test_sleep.py
index 392af29db22..66a57434bff 100644
--- a/test/py/tests/test_sleep.py
+++ b/test/py/tests/test_sleep.py
@@ -41,3 +41,21 @@ def test_sleep(u_boot_console):
if not u_boot_console.config.gdbserver:
# margin is hopefully enough to account for any system overhead.
assert elapsed < (sleep_time + sleep_margin)
+
[email protected]("cmd_misc")
+def test_time(u_boot_console):
+ """Test the time command, and validate that it gives approximately the
+ correct amount of command execution time."""
+
+ sleep_skip = u_boot_console.config.env.get("env__sleep_accurate", True)
+ if not sleep_skip:
+ pytest.skip("sleep is not accurate")
+
+ sleep_time = u_boot_console.config.env.get("env__sleep_time", 10)
+ sleep_margin = u_boot_console.config.env.get("env__sleep_margin", 0.25)
+ output = u_boot_console.run_command("time sleep %d" % sleep_time)
+ execute_time = float(output.split()[1])
+ assert sleep_time >= (execute_time - 0.01)
+ if not u_boot_console.config.gdbserver:
+ # margin is hopefully enough to account for any system overhead.
+ assert sleep_time < (execute_time + sleep_margin)