diff options
| author | Linus Torvalds <[email protected]> | 2024-03-21 14:41:00 -0700 | 
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2024-03-21 14:41:00 -0700 | 
| commit | 1d35aae78ffe739bf46c2bf9dea7b51a4eebfbe0 (patch) | |
| tree | 04c30ae83e5d76abe1284846921f1447f20aed38 /scripts/kconfig/tests/choice_randomize | |
| parent | 88d92fb1c034922572bab93482ac9cc61d4ba43c (diff) | |
| parent | f2fd2aad1908554fbc4ad6e8ef23bad3086bebd1 (diff) | |
Merge tag 'kbuild-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada:
 - Generate a list of built DTB files (arch/*/boot/dts/dtbs-list)
 - Use more threads when building Debian packages in parallel
 - Fix warnings shown during the RPM kernel package uninstallation
 - Change OBJECT_FILES_NON_STANDARD_*.o etc. to take a relative path to
   Makefile
 - Support GCC's -fmin-function-alignment flag
 - Fix a null pointer dereference bug in modpost
 - Add the DTB support to the RPM package
 - Various fixes and cleanups in Kconfig
* tag 'kbuild-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (67 commits)
  kconfig: tests: test dependency after shuffling choices
  kconfig: tests: add a test for randconfig with dependent choices
  kconfig: tests: support KCONFIG_SEED for the randconfig runner
  kbuild: rpm-pkg: add dtb files in kernel rpm
  kconfig: remove unneeded menu_is_visible() call in conf_write_defconfig()
  kconfig: check prompt for choice while parsing
  kconfig: lxdialog: remove unused dialog colors
  kconfig: lxdialog: fix button color for blackbg theme
  modpost: fix null pointer dereference
  kbuild: remove GCC's default -Wpacked-bitfield-compat flag
  kbuild: unexport abs_srctree and abs_objtree
  kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1
  kconfig: remove named choice support
  kconfig: use linked list in get_symbol_str() to iterate over menus
  kconfig: link menus to a symbol
  kbuild: fix inconsistent indentation in top Makefile
  kbuild: Use -fmin-function-alignment when available
  alpha: merge two entries for CONFIG_ALPHA_GAMMA
  alpha: merge two entries for CONFIG_ALPHA_EV4
  kbuild: change DTC_FLAGS_<basetarget>.o to take the path relative to $(obj)
  ...
Diffstat (limited to 'scripts/kconfig/tests/choice_randomize')
5 files changed, 78 insertions, 0 deletions
diff --git a/scripts/kconfig/tests/choice_randomize/Kconfig b/scripts/kconfig/tests/choice_randomize/Kconfig new file mode 100644 index 000000000000..93a1699ce3cb --- /dev/null +++ b/scripts/kconfig/tests/choice_randomize/Kconfig @@ -0,0 +1,22 @@ +choice +	prompt "choose A or B" + +config A +	bool "A" + +config B +	bool "B" + +endchoice + +choice +	prompt "choose X or Y" +	depends on B + +config X +	bool "X" + +config Y +	bool "Y" + +endchoice diff --git a/scripts/kconfig/tests/choice_randomize/__init__.py b/scripts/kconfig/tests/choice_randomize/__init__.py new file mode 100644 index 000000000000..d380045be79c --- /dev/null +++ b/scripts/kconfig/tests/choice_randomize/__init__.py @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0-only +""" +Randomize all dependent choices + +This is a somewhat tricky case for randconfig; the visibility of one choice is +determined by a member of another choice. Randconfig should be able to generate +all possible patterns. +""" + + +def test(conf): + +    expected0 = False +    expected1 = False +    expected2 = False + +    for i in range(100): +        assert conf.randconfig(seed=i) == 0 + +        if conf.config_matches('expected_config0'): +            expected0 = True +        elif conf.config_matches('expected_config1'): +            expected1 = True +        elif conf.config_matches('expected_config2'): +            expected2 = True +        else: +            assert False + +        if expected0 and expected1 and expected2: +            break + +    assert expected0 +    assert expected1 +    assert expected2 diff --git a/scripts/kconfig/tests/choice_randomize/expected_config0 b/scripts/kconfig/tests/choice_randomize/expected_config0 new file mode 100644 index 000000000000..f69227323759 --- /dev/null +++ b/scripts/kconfig/tests/choice_randomize/expected_config0 @@ -0,0 +1,6 @@ +# +# Automatically generated file; DO NOT EDIT. +# Main menu +# +CONFIG_A=y +# CONFIG_B is not set diff --git a/scripts/kconfig/tests/choice_randomize/expected_config1 b/scripts/kconfig/tests/choice_randomize/expected_config1 new file mode 100644 index 000000000000..bf83784c9b2a --- /dev/null +++ b/scripts/kconfig/tests/choice_randomize/expected_config1 @@ -0,0 +1,8 @@ +# +# Automatically generated file; DO NOT EDIT. +# Main menu +# +# CONFIG_A is not set +CONFIG_B=y +CONFIG_X=y +# CONFIG_Y is not set diff --git a/scripts/kconfig/tests/choice_randomize/expected_config2 b/scripts/kconfig/tests/choice_randomize/expected_config2 new file mode 100644 index 000000000000..38f93a8f37bd --- /dev/null +++ b/scripts/kconfig/tests/choice_randomize/expected_config2 @@ -0,0 +1,8 @@ +# +# Automatically generated file; DO NOT EDIT. +# Main menu +# +# CONFIG_A is not set +CONFIG_B=y +# CONFIG_X is not set +CONFIG_Y=y  |