summaryrefslogtreecommitdiff
path: root/testsuite.py
AgeCommit message (Collapse)Author
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.
2017-09-25Don't set defaults that will always be overwrittenUlf Magnusson
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.
2017-09-25Get rid of _BOOL_STRUlf Magnusson
The default string conversions for bools is fine. Turns "true"/"false" into "True"/"False" in object string representations. Hopefully that's not too bad of a backwards-compatibiltiy break.
2017-09-24Fix get_defconfig_filename() $srctree search orderUlf Magnusson
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.
2017-09-22Simplify _expr_to_str()Ulf Magnusson
- 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.
2017-09-21Massively reduce test suite memory usageUlf Magnusson
Previously we would load all arches once in the beginning and reuse them throughout the test suite. With 36 arches with all symbols evaluated and cached, this used many gigabytes of memory (unless the test suite was run with pypy). Restructure things so that we only keep one arch loaded at a time. This adds some reparsing, but it's not a big deal. Do an ugly piggy-backing of some code cleanup in the test suite (mostly using un-numbered {} with format()).
2017-09-20Add support for less/greater than comparisonsUlf Magnusson
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.
2017-09-19Include 'if' deps. in _determine_actual_symbols()Ulf Magnusson
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.
2017-09-19testsuite: Use platform.uname() instead of os.uname()Ulf Magnusson
Portable to non-Unix platforms.
2017-09-18Add 'imply' supportUlf Magnusson
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.
2015-07-23Add .config header continuation line test.Ulf Magnusson
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.
2015-07-23Simplify .config header reading tests.Ulf Magnusson
2015-06-17Do not unset user values before the first test.Ulf Magnusson
Redundant, plus we get more coverage for the default state.
2015-06-17Make sure scripts/kconfig/conf is built ourselves.Ulf Magnusson
Bit friendlier.
2015-06-17Remove env. variables in a neater way.Ulf Magnusson
2015-06-17Nit.Ulf Magnusson
2015-06-17Add note re. speedy mode in a fresh kernel tree.Ulf Magnusson
2015-06-17Docstring nit.Ulf Magnusson
2015-06-17Speedy test suite mode is still safe.Ulf Magnusson
2015-06-16Docstring nit.Ulf Magnusson
2015-06-16Clean up some docstrings.Ulf Magnusson
2015-06-16Use the same interpreter when running scriptconfig.Ulf Magnusson
Use python3 if testsuite.py was run with python3, etc.
2015-06-15Report correct locations in the presence of continuation lines.Ulf Magnusson
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.
2015-06-15Parsing isn't terribly slow.Ulf Magnusson
A scientific '$ top -d 0.01' experiment shows it's just waiting around for the vast majority of those tests.
2015-06-10s/if's/ifs/Ulf Magnusson
2015-06-09Get some more test coverage for Config.__str__().Ulf Magnusson
2015-06-09Add note re. __str__() tests.Ulf Magnusson
2015-06-09Test object __str__() methods.Ulf Magnusson
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
2015-06-09Verify that indented .config assignments are ignored.Ulf Magnusson
2015-06-08Test suite nits.Ulf Magnusson
2015-06-08Remove unused .format() argument in test suite.Ulf Magnusson