| Age | Commit message (Collapse) | Author |
|
Direct dependencies are significant for 'imply' even if the symbol has
no properties, so they need to be included to get semantically
equivalent output.
Making the direct dependencies clear is helpful in general too, even if
you can usually infer them from the properties they get propagated to.
|
|
Just to have clean output. The warnings themselves are accurate.
|
|
These are easiest to check after parsing, since a symbol/choice can be
defined in multiple locations:
- Warn if a symbol or choice defined without a type. Also warn for
choice value symbols defined without a type, even if they
automatically get their type from the choice. This feature isn't
well-known and probably not used deliberately.
- Warn if a choice is defined without a prompt
- Warn of a choice default symbol is not contained in the choice
Also move _name_and_loc_str() from the symbol class to the global scope
and generalize it to be able to handle choices.
|
|
Might break U-Boot if they ever upgrade Kconfiglib, because they have a
'select y' in there (which the C tools don't flag since they only look
for quotes), but it's a one-line fix.
|
|
Speeds things up a bit further.
Rework the unget handling to save the ungotten line directly instead of
using a flag.
Add some help texts to tests/Klocation to make sure the line number is
updated properly for those.
|
|
Easier to debug than a RecursionError.
Point out in the exception message that a common cause is environment
variables not being set correctly.
|
|
Oversight. SYMBOL_AUTO (env_var) being set indirectly clears
SYMBOL_WRITE (_write_to_conf) in sym_calc_value(). The .config case was
already fine due to an explicit env_var check.
Even non-visible env. symbols ended up in the header, due to
'option env' internally adding a default.
Disallow user values altogether on 'option env' symbols, even if
specified manually. This matches the C implementation. Add a warning
too.
|
|
Some were for now-removed APIs, others tested things that are tested
differently now.
|
|
|
|
Confirms that all the examples that aren't tested in the test suite at
least run. Easy to miss brokenness there. Output can be inspected
manually (it'll vary depending on the kernel version).
Fix defconfig_oldconfig.py, which hadn't been properly updated for the
new API.
|
|
Could never return 0 as a valid assignable value previously.
|
|
|
|
A tristate implied to y can't be set to m. Other than that, imply
doesn't affect assignable values.
Fix some copy-paste type errors too.
In the C menuconfig, a tristate with m visibility implied to y gets
stuck if you change it with space. Look into that later. Test case:
config MODULES
def_bool y
option modules
config Y_IMPLIER
def_tristate y
imply Y_IMP_M_VIS_TRI
config Y_IMP_M_VIS_TRI
tristate "y-imp m-vis tri" if m
|
|
Comprehensive selftests are important here, because the
allno/yesconfig.py scripts only check the upper and lower bound, and
allnoconfig disables modules.
Found a bug for non-selected m-visible tristates, where n didn't show up
in sym.assignable. Everything matches menuconfig after fixing that.
Still need to test symbols in choices with different modes, imply, and
.assignable for choices.
|
|
Can finally get rid of get_choices() and get_items() now.
Piggyback some more Kwtf tests, and remove some outdated comments.
There's already plenty of select/imply testing.
|
|
Kinda silly to test if they're separate since a long time, but can do
that easily too with some reorganization.
|
|
Think those variables got used in other places before...
Fetch the choices by name.
Also dedotdotdot all messages for consistency.
|
|
The choice semantics tests already verify the behavior of optional
choices. Just print an optional choice instead to get some coverage for
querying it.
Do minor cleanup elsewhere.
|
|
Can just skip the invalidation for promptless symbols. Makes things less
magic and more intuitive while still being fast. Means no docs need to
be rewritten too.
Now the warning gets printed for unset_value() as well.
|
|
In replace mode, only unset symbols that didn't get set.
Get rid of _set_value_no_invalidate() and just do a normal set_value()
with invalidation. It's speedy with the new invalidation algorithm, and
simpler.
Not a big performance boost (but a small one), but means that
invalidation must be even more rock solid for the test suite to pass (no
global invalidations to hide behind), which is nice.
Also make y assignments to choice symbol update just the choice user
value. Gives nicer behavior when the choice mode is changed.
|
|
|
|
WIP
|
|
Bad oversight. Weak reverse dependencies (from imply) are not considered
if the direct dependencies of a symbol are not met (the
'if'/'depends on' dependencies from the symbol and its parents, taking
location into account if the symbol is defined in multiple places).
Caused a wrong value for the symbol FS_FAT in the U-Boot Kconfigs, where
'imply' is more heavily used compared to the kernel.
Add a new variable _direct_deps that corresponds to dir_dep from the C
implementation. Before 'imply', dir_dep was only used for a
'select'-related warning in the C implementation.
Add a bunch of tests to cover 'imply' semantics. Should be solid now.
|
|
Just like for other properties, conditions on ranges get local
'depends on' and parent dependencies propagated to them. Oversight.
Did not trigger any deviations for the kernel defconfigs. Pretty
specific circumstances were required for breakage, like a symbol
depending on the particular value of a symbol with a 'range' and parent
deps 'n', or a symbol with ranges being defined in multiple locations
with different parent deps.
(There is one symbol that both has ranges and is defined in multiple
locations: BCH_CONST_M. The second definition adds a default rather than
a range though.)
|
|
Think I had it in the back of my head somewhere that not invalidating
undefined symbols could break some obscure cases, but turns out it's
perfectly safe: Nothing can change the value of an undefined symbol.
They always get their name as their value.
There's no need to unset user values on them either, because
set_user_value() already refuses to to set one on them.
Lets us get rid of the Python 2/3 compatibility hack and instead iterate
over a plain list of defined symbols.
|
|
Previously, 'default CHOICE_SYM [if <cond>]' in a choice would skip any
following 'default' properties if <cond> was non-'n'. However, those
other defaults should still be considered if CHOICE_SYM has visibility
'n'. Previously, we'd immediately fall back to selecting the first
visible symbol in the choice in that case.
get_selection_from_defaults() now exactly mirrors sym_choice_default()
from the C implementation, and got less convoluted too.
Nothing in the kernel defconfigs triggered this.
Add a new test case too.
|
|
The constructors previously defaulted all properties. This is dead code
for properties that are always set on items from outside during parsing,
and obfuscates the code flow and wastes time. Instead, just mention
other properties that exist in comments in the constructors.
Also add test cases for missing and empty 'choice' help texts. Removing
the default 'self._help = None' assignment in Choice.__init__() wasn't
caught by the selftests.
|
|
This code in zconf.l says !=, not ==. Thought the behavior seemed weird.
if (!f && name != NULL && name[0] != '/') {
env = getenv(SRCTREE);
if (env) {
sprintf(fullname, "%s/%s", env, name);
f = fopen(fullname, "r");
}
}
return f;
Thankfully only broken for a short while. Also gives much simpler code.
|
|
Previously, $srctree/path/to/defconfig would be looked up before
/path/to/defconfig, and the code wouldn't check if /path/to/defconfig
was an absolute path ($srctree is ignored otherwise). Sloppy old
oversights. The behavior now fully matches the C implementation.
Also fix some related things:
- An 'if m' suffices to select a defconfig. We previously required 'y'.
- Make the code less hacky and possibly more Windows-friendly by using
os.path.relpath() to de-absolutize paths, and stop using
os.path.normpath() as it could change the meaning of paths that
contain symbolic links.
- Explain what happens if 'option defconfig_list' is set on multiple
symbols and print a warning in that case.
- Fix get_srctree(). It would previously return "." instead of None if
$srctree was unset at parse time. Somehow forgot to to test this. The
code is now much more straightforward.
|
|
- Get rid of _sym_str_string(), which was only used here.
- Remove 'if expr is None' case that could never trigger
- Add a test for printing string symbols, as they are a bit tricky:
Default values should not be evaluated to tristate values.
|
|
Was added upstream in 31847b67 (kconfig: allow use of relations other
than (in)equality). Completely unused (and undocumented) in the kernel
except for in DEBUG_UART_8250_WORD in arch/arm/Kconfig.debug:
depends on DEBUG_UART_8250_SHIFT >= 2
(That line was added before lt/gt support by the way, and assumed a
feature that wasn't there.)
This change (and the upstream one) also slightly changes how
(in)equality comparisons work, making e.g.
MY_HEX = 0x00037
evaluate to 'y' if MY_HEX is 0x37. Prior to this change, the strings
needed to match exactly.
|
|
Previously, only WEIRD_1 and not WEIRD_2 would be considered not a
choice symbol in the following fragment. This lead to a weird warning in
U-Boot.
choice
config FOO
config WEIRD_1
depends on FOO
if FOO
config WEIRD_2
endif
endchoice
Also add some testcases for weird choice symbols.
|
|
This is like a 'select' that only changes the default value of a symbol,
not limiting what values the user can set it to (with one exception: A
symbol implied to 'y' can't be set to 'm').
Symbol.get_implied_symbols() was added, corresponding to
Symbol.get_selected_symbols(), and Symbol.__str__() was extended to
print implied symbols and weak reverse dependencies. Weak reverse
dependencies are the 'imply' version of 'select's reverse dependencies.
|
|
Mostly to get coverage for _FileFeed.peek_next(), which is only used
while reading the header. The tested behavior probably doesn't make much
sense for .config files and stems from _FileFeed reuse. It's fairly
obscure at least.
|
|
The line number was previously for logical lines only. Oversight.
Get rid of _get_lines() and keep the raw lines in _FileFeed instead,
only joining lines with continuation lines as they are fetched. This
makes the index correspond to the correct line number from the file. (It
also means most lines are returned as-is without any logic applied to
them, which is nice.)
Litter tests/Klocation with continuation lines to get test coverage.
Remove some unused functions that were previously inherited from _Feed
and remove it as a base class of _FileFeed.
|
|
The format of the strings isn't set in stone, but it's nice to verify
that nothing changes.
This code was incredibly boring to write. :P
|
|
|
|
(It was never required if you explicitly passed a 'base_dir', but it's a
bit silly to have to do that too.)
This is a bug. I expected os.path.expandvars() to replace references
non-set environment variables with nothing, but it leaves them as is.
Work around it by letting base_dir = None be special and the default. It
uses $srctree if set and the current directory otherwise. This has the
following advantages:
- It avoids having to reimplement a different version of
os.path.expandvars() and special-casing "" to mean the current
directory.
- It means '$' can appear in paths. (Though it probably never will.)
Maybe the expansion behavior could be removed too, but keep it for now
to be backwards compatible.
|
|
|
|
In preparation for some changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|