Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] support/testing/run-tests: fix --testcases option
Date: Wed, 27 Jul 2022 18:20:40 +0200	[thread overview]
Message-ID: <20220727162040.GE1134587@scaer> (raw)
In-Reply-To: <20220727150230.2529065-1-arnout@mind.be>

Arnout, All,

On 2022-07-27 17:02 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> 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 up).
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  support/testing/run-tests | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/testing/run-tests b/support/testing/run-tests
> index 022209b414..f9c0bebc48 100755
> --- a/support/testing/run-tests
> +++ b/support/testing/run-tests
> @@ -87,7 +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
> +        each_testcase = int((br2_jlevel + args.testcases - 1) / args.testcases)

* 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, with the following, we're guaranteed to have an int that is >=1:

    int((br2_jlevel + args.testcases) / args.testcases)

Because br2_jlevel + args.testcases is guaranteed to always be bigger
than or equal to args.testcases.

>          if each_testcase < 1:
>              each_testcase = 1

So that test can be dropped now.

I've amended your change with the above. Please yell if my maths are
wrong... ;-)

Regards,
Yann E. MORIN.

>          BRConfigTest.jlevel = each_testcase
> -- 
> 2.35.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-07-27 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 15:02 [Buildroot] [PATCH] support/testing/run-tests: fix --testcases option Arnout Vandecappelle (Essensium/Mind)
2022-07-27 16:20 ` Yann E. MORIN [this message]
2022-07-27 16:43   ` Arnout Vandecappelle
2022-08-30 22:27 ` Peter Korsgaard

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=20220727162040.GE1134587@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.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