summaryrefslogtreecommitdiff
path: root/testsuite.py
AgeCommit message (Collapse)Author
2018-01-05Don't write out 'option env' symbols to C headerUlf Magnusson
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.
2017-11-12Simplify licensingUlf Magnusson
IANAL, but hopefully this should be enough. Don't bundle the license file. Might be easier to work with if just kconfiglib.py is copied.
2017-11-10Fix a few typosUlf Magnusson
Clean up some formatting a bit too.
2017-11-08Add a release test scriptUlf Magnusson
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.
2017-11-07s/overriden/overridden/Ulf Magnusson
Add test coverage for that Choice.__repr__() path too.
2017-11-06Get rid of Choice.default_selectionUlf Magnusson
Was only used by allyesconfig.py. Easy to add back if needed at any point.
2017-11-04Fix test suite Python 3 syntax errorUlf Magnusson
"List comprehensions no longer support the...", https://docs.python.org/3.0/whatsnew/3.0.html
2017-11-04Don't put 0 in .assignable for y-mode choice symsUlf Magnusson
Just return (2,). More intuitive, and makes y-mode choices just work in the menuconfig example. Turns out to be simple to implement with choice symbol visibility depending on the Choice.
2017-11-04Return False from set_value() for invalid valuesUlf Magnusson
Usability improvement discovered while putting together menuconfig example. Would have to duplicate validity checking otherwise. Also reject negative values for HEX symbols, just to be compatible with the C implementation. Keep TRI_TO_STR and STR_TO_TRI public. They're pretty handy even if they're trivial.
2017-11-03Fix error in commentUlf Magnusson
s/absolute/relative/
2017-11-03Remove outdated commentUlf Magnusson
Used to set a bunch of other options too on MODULES in the test, but it's cleaner to do it separately.
2017-11-03Remove outdated TODO commentUlf Magnusson
Tests for .assignable have been added.
2017-11-03Test .assignable with no modulesUlf Magnusson
Just add a column for the expected values for the no-modules case to the existing tests. Also automatically detect choice symbols in choices with y mode and disable the value setting test, instead of having to pass a flag.
2017-11-03Add comment to choice .assignable test tooUlf Magnusson
2017-11-03Test Choice.assignable, fix for optional choicesUlf Magnusson
Could never return 0 as a valid assignable value previously.
2017-11-03Add .assignable selftests for choice symbolsUlf Magnusson
2017-11-03Fix copy-paste comment errorUlf Magnusson
2017-11-03Test .assignable for imply, find C menuconfig bugUlf Magnusson
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
2017-11-03Add initial selftests for .assignableUlf Magnusson
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.
2017-11-03Test suite nitsUlf Magnusson
2017-11-02Clean up choice semantics testsUlf Magnusson
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.
2017-11-02Get rid of some old API compatibility hacksUlf Magnusson
Scaffolding to make the test suite work with the new API. No longer needed. get_choices() will be gone soon too.
2017-11-02Clean up .kconfig testsUlf Magnusson
Kinda silly to test if they're separate since a long time, but can do that easily too with some reorganization.
2017-11-02Clean up relation testUlf Magnusson
Think those variables got used in other places before... Fetch the choices by name. Also dedotdotdot all messages for consistency.
2017-11-02Get rid of separate is_optional testUlf Magnusson
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.
2017-11-02Update choice tests, get rid of some old testsUlf Magnusson
Need to manually set the mode of the choice now. Dependencies get a huge workout just from lack of global invalidation, so the manual dependency tests might be redundant. Would be tricky to reuse the old tests as is too, so they would need to be restructured at least.
2017-11-02Fix relation tests, remove some outdated testsUlf Magnusson
Menus are plain menu nodes now, and those are exercised elsewhere.
2017-11-02Always save user values if they're validUlf Magnusson
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.
2017-11-01Switch to a much faster invalidation algorithmUlf Magnusson
_cached_vis is always calculated as a side effect of calculating any other cached value, and so doubles as a flag for whether an item (symbol or choice) has any cached values. If _cached_vis is None for some item, it also indirectly means that no other item can have any cached values that (actually) depend on the item, because _cached_vis would have gotten calculated as a side effect of calculating any such cached value. Therefore, it's safe to stop recursive invalidation at an item that has _cached_vis None. Huge speedup for the allyes/noconfig*.py scripts. allnoconfig_simpler.py went from 2.671 seconds to 1.067 seconds. The dependency selftests need to be updated too now that _get_dependent() is gone. The kernel defconfig tests pass even if all global invalidation is disabled at least (except for the few defconfigs that don't set MODULES=y), and that's a huge invalidation test. Seems pretty speedy too, even though there's some redundant work, so maybe things could be simplified a bit...
2017-10-31Require manual mode setting for choicesUlf Magnusson
Do not change the mode if y is assigned to a choice symbol inside a choice in m mode, for example. Require Choice.set_value() to be called instead. This makes choices way less magical and more menuconfig-like. It would also be confusing to be able to assign y to a choice symbol when y is not in sym.assignable. Set the mode manually in load_config() (y assigned to a choice symbol => y mode, and ditto for m). Change the warning for inconsistent values to one that's probably less confusing, though the old one was closer to the warning printed by the C implementation. Need to fix a bunch of tests too...
2017-10-31Handle choices more like the C implementationUlf Magnusson
Choice symbols get the choice itself propagated to the conditions of their properties. This works since the Symbol/Choice value interfaces are compatible now. Simplifies value calculations and makes .assignable work automagically for choice symbols in choices in any mode. One drawback is that a '&& <choice>' now shows up on conditions when printing choice symbols, which is not valid Kconfig. That should be easy to work around if needed at least.
2017-10-30Merge user_str/tri_value into user_valueUlf Magnusson
user_str_value isn't justified any more with the other API improvements. user_value now stores 0, 1, 2 for bool/tristate symbols, and a string for other symbol types. Much simpler and more intuitive. Also avoid printing quotes around tristate values in __repr__(). This was inconsistent too as it was only done for the value and user value. Should be getting close to final API.
2017-10-30Get some basic MenuNode.__str__() test coverageUlf Magnusson
2017-10-30Rename Symbol/Choice/MenuNode.config to kconfigUlf Magnusson
To be consistent with the renamed class. Piggyback docstring fixes.
2017-10-30Consistently use 0/1/2 for tristate valuesUlf Magnusson
Easier to work with, allowing e.g. direct comparisons with < and >. Make set_value() take 0, 1, 2 for bool and tristate symbols, and fix other APIs to match. Also: - Add introductions to various concepts in the module docstring. Document some more attributes. Still TODOs. - Rename the Config class to Kconfig. - Escape " and \ in the name of constant symbols when printing them. Also make the (un)escaping 100% consistent with how the C tools do it (\ before non-magic character should be unescaped too). - Clean up the escaping/unescaping code and provide two public escape()/unescape() functions. - Export the original MODULES-independent type in orig_type. It's needed for printing symbols in the reparsable __str__() Kconfig format with just public APIs. - Lots of other minor reorganizing and nits all over.
2017-10-28Test suite work, cleanup, const sym invalidation fixUlf Magnusson
2017-10-28Nearly finalize APIUlf Magnusson
Probably just some usability tweaks left. Having to do STR_TO_TRI[] for comparisons against 'assignable' values is kinda ugly and confusing.
2017-10-27BackupUlf Magnusson
2017-10-25BackupUlf Magnusson
2017-10-25BackupUlf Magnusson
2017-10-24Kconfiglib 2 backupUlf Magnusson
WIP
2017-10-02Test suite style nitsUlf Magnusson
2017-10-02Make 'imply' consider direct dependenciesUlf Magnusson
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.
2017-10-01Propagate dependencies to range conditionsUlf Magnusson
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.)
2017-09-29.config header parsing nitsUlf Magnusson
Rearrange a bit and document that a trailing newline does not need to be added. Clean up the tests a bit too.
2017-09-28Fix unified diff output for the defconfig testsUlf Magnusson
Would get crammed in between the arch/defconfig string and the "FAIL".
2017-09-28Print unified diff on test suite failuresUlf Magnusson
Compares the .config's generated by us and the C implementation. Speeds up debugging compared to manually generating them. Clean up the test code a bit too.
2017-09-27Warn if the Makefile patch hasn't been appliedUlf Magnusson
The old error from the test suite was cryptic.
2017-09-27Hide non-tristate symbols in non-y tristate choicesUlf Magnusson
There's old ad-hoc code that does this in the C implementation, added in f5eaa32 (kconfig: tristate choices with mixed tristate and boolean values). Unless a tristate choice is in "y" mode, non-tristate symbols get visibility "n". There are currently no tristate choices with non-tristate symbols in the kernel, so this never triggered. Modify some self tests that weren't aware of this behavior, and add some new ones. Also remove an old pointless test.
2017-09-25Fix 'default' on non-visible choice symbolsUlf Magnusson
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.