Ingo Molnar reported that 'make randconfig' was not covering choice blocks properly, resulting in certain config options being left out of randconfig testing altogether. With the following patch we: - properly randomize choice value for normal choice blocks - properly randomize for multi choice blocks - added several comments to explain what is going on The root cause of the bug was that SYMBOL_VALID was set on the symbol representing the choice block so clearing this did the trick initially. But testign revealed a few more issues that is now fixed.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -843,7 +843,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) · 842 unmodified lines | ||
| 843 | 843 | default: |
| 844 | 844 | continue; |
| 845 | 845 | } |
| 846 | − if (!sym_is_choice(sym) || mode != def_random) | |
| 846 | + if (!(sym_is_choice(sym) && mode == def_random)) | |
| 847 | 847 | sym->flags |= SYMBOL_DEF_USER; |
| 848 | 848 | break; |
| 849 | 849 | default: |
| @@ -856,28 +856,49 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) · 6 unmodified lines | ||
| 856 | 856 | |
| 857 | 857 | if (mode != def_random) |
| 858 | 858 | return; |
| 859 | − | |
| 859 | + /* | |
| 860 | + * We have different type of choice blocks. | |
| 861 | + * If curr.tri equal to mod then we can select several | |
| 862 | + * choice symbols in one block. | |
| 863 | + * In this case we do nothing. | |
| 864 | + * If curr.tri equal yes then only one symbol can be | |
| 865 | + * selected in a choice block and we set it to yes, | |
| 866 | + * and the rest to no. | |
| 867 | + */ | |
| 860 | 868 | for_all_symbols(i, csym) { |
| 861 | 869 | if (sym_has_value(csym) || !sym_is_choice(csym)) |
| 862 | 870 | continue; |
| 863 | 871 | |
| 864 | 872 | sym_calc_value(csym); |
| 873 | + | |
| 874 | + if (csym->curr.tri != yes) | |
| 875 | + continue; | |
| 876 | + | |
| 865 | 877 | prop = sym_get_choice_prop(csym); |
| 866 | − def = -1; | |
| 867 | − while (1) { | |
| 868 | − cnt = 0; | |
| 869 | − expr_list_for_each_sym(prop->expr, e, sym) { | |
| 870 | − if (sym->visible == no) | |
| 871 | − continue; | |
| 872 | − if (def == cnt++) { | |
| 873 | − csym->def[S_DEF_USER].val = sym; | |
| 874 | − break; | |
| 875 | − } | |
| 878 | + | |
| 879 | + /* count entries in choice block */ | |
| 880 | + cnt = 0; | |
| 881 | + expr_list_for_each_sym(prop->expr, e, sym) | |
| 882 | + cnt++; | |
| 883 | + | |
| 884 | + /* | |
| 885 | + * find a random value and set it to yes, | |
| 886 | + * set the rest to no so we have only one set | |
| 887 | + */ | |
| 888 | + def = (rand() % cnt); | |
| 889 | + | |
| 890 | + cnt = 0; | |
| 891 | + expr_list_for_each_sym(prop->expr, e, sym) { | |
| 892 | + if (def == cnt++) { | |
| 893 | + sym->def[S_DEF_USER].tri = yes; | |
| 894 | + csym->def[S_DEF_USER].val = sym; | |
| 895 | + } | |
| 896 | + else { | |
| 897 | + sym->def[S_DEF_USER].tri = no; | |
| 876 | 898 | } |
| 877 | − if (def >= 0 || cnt < 2) | |
| 878 | − break; | |
| 879 | − def = (rand() % cnt) + 1; | |
| 880 | 899 | } |
| 881 | 900 | csym->flags |= SYMBOL_DEF_USER; |
| 901 | + /* clear VALID to get value calculated */ | |
| 902 | + csym->flags &= ~(SYMBOL_VALID); | |
| 882 | 903 | } |
| 883 | 904 | } |