1 # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 # SPDX-License-Identifier: GPL-2.0
8 def test_sleep(u_boot_console):
9 """Test the sleep command, and validate that it sleeps for approximately
10 the correct amount of time."""
12 if u_boot_console.config.buildconfig.get('config_cmd_misc', 'n') != 'y':
13 pytest.skip('sleep command not supported')
14 # 3s isn't too long, but is enough to cross a few second boundaries.
17 u_boot_console.run_command('sleep %d' % sleep_time)
19 elapsed = tend - tstart
20 assert elapsed >= sleep_time
21 if not u_boot_console.config.gdbserver:
22 # 0.25s margin is hopefully enough to account for any system overhead.
23 assert elapsed < (sleep_time + 0.25)