From 5f3d307155f4db035b652738e9fc49ad8be0c792 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 25 Sep 2017 20:24:11 +0200 Subject: Fix 'default' on non-visible choice symbols Previously, 'default CHOICE_SYM [if ]' in a choice would skip any following 'default' properties if was non-'n'. However, those other defaults should still be considered if CHOICE_SYM has visibility 'n'. Previously, we'd immediately fall back to selecting the first visible symbol in the choice in that case. get_selection_from_defaults() now exactly mirrors sym_choice_default() from the C implementation, and got less convoluted too. Nothing in the kernel defconfigs triggered this. Add a new test case too. --- testsuite.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'testsuite.py') diff --git a/testsuite.py b/testsuite.py index 9d364c8..870195f 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1825,9 +1825,9 @@ def run_selftests(): choice_bool, choice_bool_opt, choice_tristate, choice_tristate_opt, \ choice_bool_m, choice_tristate_m, choice_defaults, \ - choice_no_type_bool, choice_no_type_tristate, \ - choice_missing_member_type_1, choice_missing_member_type_2, \ - choice_weird_syms = c.get_choices() + choice_defaults_not_visible, choice_no_type_bool, \ + choice_no_type_tristate, choice_missing_member_type_1, \ + choice_missing_member_type_2, choice_weird_syms = c.get_choices() for choice in (choice_bool, choice_bool_opt, choice_bool_m, choice_defaults): @@ -1901,6 +1901,13 @@ def run_selftests(): verify(choice_defaults.get_selection() is c["OPT_1"], "User selection should override defaults") + verify(choice_defaults_not_visible.get_selection_from_defaults() + is c["OPT_8"] and + choice_defaults_not_visible.get_selection() + is c["OPT_8"], + "Non-visible choice symbols should cause the next default to be " + "considered") + # Test "y" mode selection c["MODULES"].set_user_value("y") -- cgit v1.2.3