diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-17 21:04:43 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-18 03:15:46 +0200 |
| commit | f247ddf618ad29718e5efd3e69f8baf75d4d347b (patch) | |
| tree | 91507ace16349ae227b14a92031f3d3c85555914 /testsuite.py | |
| parent | af7f6c30ece8536a60d69da58d924155789c2918 (diff) | |
Look up the top-level Kconfig file relative to $srctree
Due to an old design braino, the top-level Kconfig filename passed to
Kconfig.__init__() wasn't looked up relative to $srctree, breaking
out-of-tree usage for e.g. menuconfig. Fixing it required ugliness like
srctree = os.environ.get("srctree", "")
kconfiglib.Kconfig(os.path.join(srctree, "Kconfig"))
Change the behavior of Kconfig.__init__() to look up the top-level
Kconfig file relative to $srctree. This means that all Kconfig files
(both the top-level file and any source'd files) now use $srctree, which
makes the vast majority of scripts just work when running out-of-tree.
Also remove the note re. loading a subset of Kconfig files. Saying that
the top-level file and all source'd Kconfig files are looked up relative
to $srctree should make the behavior clear enough.
Print a note about the new behavior whenever the top-level Kconfig file
can't be opened, as this change could be breaking for some scripts.
This is a slight backwards-compatiblity break, so the major version will
be bumped.
Diffstat (limited to 'testsuite.py')
| -rw-r--r-- | testsuite.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/testsuite.py b/testsuite.py index a521128..cddce68 100644 --- a/testsuite.py +++ b/testsuite.py @@ -895,17 +895,17 @@ comment "advanced comment" <configuration with 14 symbols, main menu prompt "Main menu", srctree is current directory, config symbol prefix "CONFIG_", warnings disabled, printing of warnings to stderr enabled, undef. symbol assignment warnings disabled, redundant symbol assignment warnings enabled> """) - os.environ["srctree"] = "srctree value" + os.environ["srctree"] = "Kconfiglib" os.environ["CONFIG_"] = "CONFIG_ value" - c = Kconfig("Kconfiglib/tests/Krepr", warn=False) + c = Kconfig("tests/Krepr", warn=False) c.enable_warnings() c.disable_stderr_warnings() c.disable_redun_warnings() c.enable_undef_warnings() verify_repr(c, """ -<configuration with 14 symbols, main menu prompt "Main menu", srctree "srctree value", config symbol prefix "CONFIG_ value", warnings enabled, printing of warnings to stderr disabled, undef. symbol assignment warnings enabled, redundant symbol assignment warnings disabled> +<configuration with 14 symbols, main menu prompt "Main menu", srctree "Kconfiglib", config symbol prefix "CONFIG_ value", warnings enabled, printing of warnings to stderr disabled, undef. symbol assignment warnings enabled, redundant symbol assignment warnings disabled> """) os.environ.pop("srctree", None) @@ -987,7 +987,7 @@ g os.environ["srctree"] = srctree # Has symbol with empty help text, so disable warnings - c = Kconfig("Kconfiglib/tests/Klocation", warn=False) + c = Kconfig("tests/Klocation", warn=False) verify_locations(c.syms["SINGLE_DEF"].nodes, "tests/Klocation:4") @@ -1018,7 +1018,7 @@ g # Test recursive 'source' detection try: - Kconfig("Kconfiglib/tests/Krecursive1") + Kconfig("tests/Krecursive1") except KconfigError: pass except: @@ -1030,7 +1030,7 @@ g # TODO: Make an exception test helper try: - Kconfig("Kconfiglib/tests/Kmissingsource") + Kconfig("tests/Kmissingsource") except KconfigError: pass except: @@ -1039,7 +1039,7 @@ g fail("'source' with missing file did not raise exception") try: - Kconfig("Kconfiglib/tests/Kmissingrsource") + Kconfig("tests/Kmissingrsource") except KconfigError: pass except: @@ -1559,7 +1559,7 @@ g "defconfig_filename gave wrong file with $srctree unset") os.environ["srctree"] = "Kconfiglib/tests" - c = Kconfig("Kconfiglib/tests/Kdefconfig_srctree") + c = Kconfig("Kdefconfig_srctree") verify(c.defconfig_filename == "Kconfiglib/tests/sub/defconfig_in_sub", "defconfig_filename gave wrong file with $srctree set") |
