All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] support/testing/run-tests: fix --testcases option
@ 2022-07-27 16:20 Yann E. MORIN
  0 siblings, 0 replies; only message in thread
From: Yann E. MORIN @ 2022-07-27 16:20 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=8dce595a68bf86b351f2b990c5c489a21e1e5064
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The --testcases option of run-tests says how many test cases to build in
parallel. It automatically derives a jlevel from it by dividing the
number of cores + 1 by the number of parallel testcases. However, this
will typically result in a fractional number. Make doesn't like
fractional numbers as argument to -j.

Convert the number to integer (rounding down).

* br2_jlevel is an int, as multiprocessing.cpu_count() is an int, so it
  will be always >=2  (cpu_count() raises an error if it can't determine
  the number of CPU, so it will always return at least 1);

* args.testcases is an int, and is checked to be >=1

So br2_jlevel + args.testcases is guaranteed to always be bigger
than or equal to args.testcases, and the division thus bigger than 1.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[yann.morin.1998@free.fr:
  - ensure division provide at least 1
  - drop the test below
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 support/testing/run-tests | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/support/testing/run-tests b/support/testing/run-tests
index 022209b414..bf40019362 100755
--- a/support/testing/run-tests
+++ b/support/testing/run-tests
@@ -87,9 +87,7 @@ def main():
             return 1
         # same default BR2_JLEVEL as package/Makefile.in
         br2_jlevel = 1 + multiprocessing.cpu_count()
-        each_testcase = br2_jlevel / args.testcases
-        if each_testcase < 1:
-            each_testcase = 1
+        each_testcase = int((br2_jlevel + args.testcases) / args.testcases)
         BRConfigTest.jlevel = each_testcase
 
     if args.jlevel:
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-27 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 16:20 [Buildroot] [git commit] support/testing/run-tests: fix --testcases option Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.