Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing/infra/emulator.py: add host load info in run log
@ 2024-07-28 15:46 Julien Olivain
  2024-07-28 19:51 ` Thomas Petazzoni via buildroot
  2024-09-01 14:49 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2024-07-28 15:46 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, Ricardo Martincoski

Runtime tests running on test runners are subject to a high
variability in term of performance and timing. Most or the runtime
test commands are executed with a timeout, in pexpect.

Slow or very loaded test runners can use the timeout_multiplier to
globally increase those timeouts.

Some runtime test commands sometimes needs to poll or query a state,
rather than having purely sequential actions. It is sometimes hard to
know, from the test writer point of view, the maximum timeout to set, or
if a retry logic is needed.

In order to help debugging runtime tests failing due very slow
execution, this commit adds extra information on the host test runner
about its load in the run log. Relevant information are: number of
cpus, the load average at the moment the emulator is started and the
current timeout_multiplier.

Note: this change was discussed in:
https://lists.buildroot.org/pipermail/buildroot/2024-July/759119.html

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 support/testing/infra/emulator.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
index be26d4caa4..5318577cda 100644
--- a/support/testing/infra/emulator.py
+++ b/support/testing/infra/emulator.py
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 # SPDX-License-Identifier: ISC
 
+import os
+
 import pexpect
 import pexpect.replwrap
 
@@ -108,6 +110,11 @@ class Emulator(object):
         if kernel_cmdline:
             qemu_cmd += ["-append", " ".join(kernel_cmdline)]
 
+        self.logfile.write(f"> host cpu count: {os.cpu_count()}\n")
+        ldavg = os.getloadavg()
+        ldavg_str = f"{ldavg[0]:.2f}, {ldavg[1]:.2f}, {ldavg[2]:.2f}"
+        self.logfile.write(f"> host loadavg: {ldavg_str}\n")
+        self.logfile.write(f"> timeout multiplier: {self.timeout_multiplier}\n")
         self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd))
         self.qemu = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:],
                                   timeout=5 * self.timeout_multiplier,
-- 
2.45.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-01 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-28 15:46 [Buildroot] [PATCH 1/1] support/testing/infra/emulator.py: add host load info in run log Julien Olivain
2024-07-28 19:51 ` Thomas Petazzoni via buildroot
2024-09-01 14:49 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox