mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/4] test: bthread: change comparison condition for switches vs. yields
Date: Thu, 27 Mar 2025 15:47:40 +0100	[thread overview]
Message-ID: <20250327144742.1841423-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250327144742.1841423-1-a.fatoum@pengutronix.de>

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@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
-- 
2.39.5




  parent reply	other threads:[~2025-03-27 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 14:47 [PATCH 0/4] ci: fix sandbox allyesconfig build Ahmad Fatoum
2025-03-27 14:47 ` [PATCH 1/4] sandbox: env: switch from CONFIG_DEFAULT_ENVIRONMENT_PATH to bbenv-y Ahmad Fatoum
2025-03-27 14:47 ` Ahmad Fatoum [this message]
2025-04-01  8:53   ` [PATCH 2/4] test: bthread: change comparison condition for switches vs. yields Bastian Krause
2025-04-01  9:34     ` Ahmad Fatoum
2025-04-01  9:42       ` Bastian Krause
2025-03-27 14:47 ` [PATCH 3/4] ci: pytest: rename build directories Ahmad Fatoum
2025-03-27 14:47 ` [PATCH 4/4] ci: pytest: enable console and libc allocator for allyesconfig Ahmad Fatoum
2025-03-31  7:08 ` [PATCH 0/4] ci: fix sandbox allyesconfig build Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250327144742.1841423-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox