diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-13 18:22:12 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-13 18:22:12 +0200 |
| commit | ac692af07a123b3d623e51df7f1e7a10b88c1ddd (patch) | |
| tree | c2e5f410748fb544f2c1e4b320729bb997553410 /testsuite.py | |
| parent | 47ab37c4e7c5c917bb57c0a6bdfbca72d2f2941d (diff) | |
Fix absolute $srctree prefixes showing up on gsource'd files
When using gsource with $srctree set to an absolute path, the $srctree
prefix would show up in MenuNode.filename, trickling its way into e.g.
generated documentation.
This was due to a broken test: os.path.isabs() was checked after joining
the pattern with $srctree, making it mistake an absolute $srctree for an
absolute path in the Kconfig file.
Fix the test.
Diffstat (limited to 'testsuite.py')
| -rw-r--r-- | testsuite.py | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/testsuite.py b/testsuite.py index a8254ea..189a325 100644 --- a/testsuite.py +++ b/testsuite.py @@ -890,53 +890,54 @@ g os.environ["TESTS_DIR_FROM_ENV"] = "tests" os.environ["SUB_DIR_FROM_ENV"] = "sub" - os.environ["srctree"] = "Kconfiglib/" os.environ["_SOURCED"] = "_sourced" os.environ["_RSOURCED"] = "_rsourced" os.environ["_GSOURCED"] = "_gsourced" os.environ["_GRSOURCED"] = "_grsourced" + # Test twice, with $srctree as a relative and an absolute path, + # respectively + for srctree in "Kconfiglib", os.path.abspath("Kconfiglib"): + os.environ["srctree"] = srctree - # Has symbol with empty help text, so disable warnings - c = Kconfig("tests/Klocation", warn=False) + # Has symbol with empty help text, so disable warnings + c = Kconfig("tests/Klocation", warn=False) - os.environ.pop("TESTS_DIR_FROM_ENV", None) - os.environ.pop("SUB_DIR_FROM_ENV", None) - os.environ.pop("srctree", None) + verify_locations(c.syms["SINGLE_DEF"].nodes, "tests/Klocation:4") - verify_locations(c.syms["SINGLE_DEF"].nodes, "tests/Klocation:4") + verify_locations(c.syms["MULTI_DEF"].nodes, + "tests/Klocation:7", + "tests/Klocation:37", + "tests/Klocation_sourced:3", + "tests/sub/Klocation_rsourced:2", + "tests/sub/Klocation_gsourced1:1", + "tests/sub/Klocation_gsourced2:1", + "tests/sub/Klocation_grsourced1:1", + "tests/sub/Klocation_grsourced2:1", + "tests/Klocation:60") - verify_locations(c.syms["MULTI_DEF"].nodes, - "tests/Klocation:7", - "tests/Klocation:37", - "tests/Klocation_sourced:3", - "tests/sub/Klocation_rsourced:2", - "tests/sub/Klocation_gsourced1:1", - "tests/sub/Klocation_gsourced2:1", - "tests/sub/Klocation_grsourced1:1", - "tests/sub/Klocation_grsourced2:1", - "tests/Klocation:60") + verify_locations(c.named_choices["CHOICE"].nodes, + "tests/Klocation_sourced:5") - verify_locations(c.named_choices["CHOICE"].nodes, - "tests/Klocation_sourced:5") + verify_locations([c.syms["MENU_HOOK"].nodes[0].next], + "tests/Klocation_sourced:12") - verify_locations([c.syms["MENU_HOOK"].nodes[0].next], - "tests/Klocation_sourced:12") + verify_locations([c.syms["COMMENT_HOOK"].nodes[0].next], + "tests/Klocation_sourced:18") - verify_locations([c.syms["COMMENT_HOOK"].nodes[0].next], - "tests/Klocation_sourced:18") + # Test recursive 'source' detection - # Test recursive 'source' detection + try: + Kconfig("Kconfiglib/tests/Krecursive1") + except KconfigError: + pass + except: + fail("recursive 'source' raised wrong exception") + else: + fail("recursive 'source' did not raise exception") - try: - Kconfig("Kconfiglib/tests/Krecursive1") - except KconfigError: - pass - except: - fail("recursive 'source' raised wrong exception") - else: - fail("recursive 'source' did not raise exception") + os.environ.pop("srctree", None) print("Testing Kconfig.choices/menus/comments") |
