From a092257a49ed7850913cf53e474f4c8dd175c94b Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 4 Sep 2018 18:05:28 +0200 Subject: Allow macro expansion within symbol names The C implementation supports this (though it's undocumented, and unused to far). This can be used e.g. to dynamically instatiate symbols from template files: Kconfig.template: config $(subsys)_LOG bool "Enable logging for $(subsys)" depends on $(subsys)_HAS_LOG ... other stuff dependent on $(subsys) Elsewhere: subsys = FOO source "Kconfig.template" subsys = BAR source "Kconfig.template" Pretty sure this can easily be abused, but it should be supported at least. --- testsuite.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'testsuite.py') diff --git a/testsuite.py b/testsuite.py index f7f75dd..eb305e0 100644 --- a/testsuite.py +++ b/testsuite.py @@ -2398,6 +2398,13 @@ config PRINT_ME default "\"foo\"" if "foo \"bar\" baz" = "" """) + verify_str(c.syms["PRINT_ME_TOO"], r""" +config PRINT_ME_TOO + bool + prompt "foo" + default FOOBARBAZQAZ if QAZ && QAZFOO && xxx +""") + def verify_recursive(name): try: c.variables[name].expanded_value @@ -2427,8 +2434,8 @@ config PRINT_ME verify_variable("shell-stderr-res", "", "", False) verify_variable("location-res", - "Kconfiglib/tests/Kpreprocess:119", - "Kconfiglib/tests/Kpreprocess:119", + "Kconfiglib/tests/Kpreprocess:125", + "Kconfiglib/tests/Kpreprocess:125", False) verify_variable("warning-res", "", "", False) @@ -2447,8 +2454,8 @@ config PRINT_ME # Check that the expected warnings were generated verify_equal(c.warnings, [ - "Kconfiglib/tests/Kpreprocess:116: warning: 'echo message on stderr >&2' wrote to stderr: message on stderr", - "Kconfiglib/tests/Kpreprocess:124: warning: a warning" + "Kconfiglib/tests/Kpreprocess:122: warning: 'echo message on stderr >&2' wrote to stderr: message on stderr", + "Kconfiglib/tests/Kpreprocess:130: warning: a warning" ]) -- cgit v1.2.3