aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2013-06-18 13:35:29 -0400
committerYann E. MORIN <yann.morin.1998@free.fr>2013-06-24 14:03:31 -0400
commit8357b48549e17b3e4e402c7f977b65708922e60f (patch)
tree80760a2b6d4bc919474e061dd017eb02b6119f4f /scripts
parent3b9a19e08960e5cdad5253998637653e592a3c29 (diff)
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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c55c227af463..3e39208ad20e 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -288,8 +288,6 @@ load:
288 for_all_symbols(i, sym) { 288 for_all_symbols(i, sym) {
289 sym->flags |= SYMBOL_CHANGED; 289 sym->flags |= SYMBOL_CHANGED;
290 sym->flags &= ~(def_flags|SYMBOL_VALID); 290 sym->flags &= ~(def_flags|SYMBOL_VALID);
291 if (sym_is_choice(sym))
292 sym->flags |= def_flags;
293 switch (sym->type) { 291 switch (sym->type) {
294 case S_INT: 292 case S_INT:
295 case S_HEX: 293 case S_HEX:
@@ -379,13 +377,13 @@ setsym:
379 case mod: 377 case mod:
380 if (cs->def[def].tri == yes) { 378 if (cs->def[def].tri == yes) {
381 conf_warning("%s creates inconsistent choice state", sym->name); 379 conf_warning("%s creates inconsistent choice state", sym->name);
382 cs->flags &= ~def_flags;
383 } 380 }
384 break; 381 break;
385 case yes: 382 case yes:
386 if (cs->def[def].tri != no) 383 if (cs->def[def].tri != no)
387 conf_warning("override: %s changes choice state", sym->name); 384 conf_warning("override: %s changes choice state", sym->name);
388 cs->def[def].val = sym; 385 cs->def[def].val = sym;
386 cs->flags |= def_flags;
389 break; 387 break;
390 } 388 }
391 cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); 389 cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
@@ -791,6 +789,8 @@ int conf_write(const char *name)
791 sym_calc_value(sym); 789 sym_calc_value(sym);
792 if (!(sym->flags & SYMBOL_WRITE)) 790 if (!(sym->flags & SYMBOL_WRITE))
793 goto next; 791 goto next;
792 if (sym_is_choice_value(sym) && !menu_is_visible(menu->parent))
793 goto next;
794 sym->flags &= ~SYMBOL_WRITE; 794 sym->flags &= ~SYMBOL_WRITE;
795 795
796 conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); 796 conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);