diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-09-27 14:41:30 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2017-09-27 17:08:15 +0200 |
| commit | f76a5240e217c5ba4bc752e9f7705b7cb67997d7 (patch) | |
| tree | 0b9a0ce4c82efabe49ba820a25d4c8626f1c8e17 | |
| parent | d18ca7216457e46cdc592b022aa534eec473b9c4 (diff) | |
Hide non-tristate symbols in non-y tristate choices
There's old ad-hoc code that does this in the C implementation, added in
f5eaa32 (kconfig: tristate choices with mixed tristate and boolean
values). Unless a tristate choice is in "y" mode, non-tristate symbols
get visibility "n".
There are currently no tristate choices with non-tristate symbols in the
kernel, so this never triggered.
Modify some self tests that weren't aware of this behavior, and add some
new ones. Also remove an old pointless test.
| -rw-r--r-- | kconfiglib.py | 9 | ||||
| -rw-r--r-- | testsuite.py | 14 |
2 files changed, 18 insertions, 5 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index cbb7e5e..f27e93a 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -3272,8 +3272,13 @@ def _get_visibility(sc): vis = sc._config._eval_max(vis, cond_expr) if isinstance(sc, Symbol) and sc._is_choice_sym: - if sc._type == TRISTATE and vis == "m" and \ - sc._parent.get_mode() == "y": + if sc._parent._type == TRISTATE and sc._type != TRISTATE and \ + sc._parent.get_mode() != "y": + # Non-tristate choice symbols in tristate choices depend on the + # choice being in mode "y" + vis = "n" + elif sc._type == TRISTATE and vis == "m" and \ + sc._parent.get_mode() == "y": # Choice symbols with visibility "m" are not visible if the # choice has mode "y" vis = "n" diff --git a/testsuite.py b/testsuite.py index 870195f..906a697 100644 --- a/testsuite.py +++ b/testsuite.py @@ -996,8 +996,18 @@ def run_selftests(): verify_sym_visibility("BOOL_menu_m", "n", "y") # Promoted verify_sym_visibility("BOOL_menu_y", "y", "y") verify_sym_visibility("BOOL_choice_n", "n", "n") - verify_sym_visibility("BOOL_choice_m", "n", "y") # Promoted + + # Non-tristate symbols in tristate choices are only visible if the choice + # is in "y" mode + verify_sym_visibility("BOOL_choice_m", "n", "n") + verify_sym_visibility("BOOL_choice_y", "y", "n") + c["TRISTATE_choice_m"].set_user_value("y") + c["TRISTATE_choice_y"].set_user_value("y") + # Still limited by the visibility of the choice + verify_sym_visibility("BOOL_choice_m", "n", "n") + # This one should become visible now though verify_sym_visibility("BOOL_choice_y", "y", "y") + verify_sym_visibility("TRISTATE_if_n", "n", "n") verify_sym_visibility("TRISTATE_if_m", "n", "m") verify_sym_visibility("TRISTATE_if_y", "y", "y") @@ -1030,8 +1040,6 @@ def run_selftests(): choice_tristate_menu_n_and_y \ = c.get_choices()[3:] - verify(choice_bool_n.get_name() == "BOOL_CHOICE_n", "Ops - testing the wrong choices") - verify_choice_visibility(choice_bool_n, "n", "n") verify_choice_visibility(choice_bool_m, "n", "y") # Promoted verify_choice_visibility(choice_bool_y, "y", "y") |
