linux/scripts/kconfig
Yann E. MORIN 8357b48549 kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG
Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
is specified.

For example, given those two files (Thomas' test-case):

    ---8<--- Config.test.in
    config OPTIONA
        bool "Option A"

    choice
        prompt "This is a choice"

    config CHOICE_OPTIONA
        bool "Choice Option A"

    config CHOICE_OPTIONB
        bool "Choice Option B"

    endchoice

    config OPTIONB
        bool "Option B"
    ---8<--- Config.test.in

    ---8<--- config.defaults
    CONFIG_OPTIONA=y
    ---8<--- config.defaults

And running:
    ./scripts/kconfig/conf --randconfig Config.test.in

does properly randomise the two choice symbols (and the two booleans).

However, running:
    KCONFIG_ALLCONFIG=config.defaults \
    ./scripts/kconfig/conf --randconfig Config.test.in

does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
will ever be selected. (OPTIONA will always be set (expected), and
OPTIONB will be be properly randomised (expected).)

This patch defers setting that a choice has a value until a symbol for
that choice is indeed set, so that choices are properly randomised when
KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>

---
Changes v3 -> v4
  - fix previous issue where some choices would not be set, which would
    cause silentoldconfig to ask for them and was then breaking this
    workflow (as reported by Arnd and Sedat):
        KCONFIG_ALLCONFIG=foo.defconfig make randconfig
        make silentoldconfig </dev/nullo
    which I have tested (3h28min!) with:
        touch defconfig
        for(( i=0; i<10000; i++ )); do
            KCONFIG_ALLCONFIG=$(pwd)/defconfig make randconfig >/dev/null 2>&1
            make silentoldconfig </dev/null >/dev/null 2>&1 || break
        done
    which did not break at all.
  - change done in v3 (below) is already fixed by a previous patch

Changes v2 -> v3
  - ensure only one symbol is set in a choice

Changes v1 -> v2:
  - further postpone setting that a choice has a value until
    one is indeed set
  - do not print symbols that are part of an invisible choice
2013-06-24 20:03:31 +02:00
..
lxdialog mconf: use function calls instead of ncurses' variables LINES and COLS 2013-06-18 23:58:58 +02:00
.gitignore kconfig: remove lkc_defs.h from .gitignore and dontdiff 2012-07-13 15:08:25 +02:00
check.sh kbuild: Fix gcc -x syntax 2012-10-03 09:03:24 +02:00
conf.c kconfig: loop as long as we changed some symbols in randconfig 2013-06-24 20:03:30 +02:00
confdata.c kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG 2013-06-24 20:03:31 +02:00
expr.c kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
expr.h kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on 2013-06-16 11:00:30 +02:00
gconf.c kconfig: get CONFIG_ prefix from the environment 2012-11-20 11:20:08 +01:00
gconf.glade scripts/kconfig/gconf.glade Update broken web addresses. 2010-09-17 16:54:42 +02:00
images.c
kxgettext.c kconfig: nuke LKC_DIRECT_LINK cruft 2011-06-06 15:32:20 -04:00
list.h kconfig: fix lists definition for C++ 2013-04-29 19:55:56 +02:00
lkc.h kconfig: loop as long as we changed some symbols in randconfig 2013-06-24 20:03:30 +02:00
lkc_proto.h mconf/nconf: mark empty menus/menuconfigs different from non-empty ones 2013-06-18 23:58:59 +02:00
Makefile kconfig: optionally use pkg-config to detect ncurses libs 2013-03-07 00:21:11 +01:00
mconf.c kconfig/[mn]conf: make it explicit in the search box that a regexp is possible 2013-06-24 20:01:37 +02:00
menu.c mconf/nconf: mark empty menus/menuconfigs different from non-empty ones 2013-06-18 23:58:59 +02:00
merge_config.sh merge_config.sh: Avoid creating unnessary source softlinks 2013-04-10 10:55:22 +02:00
nconf.c kconfig/[mn]conf: make it explicit in the search box that a regexp is possible 2013-06-24 20:01:37 +02:00
nconf.gui.c nconf: use function calls instead of ncurses' variables LINES and COLS 2013-06-18 23:58:58 +02:00
nconf.h scripts/kconfig/nconf: dynamically alloc dialog_input_result 2011-09-09 14:40:08 +02:00
POTFILES.in kconfig: gettext support for lxdialog 2008-01-28 23:14:39 +01:00
qconf.cc kconfig: fix a compiliation error when using make xconfig 2013-01-30 10:16:43 +01:00
qconf.h xconfig: Abort close if configuration cannot be saved 2011-07-25 15:50:34 +02:00
streamline_config.pl localmodconfig: Process source kconfig files as they are found 2013-04-29 15:41:51 -04:00
symbol.c kconfig: sort found symbols by relevance 2013-06-24 19:57:45 +02:00
util.c kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
zconf.gperf kconfig: constify `kconf_id_lookup' 2011-06-09 14:04:42 -04:00
zconf.hash.c_shipped kconfig: regen parser 2011-06-09 14:04:45 -04:00
zconf.l kconfig: Fix malloc handling in conf tools 2012-11-20 12:12:47 +01:00
zconf.lex.c_shipped kconfig: Regenerate lexer 2012-11-20 12:12:57 +01:00
zconf.tab.c_shipped Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-07-30 00:17:06 -07:00
zconf.y Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-07-30 00:17:06 -07:00