aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/tests
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-03-13 05:12:08 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-03-25 13:04:03 -0400
commitee236610653ede74c91f4c35f731047f5b76d667 (patch)
treeeffba19f5c7d8b29ab468c591faaba8538155900 /scripts/kconfig/tests
parent930c429a656fdba0c7f76b9a36ec2698f946e8e3 (diff)
kconfig: tests: check visibility of tristate choice values in y choice
If tristate choice values depend on symbols set to 'm', they should be hidden when the choice containing them is changed from 'm' to 'y' (i.e. exclusive choice). This issue was fixed by commit fa64e5f6a35e ("kconfig/symbol.c: handle choice_values that depend on 'm' symbols"). Add a test case to avoid regression. For the input in this unit test, there is a room for argument if "# CONFIG_CHOICE1 is not set" should be written to the .config file. After commit fa64e5f6a35e, this line was written to the .config file. With commit cb67ab2cd2b8 ("kconfig: do not write choice values when their dependency becomes n"), it is not written now. In this test, "# CONFIG_CHOICE1 is not set" is don't care. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
Diffstat (limited to 'scripts/kconfig/tests')
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/Kconfig19
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/__init__.py15
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/config2
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/expected_config3
-rw-r--r--scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout4
5 files changed, 43 insertions, 0 deletions
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
new file mode 100644
index 000000000000..11ac25c26040
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
@@ -0,0 +1,19 @@
1config MODULES
2 def_bool y
3 option modules
4
5config DEP
6 tristate
7 default m
8
9choice
10 prompt "Tristate Choice"
11
12config CHOICE0
13 tristate "Choice 0"
14
15config CHOICE1
16 tristate "Choice 1"
17 depends on DEP
18
19endchoice
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
new file mode 100644
index 000000000000..f8d728c7b101
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
@@ -0,0 +1,15 @@
1"""
2Hide tristate choice values with mod dependency in y choice.
3
4If tristate choice values depend on symbols set to 'm', they should be
5hidden when the choice containing them is changed from 'm' to 'y'
6(i.e. exclusive choice).
7
8Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
9"""
10
11
12def test(conf):
13 assert conf.oldaskconfig('config', 'y') == 0
14 assert conf.config_contains('expected_config')
15 assert conf.stdout_contains('expected_stdout')
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/config b/scripts/kconfig/tests/choice_value_with_m_dep/config
new file mode 100644
index 000000000000..3a126b7a2546
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/config
@@ -0,0 +1,2 @@
1CONFIG_CHOICE0=m
2CONFIG_CHOICE1=m
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/expected_config b/scripts/kconfig/tests/choice_value_with_m_dep/expected_config
new file mode 100644
index 000000000000..4d07b449540e
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/expected_config
@@ -0,0 +1,3 @@
1CONFIG_MODULES=y
2CONFIG_DEP=m
3CONFIG_CHOICE0=y
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout b/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout
new file mode 100644
index 000000000000..2b50ab65c86a
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout
@@ -0,0 +1,4 @@
1Tristate Choice [M/y/?] y
2Tristate Choice
3> 1. Choice 0 (CHOICE0)
4choice[1]: 1