public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* randconfig bug when used with KCONFIG_ALLCONFIG
@ 2013-02-27 20:41 Thomas Petazzoni
  2013-03-03 20:01 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2013-02-27 20:41 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek

Hello,

I'd like to report that the randconfig code seems to have a bug when it
is given a set of fixed values using KCONFIG_ALLCONFIG: it forgets to
randomize choice values.

Take the following Config.test.in:

-----8<----------8<------------8<----------
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<----------8<------------8<----------

If you do (using the kernel's kconfig):

 ./scripts/kconfig/conf --randconfig Config.test.in

you will see that the generated .config file properly randomizes all
options, including CHOICE_OPTIONA and CHOICE_OPTIONB.

Now, if we create a partial .config (named orig.config) file to set
the value of some options:

-----8<----------8<------------8<----------
CONFIG_OPTIONA=y
-----8<----------8<------------8<----------

If you do:

 KCONFIG_ALLCONFIG=orig.config ./scripts/kconfig/conf --randconfig Config.test.in

and look at the resulting .config, you will see that:

 * CONFIG_OPTIONA is always set to y, which is OK.

 * CONFIG_OPTIONB is properly randomized

 * But in the choice, it's always CONFIG_CHOICE_OPTIONA that will be
   selected, and never CONFIG_CHOICE_OPTIONB. The randomization for
   choices doesn't work as soon as a file is passed as
   KCONFIG_ALLCONFIG.

As you can see, the randomization of choices does not work properly
when KCONFIG_ALLCONFIG is used.

I've looked a little bit in the code, and in the following piece of
code from confdata.c:

	for_all_symbols(i, csym) {
		if (sym_has_value(csym) || !sym_is_choice(csym))
			continue;

		sym_calc_value(csym);
		if (mode == def_random)
			randomize_choice_values(csym);
		else
			set_all_choice_values(csym);
	}

which is normally responsible for randomizing choice values,
sym_has_value(csym) returns true for all choice options when
KCONFIG_ALLCONFIG is used, which explains why the choices are not
randomized. I haven't found out though why the kconfig code thinks that
all choice values already have a value, even though no value has been
passed through the KCONFIG_ALLCONFIG file.

Any hints? Or patch to test?

Thanks,

Thomas Petazzoni
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

end of thread, other threads:[~2013-04-11 10:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 20:41 randconfig bug when used with KCONFIG_ALLCONFIG Thomas Petazzoni
2013-03-03 20:01 ` Thomas Petazzoni
2013-03-10 16:01 ` [PATCH] kconfig: do randomise choice entries in presence of KCONFIG_ALLCONFIG Yann E. MORIN
2013-03-11 21:40   ` Thomas Petazzoni
2013-03-13 18:27   ` Yann E. MORIN
2013-04-08 11:52   ` Yann E. MORIN
2013-04-09 12:02     ` Yann E. MORIN
2013-04-10 21:20 ` Yann E. MORIN
2013-04-11  9:44   ` Michal Marek
2013-04-11  9:58     ` Yann E. MORIN

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