summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-10-01 20:01:08 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2017-10-02 00:07:51 +0200
commit1774239986d36f4894e7f59efd953f408cbbf80a (patch)
tree1da243ff8e8eda5d33f4b6d0f826639a94c51e06 /tests
parent009ce631d0ba2978f51d15b0b250276a078707e8 (diff)
Make 'imply' consider direct dependencies
Bad oversight. Weak reverse dependencies (from imply) are not considered if the direct dependencies of a symbol are not met (the 'if'/'depends on' dependencies from the symbol and its parents, taking location into account if the symbol is defined in multiple places). Caused a wrong value for the symbol FS_FAT in the U-Boot Kconfigs, where 'imply' is more heavily used compared to the kernel. Add a new variable _direct_deps that corresponds to dir_dep from the C implementation. Before 'imply', dir_dep was only used for a 'select'-related warning in the C implementation. Add a bunch of tests to cover 'imply' semantics. Should be solid now.
Diffstat (limited to 'tests')
-rw-r--r--tests/Kdep111
-rw-r--r--tests/Kimply145
2 files changed, 203 insertions, 53 deletions
diff --git a/tests/Kdep b/tests/Kdep
index bde8790..ef1a4dc 100644
--- a/tests/Kdep
+++ b/tests/Kdep
@@ -1,31 +1,31 @@
config D
bool "D"
- select D29
- imply D30
+ select D31
+ imply D32
config DUMMY
- select D31 if D
- imply D32 if D
+ select D33 if D
+ imply D34 if D
# The symbols below depend on D in different ways
config D1
- def_bool D
+ def_bool D
config D2
- int "D2" if D
+ int "D2" if D
config D3
- int "D3"
- depends on D
+ int "D3"
+ depends on D
config D4
- bool "D4"
- default D
+ bool "D4"
+ default D
config D5
- bool
- default y if D
+ bool
+ default y if D
config D6
int
@@ -39,42 +39,47 @@ config D8
int
range 0 D
-if D
+# D9 and D10 depend on D even though they have no prompt, because it's needed
+# to get invalidation right for 'imply'
-# Has no prompt and hence does not depend on D even though it's within the
-# 'if D' block
-config NO_DEPEND
+if D
+config D9
bool
+endif
-config D9
- bool "D9"
+config D10
+ bool
+ depends on D
+if D
+config D11
+ bool "D11"
endif
menu "m"
depends on D
-config D10
- bool "D10"
+config D12
+ bool "D12"
menu "nested"
-config D11
- bool "D11"
+config D13
+ bool "D13"
endmenu
endmenu
# Indirect dependency
-config D12
- def_tristate D11
+config D14
+ def_tristate D13
menu "m"
depends on D
if D
# Depends on D in lots of different ways
-config D13
- int "D13" if D
+config D15
+ int "D15" if D
depends on D && D12
default D if D
range D D if D
@@ -83,56 +88,50 @@ endmenu
# Different kinds of expressions
-config D14
- bool "D14" if D || n
-
-config D15
- bool "D15" if n || D
-
config D16
- bool "D16" if D && y
+ bool "D16" if D || n
config D17
- bool "D17" if y && D
+ bool "D17" if n || D
config D18
- bool "D18" if !D
+ bool "D18" if D && y
config D19
- bool "D19" if !D && y
+ bool "D19" if y && D
config D20
- bool "D20" if !(D && y)
+ bool "D20" if !D
config D21
- bool "D21" if (D)
+ bool "D21" if !D && y
config D22
- bool "D22" if ((D))
+ bool "D22" if !(D && y)
config D23
- bool "D23" if n || (y && n || (m || D))
+ bool "D23" if (D)
config D24
- bool "D24" if D = n
+ bool "D24" if ((D))
config D25
- bool "D25" if n = D
+ bool "D25" if n || (y && n || (m || D))
config D26
- bool "D26" if n != D
+ bool "D26" if D = n
config D27
- bool "D27" if D != n
+ bool "D27" if n = D
config D28
- bool "D28" if n || ((n != D) || n)
+ bool "D28" if n != D
config D29
- tristate "D29"
+ bool "D29" if D != n
config D30
- tristate "D30"
+ bool "D30" if n || ((n != D) || n)
config D31
tristate "D31"
@@ -141,23 +140,29 @@ config D32
tristate "D32"
config D33
- int "D33"
- default 0 if D < 0
+ tristate "D33"
config D34
- int "D34"
- default 0 if 0 < D
+ tristate "D34"
config D35
int "D35"
- default 0 if 0 <= D
+ default 0 if D < 0
config D36
int "D36"
- default 0 if 0 > D
+ default 0 if 0 < D
config D37
int "D37"
+ default 0 if 0 <= D
+
+config D38
+ int "D38"
+ default 0 if 0 > D
+
+config D39
+ int "D39"
default 0 if 0 >= D
#
diff --git a/tests/Kimply b/tests/Kimply
new file mode 100644
index 0000000..3ce346f
--- /dev/null
+++ b/tests/Kimply
@@ -0,0 +1,145 @@
+config MODULES
+ def_bool y
+ option modules
+
+#
+# Implied symbols with unmet and met direct dependencies
+#
+
+config IMPLY_DIRECT_DEPS
+ def_tristate y
+ imply UNMET_DIRECT_1
+ imply UNMET_DIRECT_2
+ imply UNMET_DIRECT_3
+ imply MET_DIRECT_1
+ imply MET_DIRECT_2
+ imply MET_DIRECT_3
+ imply MET_DIRECT_4
+
+config UNMET_DIRECT_1
+ tristate
+ depends on n
+
+if n
+config UNMET_DIRECT_2
+ tristate
+endif
+
+menu "menu"
+ depends on n
+
+config UNMET_DIRECT_3
+ tristate
+
+endmenu
+
+config MET_DIRECT_1
+ tristate
+
+config MET_DIRECT_2
+ depends on y
+ tristate
+
+if y
+config MET_DIRECT_3
+ tristate
+endif
+
+menu "menu"
+ depends on y
+
+config MET_DIRECT_4
+ tristate
+
+endmenu
+
+#
+# 'imply' with condition
+#
+
+config IMPLY_COND
+ def_tristate y
+ tristate
+ imply IMPLIED_N_COND if n
+ imply IMPLIED_M_COND if m
+ imply IMPLIED_Y_COND if y
+
+config IMPLIED_N_COND
+ tristate
+
+config IMPLIED_M_COND
+ tristate
+
+config IMPLIED_Y_COND
+ tristate
+
+#
+# Implying from symbol with value n
+#
+
+# Will default to 'n'
+config IMPLY_N_1
+ tristate
+ imply IMPLIED_FROM_N_1
+
+# This test also disables the imply, so it's kinda redundant, but why not
+if n
+config IMPLY_N_2
+ tristate
+ imply IMPLIED_FROM_N_2
+endif
+
+config IMPLIED_FROM_N_1
+ tristate
+
+config IMPLIED_FROM_N_2
+ tristate
+
+#
+# Implying from symbol with value m
+#
+
+config IMPLY_M
+ def_tristate m
+ imply IMPLIED_M
+ # Implying a bool to 'm' makes it default to 'y'
+ imply IMPLIED_M_BOOL
+
+config IMPLIED_M
+ tristate
+
+config IMPLIED_M_BOOL
+ bool
+
+#
+# 'imply' which should raise an 'm' default to 'y'
+#
+
+config IMPLY_M_TO_Y
+ tristate
+ default y
+ imply IMPLIED_M_TO_Y
+
+config IMPLIED_M_TO_Y
+ tristate
+ default m
+
+#
+# Used for testing user values
+#
+
+config DIRECT_DEP
+ tristate "direct dep"
+
+config IMPLY
+ tristate "imply"
+ imply IMPLIED_TRISTATE
+ imply IMPLIED_BOOL
+
+config IMPLIED_TRISTATE
+ tristate "implied tristate"
+ depends on DIRECT_DEP
+
+config IMPLIED_BOOL
+ bool "implied bool"
+ depends on DIRECT_DEP