Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 1/1] utils/genrandconfig: allow overriding KCONFIG_PROBABILITY
@ 2024-08-20  0:03 James Hilliard
  2024-08-23 17:40 ` Thomas Petazzoni via buildroot
  2024-09-18 16:11 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: James Hilliard @ 2024-08-20  0:03 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard

Tweaking this variable should allow us to get better coverage of
packages with larger dependency trees.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes v3 -> v4:
  - rebase
Changes v2 -> v3:
  - rebase
Changes v1 -> v2:
  - rebase
---
 utils/genrandconfig | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/utils/genrandconfig b/utils/genrandconfig
index 8e60fd3f9e..94dbd37393 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -542,7 +542,7 @@ async def gen_config(args):
         proc = await asyncio.create_subprocess_exec(
             "make", "O=%s" % args.outputdir, "-C", args.buildrootdir,
             "KCONFIG_SEED=0x%s" % hexlify(os.urandom(4)).decode("ascii").upper(),
-            "KCONFIG_PROBABILITY=%d" % randint(1, 20),
+            "KCONFIG_PROBABILITY=%d" % args.probability,
             "randconfig",
             stdout=asyncio.subprocess.DEVNULL,
             stderr=asyncio.subprocess.DEVNULL)
@@ -603,6 +603,21 @@ async def gen_config(args):
 
 if __name__ == '__main__':
     import argparse
+
+    class Range(argparse.Action):
+        def __init__(self, minimum=None, maximum=None, *args, **kwargs):
+            self.min = minimum
+            self.max = maximum
+            kwargs["metavar"] = "[%d-%d]" % (self.min, self.max)
+            super(Range, self).__init__(*args, **kwargs)
+
+        def __call__(self, parser, namespace, value, option_string=None):
+            if not (self.min <= value <= self.max):
+                msg = 'invalid choice: %r (choose from [%d-%d])' % \
+                    (value, self.min, self.max)
+                raise argparse.ArgumentError(self, msg)
+            setattr(namespace, self.dest, value)
+
     parser = argparse.ArgumentParser(description="Generate a random configuration")
     parser.add_argument("--outputdir", "-o",
                         help="Output directory (relative to current directory)",
@@ -610,6 +625,10 @@ if __name__ == '__main__':
     parser.add_argument("--buildrootdir", "-b",
                         help="Buildroot directory (relative to current directory)",
                         type=str, default='.')
+    parser.add_argument("--probability", "-p",
+                        help="Override the KCONFIG_PROBABILITY value",
+                        type=int, action=Range, minimum=0, maximum=100,
+                        default=randint(1, 20))
     parser.add_argument("--toolchains-csv", help="Legacy, unused", type=str)
     parser.add_argument("--no-toolchains-csv", help="Legacy, unused")
 
-- 
2.34.1

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

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

* Re: [Buildroot] [PATCH v4 1/1] utils/genrandconfig: allow overriding KCONFIG_PROBABILITY
  2024-08-20  0:03 [Buildroot] [PATCH v4 1/1] utils/genrandconfig: allow overriding KCONFIG_PROBABILITY James Hilliard
@ 2024-08-23 17:40 ` Thomas Petazzoni via buildroot
  2024-09-18 16:11 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-08-23 17:40 UTC (permalink / raw)
  To: James Hilliard; +Cc: buildroot

On Mon, 19 Aug 2024 18:03:25 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> Tweaking this variable should allow us to get better coverage of
> packages with larger dependency trees.
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> Changes v3 -> v4:
>   - rebase
> Changes v2 -> v3:
>   - rebase
> Changes v1 -> v2:
>   - rebase
> ---
>  utils/genrandconfig | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v4 1/1] utils/genrandconfig: allow overriding KCONFIG_PROBABILITY
  2024-08-20  0:03 [Buildroot] [PATCH v4 1/1] utils/genrandconfig: allow overriding KCONFIG_PROBABILITY James Hilliard
  2024-08-23 17:40 ` Thomas Petazzoni via buildroot
@ 2024-09-18 16:11 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-09-18 16:11 UTC (permalink / raw)
  To: James Hilliard; +Cc: buildroot

>>>>> "James" == James Hilliard <james.hilliard1@gmail.com> writes:

 > Tweaking this variable should allow us to get better coverage of
 > packages with larger dependency trees.

 > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
 > ---
 > Changes v3 -> v4:
 >   - rebase
 > Changes v2 -> v3:
 >   - rebase
 > Changes v1 -> v2:
 >   - rebase

Committed to 2024.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-09-18 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20  0:03 [Buildroot] [PATCH v4 1/1] utils/genrandconfig: allow overriding KCONFIG_PROBABILITY James Hilliard
2024-08-23 17:40 ` Thomas Petazzoni via buildroot
2024-09-18 16:11 ` Peter Korsgaard

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