History

kconfig: remove tristate choice support

I previously submitted a fix for a bug in the choice feature [1], where I mentioned, "Another (much cleaner) approach would be to remove the tristate choice support entirely". There are more issues in the tristate choice feature. For example, you can observe a couple of bugs in the following test code. [Test Code] config MODULES def_bool y modules choice prompt "tristate choice" default A config A tristate "A" config B tristate "B" endchoice Bug 1: the 'default' property is not correctly processed 'make alldefconfig' produces: CONFIG_MODULES=y # CONFIG_A is not set # CONFIG_B is not set However, the correct output should be: CONFIG_MODULES=y CONFIG_A=y # CONFIG_B is not set The unit test file, scripts/kconfig/tests/choice/alldef_expected_config, is wrong as well. Bug 2: choice members never get 'y' with randconfig For the test code above, the following combinations are possible: A B (1) y n (2) n y (3) m m (4) m n (5) n m (6) n n 'make randconfig' never produces (1) or (2). These bugs are fixable, but a more critical problem is the lack of a sensible syntax to specify the default for the tristate choice. The default for the choice must be one of the choice members, which cannot specify any of the patterns (3) through (6) above. In addition, I have never seen it being used in a useful way. The following commits removed unnecessary use of tristate choices: - df8df5e4bc37 ("usb: get rid of 'choice' for legacy gadget drivers") - bfb57ef0544a ("rapidio: remove choice for enumeration") This commit removes the tristate choice support entirely, which allows me to delete a lot of code, making further refactoring easier. Note: This includes the revert of commit fa64e5f6a35e ("kconfig/symbol.c: handle choice_values that depend on 'm' symbols"). It was suspicious because it did not address the root cause but introduced inconsistency in visibility between choice members and other symbols. [1]: https://lore.kernel.org/linux-kbuild/20240427104231.2728905-1-masahiroy@kernel.org/T/#m0a1bb6992581462ceca861b409bb33cb8fd7dbae

Masahiro Yamada committed 2 years ago

Commit fde19251 parent 03638aa28 files · +45 −325Browse files

Unified · Split

28 files
  1. Documentation/kbuild/kconfig-language.rst +3 −10
  2. scripts/kconfig/conf.c +6 −50
  3. scripts/kconfig/confdata.c +3 −14
  4. scripts/kconfig/gconf.c +2 −4
  5. scripts/kconfig/mconf.c +7 −21
  6. scripts/kconfig/menu.c +2 −29
  7. scripts/kconfig/nconf.c +5 −23
  8. scripts/kconfig/parser.y +14 −9
  9. scripts/kconfig/qconf.cc +1 −1
  10. scripts/kconfig/symbol.c +2 −20
  11. scripts/kconfig/tests/choice/Kconfig +0 −17
  12. scripts/kconfig/tests/choice/__init__.py +0 −10
  13. scripts/kconfig/tests/choice/alldef_expected_config +0 −3
  14. scripts/kconfig/tests/choice/allmod_expected_config +0 −3
  15. scripts/kconfig/tests/choice/allno_expected_config +0 −3
  16. scripts/kconfig/tests/choice/allyes_expected_config +0 −3
  17. scripts/kconfig/tests/choice/oldask0_expected_stdout +0 −4
  18. scripts/kconfig/tests/choice/oldask1_config +0 −1
  19. scripts/kconfig/tests/choice/oldask1_expected_stdout +0 −9
  20. scripts/kconfig/tests/choice_value_with_m_dep/Kconfig +0 −21
  21. scripts/kconfig/tests/choice_value_with_m_dep/__init__.py +0 −16
  22. scripts/kconfig/tests/choice_value_with_m_dep/config +0 −2
  23. scripts/kconfig/tests/choice_value_with_m_dep/expected_config +0 −3
  24. scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout +0 −4
  25. scripts/kconfig/tests/inter_choice/Kconfig +0 −25
  26. scripts/kconfig/tests/inter_choice/__init__.py +0 −15
  27. scripts/kconfig/tests/inter_choice/defconfig +0 −1
  28. scripts/kconfig/tests/inter_choice/expected_config +0 −4
Documentation/kbuild/kconfig-language.rst+3−10
@@ -409,16 +409,9 @@ choices:: · 408 unmodified lines
409409 "endchoice"
410410
411411 This defines a choice group and accepts any of the above attributes as
412−options. A choice can only be of type bool or tristate. If no type is
413−specified for a choice, its type will be determined by the type of
414−the first choice element in the group or remain unknown if none of the
415−choice elements have a type specified, as well.
416−
417−While a boolean choice only allows a single config entry to be
418−selected, a tristate choice also allows any number of config entries
419−to be set to 'm'. This can be used if multiple drivers for a single
420−hardware exists and only a single driver can be compiled/loaded into
421−the kernel, but all drivers can be compiled as modules.
412+options.
413+
414+A choice only allows a single config entry to be selected.
422415
423416 comment::
424417
scripts/kconfig/conf.c+6−50
@@ -114,21 +114,13 @@ static void set_randconfig_seed(void) · 113 unmodified lines
114114 srand(seed);
115115 }
116116
117−static bool randomize_choice_values(struct symbol *csym)
117+static void randomize_choice_values(struct symbol *csym)
118118 {
119119 struct property *prop;
120120 struct symbol *sym;
121121 struct expr *e;
122122 int cnt, def;
123123
124− /*
125− * If choice is mod then we may have more items selected
126− * and if no then no-one.
127− * In both cases stop.
128− */
129− if (csym->curr.tri != yes)
130− return false;
131−
132124 prop = sym_get_choice_prop(csym);
133125
134126 /* count entries in choice block */
@@ -157,8 +149,6 @@ static bool randomize_choice_values(struct symbol *csym) · 22 unmodified lines
157149 csym->flags |= SYMBOL_DEF_USER;
158150 /* clear VALID to get value calculated */
159151 csym->flags &= ~SYMBOL_VALID;
160−
161− return true;
162152 }
163153
164154 enum conf_def_mode {
@@ -269,15 +259,6 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 104 unmodified lines
269259
270260 sym_clear_all_valid();
271261
272− /*
273− * We have different type of choice blocks.
274− * If curr.tri equals to mod then we can select several
275− * choice symbols in one block.
276− * In this case we do nothing.
277− * If curr.tri equals yes then only one symbol can be
278− * selected in a choice block and we set it to yes,
279− * and the rest to no.
280− */
281262 if (mode != def_random) {
282263 for_all_symbols(csym) {
283264 if ((sym_is_choice(csym) && !sym_has_value(csym)) ||
@@ -292,11 +273,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) · 8 unmodified lines
292273
293274 sym_calc_value(csym);
294275 if (mode == def_random)
295− has_changed |= randomize_choice_values(csym);
296− else {
276+ randomize_choice_values(csym);
277+ else
297278 set_all_choice_values(csym);
298− has_changed = true;
299− }
279+ has_changed = true;
300280 }
301281
302282 return has_changed;
@@ -454,27 +434,6 @@ static void conf_choice(struct menu *menu) · 151 unmodified lines
454434
455435 sym = menu->sym;
456436 is_new = !sym_has_value(sym);
457− if (sym_is_changeable(sym)) {
458− conf_sym(menu);
459− sym_calc_value(sym);
460− switch (sym_get_tristate_value(sym)) {
461− case no:
462− case mod:
463− return;
464− case yes:
465− break;
466− }
467− } else {
468− switch (sym_get_tristate_value(sym)) {
469− case no:
470− return;
471− case mod:
472− printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
473− return;
474− case yes:
475− break;
476− }
477− }
478437
479438 while (1) {
480439 int cnt, def;
@@ -596,9 +555,7 @@ static void conf(struct menu *menu) · 115 unmodified lines
596555
597556 if (sym_is_choice(sym)) {
598557 conf_choice(menu);
599− if (sym->curr.tri != mod)
600− return;
601− goto conf_childs;
558+ return;
602559 }
603560
604561 switch (sym->type) {
@@ -631,8 +588,7 @@ static void check_conf(struct menu *menu) · 26 unmodified lines
631588
632589 sym = menu->sym;
633590 if (sym && !sym_has_value(sym) &&
634− (sym_is_changeable(sym) ||
635− (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes))) {
591+ (sym_is_changeable(sym) || sym_is_choice(sym))) {
636592
637593 switch (input_mode) {
638594 case listnewconfig:
scripts/kconfig/confdata.c+3−14
@@ -462,22 +462,12 @@ load: · 461 unmodified lines
462462
463463 if (sym && sym_is_choice_value(sym)) {
464464 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
465− switch (sym->def[def].tri) {
466− case no:
467− break;
468− case mod:
469− if (cs->def[def].tri == yes) {
470− conf_warning("%s creates inconsistent choice state", sym->name);
471− cs->flags &= ~def_flags;
472− }
473− break;
474− case yes:
465+ if (sym->def[def].tri == yes) {
475466 if (cs->def[def].tri != no)
476467 conf_warning("override: %s changes choice state", sym->name);
477468 cs->def[def].val = sym;
478− break;
469+ cs->def[def].tri = yes;
479470 }
480− cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
481471 }
482472 }
483473 free(line);
@@ -806,8 +796,7 @@ int conf_write_defconfig(const char *filename) · 322 unmodified lines
806796
807797 ds = sym_choice_default(choice->sym);
808798 if (sym == ds) {
809− if ((sym->type == S_BOOLEAN) &&
810− sym_get_tristate_value(sym) == yes)
799+ if (sym_get_tristate_value(sym) == yes)
811800 continue;
812801 }
813802 }
scripts/kconfig/gconf.c+2−4
@@ -1067,10 +1067,8 @@ static gchar **fill_row(struct menu *menu) · 1066 unmodified lines
10671067 row[COL_VALUE] =
10681068 g_strdup(menu_get_prompt(def_menu));
10691069
1070− if (sym_get_type(sym) == S_BOOLEAN) {
1071− row[COL_BTNVIS] = GINT_TO_POINTER(FALSE);
1072− return row;
1073− }
1070+ row[COL_BTNVIS] = GINT_TO_POINTER(FALSE);
1071+ return row;
10741072 }
10751073 if (sym->flags & SYMBOL_CHOICEVAL)
10761074 row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
scripts/kconfig/mconf.c+7−21
@@ -523,28 +523,14 @@ static void build_conf(struct menu *menu) · 522 unmodified lines
523523 def_menu = child;
524524 }
525525
526− val = sym_get_tristate_value(sym);
527− if (sym_is_changeable(sym)) {
528− switch (val) {
529− case yes: ch = '*'; break;
530− case mod: ch = 'M'; break;
531− default: ch = ' '; break;
532− }
533− item_make("<%c>", ch);
534− item_set_tag('t');
535− item_set_data(menu);
536− } else {
537− item_make(" ");
538− item_set_tag(def_menu ? 't' : ':');
539− item_set_data(menu);
540− }
526+ item_make(" ");
527+ item_set_tag(def_menu ? 't' : ':');
528+ item_set_data(menu);
541529
542530 item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
543− if (val == yes) {
544− if (def_menu)
545− item_add_str(" (%s) --->", menu_get_prompt(def_menu));
546− return;
547− }
531+ if (def_menu)
532+ item_add_str(" (%s) --->", menu_get_prompt(def_menu));
533+ return;
548534 } else {
549535 if (menu == current_menu) {
550536 item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
@@ -814,7 +800,7 @@ static void conf(struct menu *menu, struct menu *active_menu) · 263 unmodified lines
814800 conf(submenu, NULL);
815801 break;
816802 case 't':
817− if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
803+ if (sym_is_choice(sym))
818804 conf_choice(submenu);
819805 else if (submenu->prompt->type == P_MENU)
820806 conf(submenu, NULL);
scripts/kconfig/menu.c+2−29
@@ -321,17 +321,6 @@ static void _menu_finalize(struct menu *parent, bool inside_choice) · 320 unmodified lines
321321 is_choice = true;
322322
323323 if (is_choice) {
324− if (sym->type == S_UNKNOWN) {
325− /* find the first choice value to find out choice type */
326− current_entry = parent;
327− for (menu = parent->list; menu; menu = menu->next) {
328− if (menu->sym && menu->sym->type != S_UNKNOWN) {
329− menu_set_type(menu->sym->type);
330− break;
331− }
332− }
333− }
334−
335324 /*
336325 * Use the choice itself as the parent dependency of
337326 * the contained items. This turns the mode of the
@@ -503,22 +492,6 @@ static void _menu_finalize(struct menu *parent, bool inside_choice) · 165 unmodified lines
503492 menu->sym && !sym_is_choice_value(menu->sym)) {
504493 current_entry = menu;
505494 menu->sym->flags |= SYMBOL_CHOICEVAL;
506− /* Non-tristate choice values of tristate choices must
507− * depend on the choice being set to Y. The choice
508− * values' dependencies were propagated to their
509− * properties above, so the change here must be re-
510− * propagated.
511− */
512− if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
513− basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
514− menu->dep = expr_alloc_and(basedep, menu->dep);
515− for (prop = menu->sym->prop; prop; prop = prop->next) {
516− if (prop->menu != menu)
517− continue;
518− prop->visible.expr = expr_alloc_and(expr_copy(basedep),
519− prop->visible.expr);
520− }
521− }
522495 menu_add_symbol(P_CHOICE, sym, NULL);
523496 prop = sym_get_choice_prop(sym);
524497 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
@@ -578,13 +551,13 @@ static void _menu_finalize(struct menu *parent, bool inside_choice) · 53 unmodified lines
578551
579552 /*
580553 * For choices, add a reverse dependency (corresponding to a select) of
581− * '<visibility> && m'. This prevents the user from setting the choice
554+ * '<visibility> && y'. This prevents the user from setting the choice
582555 * mode to 'n' when the choice is visible.
583556 */
584557 if (sym && sym_is_choice(sym) && parent->prompt) {
585558 sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
586559 expr_alloc_and(parent->prompt->visible.expr,
587− expr_alloc_symbol(&symbol_mod)));
560+ expr_alloc_symbol(&symbol_yes)));
588561 }
589562 }
590563
scripts/kconfig/nconf.c+5−23
@@ -825,30 +825,13 @@ static void build_conf(struct menu *menu) · 824 unmodified lines
825825 }
826826
827827 val = sym_get_tristate_value(sym);
828− if (sym_is_changeable(sym)) {
829− switch (val) {
830− case yes:
831− ch = '*';
832− break;
833− case mod:
834− ch = 'M';
835− break;
836− default:
837− ch = ' ';
838− break;
839− }
840− item_make(menu, 't', "<%c>", ch);
841− } else {
842− item_make(menu, def_menu ? 't' : ':', " ");
843− }
828+ item_make(menu, def_menu ? 't' : ':', " ");
844829
845830 item_add_str("%*c%s", indent + 1,
846831 ' ', menu_get_prompt(menu));
847− if (val == yes) {
848− if (def_menu)
849− item_add_str(" (%s) --->", menu_get_prompt(def_menu));
850− return;
851− }
832+ if (def_menu)
833+ item_add_str(" (%s) --->", menu_get_prompt(def_menu));
834+ return;
852835 } else {
853836 if (menu == current_menu) {
854837 item_make(menu, ':',
@@ -1191,8 +1174,7 @@ static void selected_conf(struct menu *menu, struct menu *active_menu) · 336 unmodified lines
11911174 conf(submenu);
11921175 break;
11931176 case 't':
1194− if (sym_is_choice(sym) &&
1195− sym_get_tristate_value(sym) == yes)
1177+ if (sym_is_choice(sym))
11961178 conf_choice(submenu);
11971179 else if (submenu->prompt &&
11981180 submenu->prompt->type == P_MENU)
scripts/kconfig/parser.y+14−9
@@ -90,7 +90,7 @@ static bool inside_choice = false; · 89 unmodified lines
9090
9191 %type <symbol> nonconst_symbol
9292 %type <symbol> symbol
93−%type <type> type logic_type default
93+%type <type> type default
9494 %type <expr> expr
9595 %type <expr> if_expr
9696 %type <string> end
@@ -153,6 +153,12 @@ config_stmt: config_entry_start config_option_list · 56 unmodified lines
153153 current_entry->filename, current_entry->lineno);
154154 yynerrs++;
155155 }
156+
157+ if (current_entry->sym->type != S_BOOLEAN) {
158+ fprintf(stderr, "%s:%d: error: choice member must be bool\n",
159+ current_entry->filename, current_entry->lineno);
160+ yynerrs++;
161+ }
156162 }
157163
158164 printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno);
@@ -235,6 +241,8 @@ choice: T_CHOICE T_EOL · 76 unmodified lines
235241
236242 menu_add_entry(sym);
237243 menu_add_expr(P_CHOICE, NULL, NULL);
244+ menu_set_type(S_BOOLEAN);
245+
238246 printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno);
239247 };
240248
@@ -277,10 +285,10 @@ choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL · 36 unmodified lines
277285 printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno);
278286 };
279287
280−choice_option: logic_type prompt_stmt_opt T_EOL
288+choice_option: T_BOOL T_WORD_QUOTE if_expr T_EOL
281289 {
282− menu_set_type($1);
283− printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1);
290+ menu_add_prompt(P_PROMPT, $2, $3);
291+ printd(DEBUG_PARSE, "%s:%d:bool\n", cur_filename, cur_lineno);
284292 };
285293
286294 choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
@@ -290,15 +298,12 @@ choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL · 3 unmodified lines
290298 };
291299
292300 type:
293− logic_type
301+ T_BOOL { $$ = S_BOOLEAN; }
302+ | T_TRISTATE { $$ = S_TRISTATE; }
294303 | T_INT { $$ = S_INT; }
295304 | T_HEX { $$ = S_HEX; }
296305 | T_STRING { $$ = S_STRING; }
297306
298−logic_type:
299− T_BOOL { $$ = S_BOOLEAN; }
300− | T_TRISTATE { $$ = S_TRISTATE; }
301−
302307 default:
303308 T_DEFAULT { $$ = S_UNKNOWN; }
304309 | T_DEF_BOOL { $$ = S_BOOLEAN; }
scripts/kconfig/qconf.cc+1−1
@@ -147,7 +147,7 @@ void ConfigItem::updateMenu(void) · 146 unmodified lines
147147 expr = sym_get_tristate_value(sym);
148148 switch (expr) {
149149 case yes:
150− if (sym_is_choice_value(sym) && type == S_BOOLEAN)
150+ if (sym_is_choice_value(sym))
151151 setIcon(promptColIdx, choiceYesIcon);
152152 else
153153 setIcon(promptColIdx, symbolYesIcon);
scripts/kconfig/symbol.c+2−20
@@ -44,12 +44,8 @@ enum symbol_type sym_get_type(struct symbol *sym) · 43 unmodified lines
4444 {
4545 enum symbol_type type = sym->type;
4646
47− if (type == S_TRISTATE) {
48− if (sym_is_choice_value(sym) && sym->visible == yes)
49− type = S_BOOLEAN;
50− else if (modules_val == no)
51− type = S_BOOLEAN;
52− }
47+ if (type == S_TRISTATE && modules_val == no)
48+ type = S_BOOLEAN;
5349 return type;
5450 }
5551
@@ -208,26 +204,12 @@ static void sym_set_all_changed(void) · 152 unmodified lines
208204 static void sym_calc_visibility(struct symbol *sym)
209205 {
210206 struct property *prop;
211− struct symbol *choice_sym = NULL;
212207 tristate tri;
213208
214209 /* any prompt visible? */
215210 tri = no;
216−
217− if (sym_is_choice_value(sym))
218− choice_sym = prop_get_symbol(sym_get_choice_prop(sym));
219−
220211 for_all_prompts(sym, prop) {
221212 prop->visible.tri = expr_calc_value(prop->visible.expr);
222− /*
223− * Tristate choice_values with visibility 'mod' are
224− * not visible if the corresponding choice's value is
225− * 'yes'.
226− */
227− if (choice_sym && sym->type == S_TRISTATE &&
228− prop->visible.tri == mod && choice_sym->curr.tri == yes)
229− prop->visible.tri = no;
230−
231213 tri = EXPR_OR(tri, prop->visible.tri);
232214 }
233215 if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
scripts/kconfig/tests/choice/Kconfig+0−17
@@ -1,10 +1,5 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3−config MODULES
4− bool "Enable loadable module support"
5− modules
6− default y
7−
83 choice
94 prompt "boolean choice"
105 default BOOL_CHOICE1
@@ -16,15 +11,3 @@ config BOOL_CHOICE1 · 5 unmodified lines
1611 bool "choice 1"
1712
1813 endchoice
19−
20−choice
21− prompt "tristate choice"
22− default TRI_CHOICE1
23−
24−config TRI_CHOICE0
25− tristate "choice 0"
26−
27−config TRI_CHOICE1
28− tristate "choice 1"
29−
30−endchoice
scripts/kconfig/tests/choice/__init__.py+0−10
@@ -1,11 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0
22 """
33 Basic choice tests.
4−
5−The handling of 'choice' is a bit complicated part in Kconfig.
6−
7−The behavior of 'y' choice is intuitive. If choice values are tristate,
8−the choice can be 'm' where each value can be enabled independently.
94 """
105
116
@@ -14,11 +9,6 @@ def test_oldask0(conf): · 2 unmodified lines
149 assert conf.stdout_contains('oldask0_expected_stdout')
1510
1611
17−def test_oldask1(conf):
18− assert conf.oldaskconfig('oldask1_config') == 0
19− assert conf.stdout_contains('oldask1_expected_stdout')
20−
21−
2212 def test_allyes(conf):
2313 assert conf.allyesconfig() == 0
2414 assert conf.config_contains('allyes_expected_config')
scripts/kconfig/tests/choice/alldef_expected_config+0−3
@@ -1,5 +1,2 @@
1−CONFIG_MODULES=y
21 # CONFIG_BOOL_CHOICE0 is not set
32 CONFIG_BOOL_CHOICE1=y
4−# CONFIG_TRI_CHOICE0 is not set
5−# CONFIG_TRI_CHOICE1 is not set
scripts/kconfig/tests/choice/allmod_expected_config+0−3
@@ -1,5 +1,2 @@
1−CONFIG_MODULES=y
21 # CONFIG_BOOL_CHOICE0 is not set
32 CONFIG_BOOL_CHOICE1=y
4−CONFIG_TRI_CHOICE0=m
5−CONFIG_TRI_CHOICE1=m
scripts/kconfig/tests/choice/allno_expected_config+0−3
@@ -1,5 +1,2 @@
1−# CONFIG_MODULES is not set
21 # CONFIG_BOOL_CHOICE0 is not set
32 CONFIG_BOOL_CHOICE1=y
4−# CONFIG_TRI_CHOICE0 is not set
5−CONFIG_TRI_CHOICE1=y
scripts/kconfig/tests/choice/allyes_expected_config+0−3
@@ -1,5 +1,2 @@
1−CONFIG_MODULES=y
21 # CONFIG_BOOL_CHOICE0 is not set
32 CONFIG_BOOL_CHOICE1=y
4−# CONFIG_TRI_CHOICE0 is not set
5−CONFIG_TRI_CHOICE1=y
scripts/kconfig/tests/choice/oldask0_expected_stdout+0−4
@@ -1,8 +1,4 @@
1−Enable loadable module support (MODULES) [Y/n/?] (NEW)
21 boolean choice
32 1. choice 0 (BOOL_CHOICE0) (NEW)
43 > 2. choice 1 (BOOL_CHOICE1) (NEW)
54 choice[1-2?]:
6−tristate choice [M/y/?] (NEW)
7− choice 0 (TRI_CHOICE0) [N/m/?] (NEW)
8− choice 1 (TRI_CHOICE1) [N/m/?] (NEW)
scripts/kconfig/tests/choice/oldask1_config+0−1
@@ -1 +0,0 @@
1−# CONFIG_MODULES is not set
scripts/kconfig/tests/choice/oldask1_expected_stdout+0−9
@@ -1,9 +0,0 @@
1−Enable loadable module support (MODULES) [N/y/?]
2−boolean choice
3− 1. choice 0 (BOOL_CHOICE0) (NEW)
4−> 2. choice 1 (BOOL_CHOICE1) (NEW)
5−choice[1-2?]:
6−tristate choice
7− 1. choice 0 (TRI_CHOICE0) (NEW)
8−> 2. choice 1 (TRI_CHOICE1) (NEW)
9−choice[1-2?]:
scripts/kconfig/tests/choice_value_with_m_dep/Kconfig+0−21
@@ -1,21 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0
2−
3−config MODULES
4− def_bool y
5− modules
6−
7−config DEP
8− tristate
9− default m
10−
11−choice
12− prompt "Tristate Choice"
13−
14−config CHOICE0
15− tristate "Choice 0"
16−
17−config CHOICE1
18− tristate "Choice 1"
19− depends on DEP
20−
21−endchoice
scripts/kconfig/tests/choice_value_with_m_dep/__init__.py+0−16
@@ -1,16 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0
2−"""
3−Hide tristate choice values with mod dependency in y choice.
4−
5−If tristate choice values depend on symbols set to 'm', they should be
6−hidden when the choice containing them is changed from 'm' to 'y'
7−(i.e. exclusive choice).
8−
9−Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
10−"""
11−
12−
13−def test(conf):
14− assert conf.oldaskconfig('config', 'y') == 0
15− assert conf.config_contains('expected_config')
16− assert conf.stdout_contains('expected_stdout')
scripts/kconfig/tests/choice_value_with_m_dep/config+0−2
@@ -1,2 +0,0 @@
1−CONFIG_CHOICE0=m
2−CONFIG_CHOICE1=m
scripts/kconfig/tests/choice_value_with_m_dep/expected_config+0−3
@@ -1,3 +0,0 @@
1−CONFIG_MODULES=y
2−CONFIG_DEP=m
3−CONFIG_CHOICE0=y
scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout+0−4
@@ -1,4 +0,0 @@
1−Tristate Choice [M/y/?] y
2−Tristate Choice
3−> 1. Choice 0 (CHOICE0)
4−choice[1]: 1
scripts/kconfig/tests/inter_choice/Kconfig+0−25
@@ -1,25 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0
2−
3−config MODULES
4− def_bool y
5− modules
6−
7−choice
8− prompt "Choice"
9−
10−config CHOICE_VAL0
11− tristate "Choice 0"
12−
13−config CHOIVE_VAL1
14− tristate "Choice 1"
15−
16−endchoice
17−
18−choice
19− prompt "Another choice"
20− depends on CHOICE_VAL0
21−
22−config DUMMY
23− bool "dummy"
24−
25−endchoice
scripts/kconfig/tests/inter_choice/__init__.py+0−15
@@ -1,15 +0,0 @@
1−# SPDX-License-Identifier: GPL-2.0
2−"""
3−Do not affect user-assigned choice value by another choice.
4−
5−Handling of state flags for choices is complecated. In old days,
6−the defconfig result of a choice could be affected by another choice
7−if those choices interact by 'depends on', 'select', etc.
8−
9−Related Linux commit: fbe98bb9ed3dae23e320c6b113e35f129538d14a
10−"""
11−
12−
13−def test(conf):
14− assert conf.defconfig('defconfig') == 0
15− assert conf.config_contains('expected_config')
scripts/kconfig/tests/inter_choice/defconfig+0−1
@@ -1 +0,0 @@
1−CONFIG_CHOICE_VAL0=y
scripts/kconfig/tests/inter_choice/expected_config+0−4
@@ -1,4 +0,0 @@
1−CONFIG_MODULES=y
2−CONFIG_CHOICE_VAL0=y
3−# CONFIG_CHOIVE_VAL1 is not set
4−CONFIG_DUMMY=y