summaryrefslogtreecommitdiff
path: root/tests/Klocation
AgeCommit message (Collapse)Author
2018-09-29Refactor parsing to get rid of _saved_lineUlf Magnusson
Handle the line-after-help-text case specially, which allows _has_tokens (renamed to _reuse_tokens) to be used as the unget mechanism for help texts as well, leaving _saved_line unused. Move the _reuse_tokens check into _next_line(). This makes _parse_block() as straightforward as _parse_properties(), and simplifies _parse_properties() a tiny bit too by getting rid of the '_tokens_i = -1' assignment.
2018-07-15Switch to more sensible globbing statements (w/ backwards compatibility)Ulf Magnusson
Instead of having 'source' and 'gsource', have 'source' always glob, but require the pattern to match at least one file, throwing KconfigError otherwise. Have separate 'osource' and 'orsource' statements (the o is for "optional") for cases where it's okay for the pattern to not match any files. This is analogous to 'include' and '-include' in Make. The biggest flaw with 'gsource' was that there was no way to do a globbing match while requiring something to match, possibly leading to subtle failures. Preserve backwards compatibility by having "gsource" and "grsource" be aliases for "osource" and "orsource", respectively. Also include some related changes: - Kconfig.srctree is now set to the empty string if $srctree is unset, rather than to None. This gives nice behavior with os.path.join() and os.path.relpath(), which treat the empty string as the current directory (without adding './', for os.path.join()). - When $srctree is set, Kconfig files in the current directory will no longer override Kconfig files in $srctree when the relative paths match. This was likely a bug all along in the C tools, and probably only makes sense for .config files. I've seen it cause breakage in Zephyr. - Clarify the behavior of $srctree in the Kconfig.__init__() docstring. - Make MenuNode.filename be relative to $srctree for the Kconfig file passed to Kconfig.__init__(). This makes it consistent. The major version will be bumped later due to the small Kconfig.srctree API change.
2018-05-26Micro-optimize _parse_help() loopUlf Magnusson
Shaves ~6% off the _parse_help() runtime for the x86 Kconfigs in cProfile.
2018-05-16Expand environment variables in strings directlyUlf Magnusson
Make "$FOO" directly reference the environment variable $FOO in e.g. 'source' statements, instead of the symbol FOO. Use os.path.expandvars() to expand strings (which preserves "$FOO" as-is if no environment variable FOO exists). This gets rid of the 'option env' "bounce" symbols, which are mostly just spam and are buggy in the C tools (dependencies aren't always respected, due to parsing and evaluation getting mixed up). The same change will probably appear soon in the C tools as well. Keep accepting 'option env' to preserve some backwards compatibility, but ignore it when expanding strings. For compatibility with the C tools, bounce symbols will need to be named the same as the environment variables they reference (which is the case for the Linux kernel). This is a compatibility break, so the major version will be bumped to 6 at the next release. The main motivation for adding this now is to allow recording properties on each MenuNode in a clean way. 'option env' symbols interact badly with delayed dependency propagation. Side note: I have a feeling that recording environment variable values might be redundant to trigger rebuilds if sync_deps() is run at each compile. It should detect all changes to symbol values due to environment variables changing value.
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-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-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-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.
2017-10-28Add uncommitted test filesUlf Magnusson
2017-10-24Kconfiglib 2 backupUlf Magnusson
WIP
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.
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.
2012-12-11Make location query selftests more comprehensive.Ulf Magnusson
Also sneak in testing of env. variable expansion, named choices, and 'base_dir'.
2012-12-07Add tests/Klocation.Ulf Magnusson