From 4fce6c53e1bdac803c77f0be8bedece22d73c30c Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 19 Sep 2017 07:06:17 +0200 Subject: Include 'if' deps. in _determine_actual_symbols() Previously, only WEIRD_1 and not WEIRD_2 would be considered not a choice symbol in the following fragment. This lead to a weird warning in U-Boot. choice config FOO config WEIRD_1 depends on FOO if FOO config WEIRD_2 endif endchoice Also add some testcases for weird choice symbols. --- testsuite.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'testsuite.py') diff --git a/testsuite.py b/testsuite.py index f1bbe9e..c8f504c 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1672,8 +1672,8 @@ 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 \ - = c.get_choices() + 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): @@ -1805,6 +1805,29 @@ def run_selftests(): (kconfiglib.BOOL, kconfiglib.BOOL), "Wrong types for second choice with missing member types") + # Verify that symbols in choices that depend on the preceding symbol aren't + # considered choice symbols + + def verify_is_normal_choice_symbol(sym): + verify(sym.is_choice_symbol() and + sym in choice_weird_syms.get_symbols() and + sym.get_parent() is choice_weird_syms, + "{} should be a normal choice symbol".format(sym.get_name())) + + def verify_is_weird_choice_symbol(sym): + verify(not sym.is_choice_symbol() and + sym not in choice_weird_syms.get_symbols() and + sym in choice_weird_syms.get_items() and + sym.get_parent() is choice_weird_syms, + "{} should be a weird (non-)choice symbol") + + verify_is_normal_choice_symbol(c["WS1"]) + verify_is_weird_choice_symbol(c["WS2"]) + verify_is_weird_choice_symbol(c["WS3"]) + verify_is_weird_choice_symbol(c["WS4"]) + verify_is_normal_choice_symbol(c["WS5"]) + verify_is_weird_choice_symbol(c["WS6"]) + # # Object dependencies # -- cgit v1.2.3