[PATCH 2/4] test: bthread: change comparison condition for switches vs. yields

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 1 02:34:11 PDT 2025


Hello Bastian,

On 4/1/25 10:53, Bastian Krause wrote:
> Hi Ahmad,
> 
> On 3/27/25 3:47 PM, Ahmad Fatoum wrote:
>> The code was written with the assumption that isolated yields from test
>> thread to main thread and back will always be at least as fast as
>> unrestricted scheduling.
>>
>> This assumption held so far, but breaks down in sandbox, because it's
>> highly influenced by the system's CPU pressure.
>>
>> Just check that we can schedule @1000Hz at least in both cases.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
>> ---
>>   test/py/test_bthread.py | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/py/test_bthread.py b/test/py/test_bthread.py
>> index 6e7b4ba5007e..84fb9f830b0c 100644
>> --- a/test/py/test_bthread.py
>> +++ b/test/py/test_bthread.py
>> @@ -20,4 +20,5 @@ def test_bthread(barebox, barebox_config):
>>       switches = int(barebox.run_check("bthread -c")[0].split()[0])
>>       yields   = int(barebox.run_check("bthread -t")[0].split()[0])
>>   -    assert yields < switches
>> +    assert yields > 1000
>> +    assert yields > 1000
> 
> I guess one of these asserts should involve "switches", right?

You guessed exactly right. I Cc'd you on the fixup.

Thanks,
Ahmad

> 
> Regards,
> Bastian
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list