Merge tag 'kbuild-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[sfrench/cifs-2.6.git] / scripts / kconfig / tests / choice_randomize / __init__.py
1 # SPDX-License-Identifier: GPL-2.0-only
2 """
3 Randomize all dependent choices
4
5 This is a somewhat tricky case for randconfig; the visibility of one choice is
6 determined by a member of another choice. Randconfig should be able to generate
7 all possible patterns.
8 """
9
10
11 def test(conf):
12
13     expected0 = False
14     expected1 = False
15     expected2 = False
16
17     for i in range(100):
18         assert conf.randconfig(seed=i) == 0
19
20         if conf.config_matches('expected_config0'):
21             expected0 = True
22         elif conf.config_matches('expected_config1'):
23             expected1 = True
24         elif conf.config_matches('expected_config2'):
25             expected2 = True
26         else:
27             assert False
28
29         if expected0 and expected1 and expected2:
30             break
31
32     assert expected0
33     assert expected1
34     assert expected2