[U-Boot] [PATCH 1/1] test/py/tests/test_sleep.py: test time approximately

Stephen Warren swarren at wwwdotorg.org
Thu Oct 5 21:10:43 UTC 2017


On 10/05/2017 01:52 PM, Heinrich Schuchardt wrote:
> On qemu errors like
> assert 2.999650001525879 >= 3
> occur.

Can you work out why? I guess 1-999650001525879 is a really tiny amount, 
so perhaps it's OK. However, I'd like to keep the test strict if 
possible; maybe rather than:

 > +    assert elapsed >= (sleep_time - 0.25)

can we use:

 > +    assert elapsed >= (sleep_time - 0.01)

?

> According to the comment in the code the test is meant to be
> approximate. So we should accept some milliseconds less.

This test is deliberately very strict about the minimum time taken 
during sleep, and slightly sloppy about over-sleeping. That's because 
sleep should never wait too little time, but we allow a little extra 
time due to e.g. the test system being a bit busy and not noticing when 
the sleep wakes up.


More information about the U-Boot mailing list