summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-10-09 23:05:00 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2017-10-24 19:24:08 +0200
commitdd0e227216e247d2040cdd40bf7397702880cdc4 (patch)
tree4c76ebb2e7555d28214cddecf32ffb424fa1732b /tests
parentf64aaf971176305233f16a11911a660fa6f99561 (diff)
Kconfiglib 2 backup
WIP
Diffstat (limited to 'tests')
-rw-r--r--tests/Kchoice26
-rw-r--r--tests/Kdefconfig_existent1
-rw-r--r--tests/Keval1
-rw-r--r--tests/Klocation79
-rw-r--r--tests/Klocation_included43
-rw-r--r--tests/Kmisc2
-rw-r--r--tests/Kmodifiable50
-rw-r--r--tests/Kprompt77
-rw-r--r--tests/Krelation2
-rw-r--r--tests/Krepr61
-rw-r--r--tests/Kstr76
-rw-r--r--tests/Ktext145
-rw-r--r--tests/Kvisibility161
13 files changed, 290 insertions, 434 deletions
diff --git a/tests/Kchoice b/tests/Kchoice
index e80e222..f635ccc 100644
--- a/tests/Kchoice
+++ b/tests/Kchoice
@@ -141,17 +141,39 @@ choice WEIRD_SYMS
# Only WS1 is part of the choice
config WS1
+ bool "WS1"
+
config WS2
+ bool "WS2"
depends on WS1
+
config WS3
+ bool
depends on WS2
+
config WS4
+ bool
depends on WS1
-# 'if' has the same effect, so only WS5 is part of the choice
config WS5
-if WS5
+ bool "WS5" if WS1
+
+# 'if' has the same effect, so only WS6 is part of the choice
config WS6
+ bool "WS6"
+
+if WS6
+
+config WS7
+ bool
+
+config WS8
+ bool "WS8"
+
endif
+# Should also be part of the choice
+config WS9
+ bool "WS9"
+
endchoice
diff --git a/tests/Kdefconfig_existent b/tests/Kdefconfig_existent
index 895c218..8dde443 100644
--- a/tests/Kdefconfig_existent
+++ b/tests/Kdefconfig_existent
@@ -2,6 +2,7 @@
# Should produce "Kconfiglib/tests/defconfig_2"
config FOO
+ string
option env="BAR"
config A
diff --git a/tests/Keval b/tests/Keval
index 64bd4d8..4f63247 100644
--- a/tests/Keval
+++ b/tests/Keval
@@ -1,6 +1,7 @@
# Enabled/disabled in the test
config MODULES
bool "modules"
+ option modules
config N
def_tristate n
diff --git a/tests/Klocation b/tests/Klocation
index 404e5ae..498a372 100644
--- a/tests/Klocation
+++ b/tests/Klocation
@@ -1,73 +1,30 @@
-# Include some line continuations to make sure they don't mess up line numbers
+if UNDEFINED
+endif
-# Defined and referenced in multiple locations
-config A
- bool
+config SINGLE_DEF
+
+config MULTI_DEF
# Throw in some line continuations too to make sure it doesn't mess up the line
# numbers
-menu "menu 1"
- depends on A
- visible if A && \
- NOT_DEFINED
-
-# Also defined in Klocation_included
-choice B
- bool "b" if A
-
-config C
- bool "c"
-
-config D
- bool "d"
-
-\
-
-endchoice
+if y && \
+ y
+if y && \
+ y && \
+ y
-config A
- def_bool NOT_DEFINED
+config MULTI_DEF
-comment "comment 1"
+endif
+endif
-config E
- bool "E" if A
- depends on A
-
-endmenu
-
-config \
- FOO
+config EXPANDED_FROM_ENV
string
- option \
- env\
- =\
- "FOO"
-
-\
-\
+ option env="EXPANDED_FROM_ENV"
-config BAR
+config _INCLUDED
string
- default \
- "_included"
+ default "_included"
# Expands to "tests/Klocation_included"
-source \
-"$FOO/Klocation$BAR"
-
-\
-\
-\
-
-config I
- int
- range A 0
- range 0 A
- range 0 1 if A
- default J if A < 0
- default K if 0 < A
- default L if 0 <= A
- default M if 0 > A
- default N if 0 >= A
- default N if y && 0 < A
+source "$EXPANDED_FROM_ENV/Klocation$_INCLUDED"
diff --git a/tests/Klocation_included b/tests/Klocation_included
index 674116a..fb1afaa 100644
--- a/tests/Klocation_included
+++ b/tests/Klocation_included
@@ -1,42 +1,15 @@
-menuconfig A
- bool "A"
-menuconfig A
- bool "A"
-menu "menu 2"
-config M
- def_bool !(n || (n || A = n))
- default !A if y
- default y if !A
-config S
- bool
- select A if NOT_DEFINED = y
- select E if A
- imply A
- imply E if A
-endmenu
-choice
- bool "C"
-config N
- bool "N"
-config O
- bool "O"
-endchoice
-choice B
- bool "B"
-config B1
- tristate "B1"
-config B2
- tristate "B2"
+config MULTI_DEF
+choice CHOICE
endchoice
-if !(NOT_DEFINED != A)
-comment "comment 2"
-endif
+config MENU_HOOK
-menu "visible if menu"
- visible if A
- visible if NOT_DEFINED
+menu "menu"
endmenu
+
+config COMMENT_HOOK
+
+comment "comment"
diff --git a/tests/Kmisc b/tests/Kmisc
index d2e55b2..c3a21f8 100644
--- a/tests/Kmisc
+++ b/tests/Kmisc
@@ -1,6 +1,6 @@
# For testing various minor APIs
-# is_optional()
+# optional choices
choice NOT_OPTIONAL
bool "not optional"
diff --git a/tests/Kmodifiable b/tests/Kmodifiable
deleted file mode 100644
index 1f9dcc9..0000000
--- a/tests/Kmodifiable
+++ /dev/null
@@ -1,50 +0,0 @@
-config MODULES
- def_bool y
-
-config VISIBLE
- tristate "bool visible"
-
-config NOT_VISIBLE
- tristate
-
-config Y_SELECTOR
- def_tristate y
- select SELECTED_TO_Y
-
-config SELECTED_TO_Y
- tristate "selected to y"
-
-config M_SELECTOR
- def_tristate m
- select TRISTATE_SELECTED_TO_M
- select M_VISIBLE_TRISTATE_SELECTED_TO_M
- select BOOL_SELECTED_TO_M
-
-config TRISTATE_SELECTED_TO_M
- tristate "tristate selected to m"
-
-config M_VISIBLE_TRISTATE_SELECTED_TO_M
- tristate "m-visible tristate selected to m"
- depends on m
-
-# The "m" will get promoted to a "y", so this should still not be modifiable
-config BOOL_SELECTED_TO_M
- bool "bool selected to m"
-
-config VISIBLE_STRING
- string "visible string"
-
-config VISIBLE_INT
- int "visible int"
-
-config VISIBLE_HEX
- hex "visible hex"
-
-config NOT_VISIBLE_STRING
- string
-
-config NOT_VISIBLE_INT
- int "not visible int" if n
-
-config NOT_VISIBLE_HEX
- hex
diff --git a/tests/Kprompt b/tests/Kprompt
deleted file mode 100644
index a36a0fd..0000000
--- a/tests/Kprompt
+++ /dev/null
@@ -1,77 +0,0 @@
-config NO_PROMPT
- tristate
-
-config SINGLE_PROMPT_1
- bool "single prompt 1"
-
-config SINGLE_PROMPT_2
- bool
- prompt "single prompt 2" if n
-
-config MULTI_PROMPT
- bool "ignored prompt"
- prompt "prompt 1"
-config MULTI_PROMPT
- bool "prompt 2"
-config MULTI_PROMPT
- bool
-config MULTI_PROMPT
- bool
- prompt "prompt 3"
-config MULTI_PROMPT
- bool
- prompt "ignored prompt"
- prompt "ignored prompt 2" if y
- prompt "prompt 4" if y
-
-choice NO_PROMPT_CHOICE
- tristate
-config A
- bool
-config B
- bool
-endchoice
-
-choice SINGLE_PROMPT_1_CHOICE
- bool "single prompt 1 choice"
-config C
- bool
-config D
- bool
-endchoice
-
-choice SINGLE_PROMPT_2_CHOICE
- bool "ignored prompt"
- prompt "single prompt 2 choice"
-config E
- bool
-config F
- bool
-endchoice
-
-choice MULTI_PROMPT_CHOICE
- bool "prompt 1 choice"
-config G
- bool
-config H
- bool
-endchoice
-
-choice MULTI_PROMPT_CHOICE
- bool
- prompt "prompt 2 choice"
-config I
- bool
-config J
- bool
-endchoice
-
-choice MULTI_PROMPT_CHOICE
- bool
- prompt "ignored prompt"
- prompt "prompt 3 choice"
-config K
- bool
-config L
- bool
-endchoice
diff --git a/tests/Krelation b/tests/Krelation
index 057b585..420152f 100644
--- a/tests/Krelation
+++ b/tests/Krelation
@@ -1,5 +1,6 @@
config A
bool
+ depends on UNDEFINED
choice
bool "C"
@@ -18,6 +19,7 @@ menu "m2"
config F
bool
choice
+ tristate "foo"
config G
bool "g"
config H
diff --git a/tests/Krepr b/tests/Krepr
new file mode 100644
index 0000000..d886fe3
--- /dev/null
+++ b/tests/Krepr
@@ -0,0 +1,61 @@
+config MODULES
+ bool
+ option modules
+ default y
+
+if UNDEFINED
+endif
+
+config BASIC
+ bool
+ default y
+ help
+
+config VISIBLE
+ bool "visible"
+
+config DIR_DEP_N
+ depends on n
+
+config OPTIONS
+ option allnoconfig_y
+ option defconfig_list
+ option env="ENV"
+
+config MULTI_DEF
+config MULTI_DEF
+
+menuconfig MENUCONFIG
+
+choice CHOICE
+ tristate "choice"
+
+config CHOICE_1
+ tristate "choice sym"
+
+config CHOICE_2
+ tristate "choice sym"
+
+endchoice
+
+config CHOICE_HOOK
+
+choice
+ tristate "choice" if n
+ optional
+endchoice
+
+config NO_VISIBLE_IF_HOOK
+
+menu "no visible if"
+endmenu
+
+config VISIBLE_IF_HOOK
+
+menu "visible if"
+ visible if m
+endmenu
+
+config COMMENT_HOOK
+
+comment "comment"
diff --git a/tests/Kstr b/tests/Kstr
new file mode 100644
index 0000000..8d74017
--- /dev/null
+++ b/tests/Kstr
@@ -0,0 +1,76 @@
+if UNDEFINED
+endif
+
+config NO_TYPE
+
+config BASIC_NO_PROMPT
+ bool
+ help
+ blah blah
+
+ blah blah blah
+
+ blah
+
+config BASIC_PROMPT
+ bool "basic"
+
+config ADVANCED
+ tristate "prompt" if DEP
+ default DEFAULT_1
+ default DEFAULT_2 if DEP
+ select SELECTED_1
+ select SELECTED_2 if DEP
+ imply IMPLIED_1
+ imply IMPLIED_2 if DEP
+ help
+ first help text
+
+config ADVANCED
+ prompt "prompt 2"
+
+menuconfig ADVANCED
+ prompt "prompt 3"
+ depends on DEP2
+
+config ADVANCED
+ help
+ second help text
+
+config STRING
+ string
+ default "foo"
+ default "bar" if DEP
+ default STRING2
+ default STRING3 if DEP
+
+config INT
+ int
+ range 1 2
+ range FOO BAR
+ range BAZ QAZ if DEP
+
+config MODULES
+ option modules
+
+config OPTIONS
+ option allnoconfig_y
+ option defconfig_list
+ option env="ENV"
+
+choice CHOICE
+ tristate "foo"
+ default CHOICE_1
+ default CHOICE_2 if dep
+
+config CHOICE_1
+ tristate "choice 1"
+
+config CHOICE_2
+ tristate "choice 2"
+
+endchoice
+
+choice
+ tristate "no name"
+endchoice
diff --git a/tests/Ktext b/tests/Ktext
deleted file mode 100644
index 3440c3c..0000000
--- a/tests/Ktext
+++ /dev/null
@@ -1,145 +0,0 @@
-config BASIC
- bool
-
-if !BASIC && !BASIC
-
-config ADVANCED
- tristate "advanced prompt 1" if y || (BASIC && BASIC)
- select SELECTED_1 if BASIC && DUMMY
- select SELECTED_2 if !(DUMMY || BASIC)
- imply IMPLIED_1 if BASIC || DUMMY
- imply IMPLIED_2 if !(DUMMY && BASIC)
- default y if BASIC && !BASIC
- default n if BASIC = DUMMY && X < Y && X <= Y && X > Y && X >= Y
-
-config ADVANCED
- tristate "advanced prompt 2"
-
-config STRING
- string
- default "foo"
- default "bar" if BAR
- default STRING2 if BAZ
-
-config STRING2
- string
- default "baz"
-
-endif
-
-config SELECTED_1
-config SELECTED_2
-config SELECTING_1
- select ADVANCED if BASIC
-config SELECTING_2
- select ADVANCED if !BASIC
-config IMPLYING_1
- imply ADVANCED if DUMMY
-config IMPLYING_2
- imply ADVANCED if !DUMMY
-
-config INT
- int
- default 7
-
-config HAS_RANGES
- int "ranged"
- range 1 2 if !DUMMY
- range INT INT if DUMMY
- range 123 456
-
-choice
- bool "choice"
-
-config CHOICE_ITEM_1
- bool "A"
-config CHOICE_ITEM_2
- bool "B"
-config CHOICE_ITEM_3
- bool "C"
-
-endchoice
-
-menu "simple menu"
-endmenu
-
-if !DUMMY
-menu "advanced menu"
- depends on !BASIC
- visible if !DUMMY
-endmenu
-endif
-
-comment "simple comment"
-
-if !DUMMY
- comment "advanced comment"
- depends on !BASIC
-endif
-
-config NO_HELP
- bool
-
-choice NO_HELP_CHOICE
-config FOO
-endchoice
-
-config EMPTY_HELP
- bool
- help
-config DUMMY
-
-choice EMPTY_HELP_CHOICE
- bool
- help
-config DUMMY2
-endchoice
-
-config S
- bool
- help
- help for
- S
-choice C
- bool
- help
- help for
- C
-config A
- bool "A"
-
-config B
- bool "B"
-
-endchoice
-
-comment "a comment"
-
-menu "a menu"
-endmenu
-
-config HELP_TERMINATED_BY_COMMENT
- bool
- help
- a
- b
- c
-#
-
-config TRICKY_HELP
- bool
- help
-
-
- a
- b
- c
-
- d
- e
- f
-
-
- g
- h
- i
diff --git a/tests/Kvisibility b/tests/Kvisibility
index 715d098..91def0a 100644
--- a/tests/Kvisibility
+++ b/tests/Kvisibility
@@ -1,5 +1,6 @@
config MODULES
bool "MODULES"
+ option modules
#
# Symbol visibility
@@ -12,186 +13,204 @@ config NO_PROMPT
config MOD
def_tristate m
-config BOOL_n
+config BOOL_N
bool "bool n" if n
-# Rewritten to m && MODULES
-config BOOL_m
+config BOOL_M
+ # Rewritten to m && MODULES
bool "bool m" if m
-# Not rewritten
config BOOL_MOD
bool "bool MOD"
+ # Not rewritten
depends on MOD
-# Rewritten to m && MODULES
-config BOOL_y
+config BOOL_Y
bool "bool y"
+ # Rewritten to m && MODULES
depends on y || m
-config TRISTATE_n
+config TRISTATE_N
tristate "tristate n" if n
-# Rewritten to m && MODULES
-config TRISTATE_m
+config TRISTATE_M
+ # Rewritten to m && MODULES
tristate "tristate m" if m
-# Not rewritten
config TRISTATE_MOD
tristate "tristate MOD"
+ # Not rewritten
depends on MOD
-# Rewritten to m && MODULES
-config TRISTATE_y
+config TRISTATE_Y
bool "tristate y"
+ # Rewritten to m && MODULES
depends on y || m
# Symbols nested in 'if'
if n
-config BOOL_if_n
+
+config BOOL_IF_N
bool "bool if n"
-config TRISTATE_if_n
+
+config TRISTATE_IF_N
tristate "tristate if n"
+
endif
if m
-config BOOL_if_m
+
+config BOOL_IF_M
bool "bool if m"
-config TRISTATE_if_m
+
+config TRISTATE_IF_M
tristate "tristate if n"
+
endif
if y
-config BOOL_if_y
+
+config BOOL_IF_Y
bool "bool if y"
-config TRISTATE_if_y
+
+config TRISTATE_IF_Y
tristate "tristate if y"
+
endif
# Symbols nested in 'menu'
menu "menu 1"
depends on n
-config BOOL_menu_n
+
+config BOOL_MENU_N
bool "bool menu n"
-config TRISTATE_menu_n
+
+config TRISTATE_MENU_N
tristate "tristate menu n"
+
endmenu
menu "menu 2"
depends on m
-config BOOL_menu_m
+
+config BOOL_MENU_M
bool "bool menu m"
-config TRISTATE_menu_m
+
+config TRISTATE_MENU_M
tristate "tristate menu n"
+
endmenu
menu "menu 3"
depends on y
-config BOOL_menu_y
+
+config BOOL_MENU_Y
bool "bool menu y"
-config TRISTATE_menu_y
+
+config TRISTATE_MENU_Y
tristate "tristate menu y"
+
endmenu
# Symbols nested in choices
choice C1
tristate "choice n" if n
-config BOOL_choice_n
+
+config BOOL_CHOICE_N
bool "bool choice n"
-config TRISTATE_choice_n
+
+config TRISTATE_CHOICE_N
tristate "tristate choice n"
+
endchoice
choice C2
tristate "choice m" if m
-config BOOL_choice_m
+
+config BOOL_CHOICE_M
bool "bool choice m"
-config TRISTATE_choice_m
+
+config TRISTATE_CHOICE_M
tristate "tristate choice n"
+
endchoice
choice C3
tristate "choice y" if y
-config BOOL_choice_y
+
+config BOOL_CHOICE_Y
bool "bool choice y"
-config TRISTATE_choice_y
+
+config TRISTATE_CHOICE_Y
tristate "tristate choice y"
+
endchoice
#
# Choice visibility
#
-choice BOOL_CHOICE_n
+choice BOOL_CHOICE_N
bool "bool choice n" if n
-config A
- bool "A"
-config B
- bool "B"
endchoice
-choice BOOL_CHOICE_m
+choice BOOL_CHOICE_M
bool "bool choice m" if m
-config C
- bool "C"
-config D
- bool "D"
endchoice
-choice BOOL_CHOICE_y
+choice BOOL_CHOICE_Y
bool "bool choice y" if y
-config E
- bool "E"
-config F
- bool "F"
endchoice
-choice TRISTATE_CHOICE_n
+choice TRISTATE_CHOICE_N
tristate "tristate choice n" if n
-config G
- tristate "G"
-config H
- tristate "H"
endchoice
-choice TRISTATE_CHOICE_m
+choice TRISTATE_CHOICE_M
tristate "tristate choice m" if m
-config I
- tristate "I"
-config J
- tristate "J"
endchoice
-choice TRISTATE_CHOICE_y
+choice TRISTATE_CHOICE_Y
tristate "tristate choice y" if y
+
config K
tristate "K"
+
config L
tristate "L"
+
endchoice
if m
-choice TRISTATE_CHOICE_IF_m_and_y
+choice TRISTATE_CHOICE_IF_M_AND_Y
tristate "tristate choice if m and y" if y
+
config M
bool "M"
+
config N
bool "N"
+
endchoice
endif
menu "choice-containing menu"
depends on n && y
-choice TRISTATE_CHOICE_MENU_n_and_y
+
+choice TRISTATE_CHOICE_MENU_N_AND_Y
tristate "tristate choice if n and y"
+
config O
tristate "O"
+
config P
tristate "P"
+
endchoice
+
endmenu
#
@@ -245,19 +264,25 @@ comment "comment y"
if n
comment "comment if n"
endif
+
if m
comment "comment if m"
endif
+
if y
comment "comment if y"
endif
if "y"
-menu "comment-containing menu"
+
+menu "menu with comment"
depends on m
+
comment "double-nested m comment"
depends on y
+
endmenu
+
endif
# Used to verify that string/int/hex symbols with m visibility accept a user
@@ -280,28 +305,38 @@ endif
menu "n-visible menu"
visible if n
-config VISIBLE_IF_n
+
+config VISIBLE_IF_N
tristate "visible if n"
+
endmenu
menu "m-visible menu"
visible if m
-config VISIBLE_IF_m
+
+config VISIBLE_IF_M
tristate "visible if m"
+
endmenu
menu "y-visible menu"
visible if y
-config VISIBLE_IF_y
+
+config VISIBLE_IF_Y
tristate "visible if m"
+
endmenu
menu "m-visible menu 2"
visible if y || n
visible if m && y
visible if y
+
if y
-config VISIBLE_IF_m_2
+
+config VISIBLE_IF_M_2
tristate "visible if m 2"
+
endif
+
endmenu