aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/tests
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-03-13 05:12:05 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-03-25 13:04:02 -0400
commit49ac3c0c3aa3b7636961b72a40ddb03e6609f594 (patch)
tree429d8f2f9f50fa1d065f24ace81f9597ccee1e1c /scripts/kconfig/tests
parent1903c511905984685e0a299421bc4c8b6fc1344b (diff)
kconfig: tests: test automatic submenu creation
If a symbols has dependency on the preceding symbol, the menu entry should become the submenu of the preceding one, and displayed with deeper indentation. This is done by restructuring the menu tree in menu_finalize(). It is a bit complicated computation, so let's add a test case. 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/auto_submenu/Kconfig50
-rw-r--r--scripts/kconfig/tests/auto_submenu/__init__.py12
-rw-r--r--scripts/kconfig/tests/auto_submenu/expected_stdout10
3 files changed, 72 insertions, 0 deletions
diff --git a/scripts/kconfig/tests/auto_submenu/Kconfig b/scripts/kconfig/tests/auto_submenu/Kconfig
new file mode 100644
index 000000000000..c17bf2caa7e6
--- /dev/null
+++ b/scripts/kconfig/tests/auto_submenu/Kconfig
@@ -0,0 +1,50 @@
1config A
2 bool "A"
3 default y
4
5config A0
6 bool "A0"
7 depends on A
8 default y
9 help
10 This depends on A, so should be a submenu of A.
11
12config A0_0
13 bool "A1_0"
14 depends on A0
15 help
16 Submenus are created recursively.
17 This should be a submenu of A0.
18
19config A1
20 bool "A1"
21 depends on A
22 default y
23 help
24 This should line up with A0.
25
26choice
27 prompt "choice"
28 depends on A1
29 help
30 Choice should become a submenu as well.
31
32config A1_0
33 bool "A1_0"
34
35config A1_1
36 bool "A1_1"
37
38endchoice
39
40config B
41 bool "B"
42 help
43 This is independent of A.
44
45config C
46 bool "C"
47 depends on A
48 help
49 This depends on A, but not a consecutive item, so can/should not
50 be a submenu.
diff --git a/scripts/kconfig/tests/auto_submenu/__init__.py b/scripts/kconfig/tests/auto_submenu/__init__.py
new file mode 100644
index 000000000000..32e79b85faeb
--- /dev/null
+++ b/scripts/kconfig/tests/auto_submenu/__init__.py
@@ -0,0 +1,12 @@
1"""
2Create submenu for symbols that depend on the preceding one.
3
4If a symbols has dependency on the preceding symbol, the menu entry
5should become the submenu of the preceding one, and displayed with
6deeper indentation.
7"""
8
9
10def test(conf):
11 assert conf.oldaskconfig() == 0
12 assert conf.stdout_contains('expected_stdout')
diff --git a/scripts/kconfig/tests/auto_submenu/expected_stdout b/scripts/kconfig/tests/auto_submenu/expected_stdout
new file mode 100644
index 000000000000..bf5236f39a56
--- /dev/null
+++ b/scripts/kconfig/tests/auto_submenu/expected_stdout
@@ -0,0 +1,10 @@
1A (A) [Y/n/?] (NEW)
2 A0 (A0) [Y/n/?] (NEW)
3 A1_0 (A0_0) [N/y/?] (NEW)
4 A1 (A1) [Y/n/?] (NEW)
5 choice
6 > 1. A1_0 (A1_0) (NEW)
7 2. A1_1 (A1_1) (NEW)
8 choice[1-2?]:
9B (B) [N/y/?] (NEW)
10C (C) [N/y/?] (NEW)