summaryrefslogtreecommitdiff
path: root/testsuite.py
AgeCommit message (Collapse)Author
2018-04-05Set is_menuconfig True on the top menuUlf Magnusson
Oversight
2018-04-04Generalize is_menuconfig to non-symbol itemsUlf Magnusson
Extending the scope of is_menuconfig so that it's True for all items whose children should be displayed in a separate menu turns out to be handy when implementing menuconfig-like functionality. Keep the old name for backwards compatibility. It's good enough.
2018-03-28Parenthesize && expressions within || expressionsUlf Magnusson
This is redundant from an evaluation perspective, as && has higher precedence than ||, but is easier to read. A && B || C && D is now rendered as "(A && B) || (C && D)".
2018-03-26Refactor expr_str() casesUlf Magnusson
- Detect Symbol directly instead of as (not tuple) + (not choice) - Test explicitly for a tuple (non-Symbol) in NOT - Add some tests to get better coverage for NOT and parentheses
2018-03-23testsuite.py: Remove redundant enable_warnings() callUlf Magnusson
The Kconfig object is replaced immediately after it.
2018-03-23Warn if user (.config) value is outside of 'range'Ulf Magnusson
Example warning: warning: user value 0x100 on the hex symbol HEX (defined at Kconfig:18) ignored due to being outside the active range ([0x13, 0x73]) -- falling back on defaults This is a Kconfiglib-exclusive warning. It might be tricky to implement in the C tools, due to weird two-phase handling of int/hex symbols. There is unfortunately no easy way to map the warning back to a .config line, as the active 'range' can't be known in general until the entire configuration has been read (consider 'range 0 10 if FOO' for example). Instead, the warning is generated when the symbol value is calculated.
2018-03-17Remove TILE architecture from test suiteUlf Magnusson
Removed in linux-next.
2018-03-13Test grsource with nonexistent fileUlf Magnusson
Just for completeness.
2018-03-13Add a globbing source statementUlf Magnusson
'gsource' works like 'source', but takes a glob pattern and sources all matching files. Works as a no-op if no files match, and hence doubles as an include-if-exists function, similar to '-include' in 'make'. Add a 'grsource' statement as well, mirroring 'rsource'. Came up in https://github.com/ulfalizer/Kconfiglib/pull/40.
2018-03-11Add minimal configuration file generation supportUlf Magnusson
Works like 'make savedefconfig' in the C tools. Call it write_min_config() rather than write_defconfig() to be a bit more explicit. Add a test similar to test_defconfig that compares Kconfiglib minimal configuration output against the C implementation, for all defconfig files. Disable the tests for now. The C tools have a bug that causes an incorrect configuration to be generated for tristate choices in some cases. They will be re-enabled once those are fixed.
2018-03-10testsuite.py: Break out a defconfig_files() helperUlf Magnusson
defconfig_files() yields all the defconfig files for a particular arch/ subdirectory. This will allow reuse when savedefconfig is tested. Also simplify the code a bit.
2018-03-09testsuite.py: Don't count defconfig filesUlf Magnusson
Not that important of a stat, plus there might be more tests that process defconfig files soon, making it kinda meaningless.
2018-03-06Simplify test suite loggingUlf Magnusson
No great need to log timestamps anymore.
2018-03-06Avoid shadowing test_defconfig() 'srcarch' parameterUlf Magnusson
The 'for' overrode 'srcarch', which is currently harmless, but ugly.
2018-03-06testsuite.py: Use 'srcarch' instead of '_arch' in test_defconfig()Ulf Magnusson
Makes sense as SRCARCH holds the arch/ subdirectory and _arch might be confused for ARCH.
2018-03-06testsuite.py: Refactor run_compatibility_tests()Ulf Magnusson
Get rid of the compare_configs flag and just do the comparison from the test functions themselves with a helper. Also get rid of the test_load() test. That's indirectly tested through the other tests, and test_alldefconfig() runs first and is speedy.
2018-02-28Add support for incremental buildsUlf Magnusson
Implement a scheme from the C tools where symbols get corresponding files that are touch'ed whenever the symbol's value changes. This can be used to add e.g. Makefile dependencies between source files and particular symbols. See the docstring of the new sync_deps() function for more information. Piggyback a small sanity check for write_autoconf().
2018-02-27testsuite.py: Remove write_and_verify_header()Ulf Magnusson
Unused leftover from Kconfiglib 1.
2018-02-27Implement 'rsource' statement ('source' with relative path)Roman
The 'rsource' statement works like 'source', but looks relative to the Kconfig file that has the 'rsource' rather than relative to the base Kconfig file. Using 'rsource' makes it possible to move subtrees with Kconfig files around without breaking references to other Kconfig files. So far, this is a Kconfiglib-exclusive feature.
2018-02-16Include direct deps. in Symbol/Choice.__str__()Ulf Magnusson
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.
2018-02-08Don't special-case user_value for choice symbols set to yUlf Magnusson
Previously, setting a choice symbol to y would only update user_selection on the parent choice and not the symbol's own user_value. Now both are updated. The point of the old behavior was to remember the m mode selections of a choice when it was switched back and forth between m and y mode, which was a feature I thought the C implementation had. On closer inspection, the C implementation never had that feature, though it might appear like it if you only make "lucky" changes (if you never select any symbols in y mode that were n in m mode). The new behavior is simpler and easier to understand: Symbol.user_value now always matches the value assigned in a .config file or via set_value(), provided the value was well-formed. This might avoid some special-casing in scripts too. The loss in usability is pretty minimal.
2018-02-07Add back omitted $ARCH != $SRCARCH defconfig testsUlf Magnusson
Oversight during refactoring. defconfig files should be searched for in in arch/$SRCARCH/ rather than arch/$ARCH/, to account for $ARCH != $SRCARCH. Adds a few tests to test_defconfig(). Some of the ARCH/defconfig combinations might be nonsensical, but that's fine. Make all test functions take $SRCARCH as well as $ARCH, which makes the implementation straightforward.
2018-02-03Refactor test suite arch Kconfig loadingUlf Magnusson
List the ARCH/SRCARCH pairs that don't conform to the arch/$ARCH/Kconfig pattern directly.
2018-02-03Set $KERNELVERSION properly in test suiteUlf Magnusson
Don't think anything currently depends on it where it would matter for the test suite, but might as well.
2018-01-30Fix warnings printed for test suiteUlf Magnusson
Just to have clean output. The warnings themselves are accurate.
2018-01-28Add some post-parsing warningsUlf Magnusson
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.
2018-01-28Flag constant symbols where they're not allowedUlf Magnusson
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.
2018-01-25Support <, > relational operators with tristatesUlf Magnusson
Mirrors 9059a3493ef ("kconfig: fix relational operators for bool and tristate symbols") in the C implementation.
2018-01-22Simplify escape()Ulf Magnusson
The fancy regex isn't really justified. Much faster with replace() too, though this is an unlikely hotspot. Could have used a \g<0> backreference to refer to the entire match instead of using a capturing group too. Hadn't discovered that. Add some selftests for escape() and unescape() too.
2018-01-21Whitespace nitsUlf Magnusson
2018-01-20Get rid of _next_help_line()Ulf Magnusson
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.
2018-01-17Improve recursive 'source' testUlf Magnusson
Check for incorrect exceptions instead of propagating them, and get rid of the flag.
2018-01-17Detect recursive 'source' and print backtraceUlf Magnusson
Easier to debug than a RecursionError. Point out in the exception message that a common cause is environment variables not being set correctly.
2018-01-16Get TRI_TO_STR from Kconfiglib in test suiteUlf Magnusson
Old code.
2018-01-16Do not optimize promptless choice symbolsUlf Magnusson
Choice symbols without prompts are pointless and probably nonexistent in practice, so it's a bit silly to run the no-prompt optimization for them. Piggyback copyright year update.
2018-01-15Support disabling warnings for redundant assignmentsSebastian Bøe
The Linux Kernel's merge_config.sh defaults to disabling warnings for redundant assignments and has support for enabling them specifically. This patch reproduces this behaviour in kconfiglib except that we retaing kconfiglib's default behaviour of enabling the warnings. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-11Mention that $CONFIG_ is used for C headers tooUlf Magnusson
Piggyback some cleanup and redundant comment removal.
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.