From f1575595d15657bd78c139978107deabec5a3959 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 15 Aug 2018 14:59:43 +0900 Subject: kconfig: error out when seeing recursive dependency Originally, recursive dependency was a fatal error for Kconfig because Kconfig cannot compute symbol values in such a situation. Commit d595cea62403 ("kconfig: print more info when we see a recursive dependency") changed it to a warning, which I guess was not intentional. Get it back to an error again. Also, rename the unit test directory "warn_recursive_dep" to "err_recursive_dep" so that it matches to the behavior. Signed-off-by: Masahiro Yamada Tested-by: Dirk Gouders --- scripts/kconfig/tests/err_recursive_dep/Kconfig | 62 ++++++++++++++++++++++ .../kconfig/tests/err_recursive_dep/__init__.py | 10 ++++ .../tests/err_recursive_dep/expected_stderr | 30 +++++++++++ scripts/kconfig/tests/warn_recursive_dep/Kconfig | 62 ---------------------- .../kconfig/tests/warn_recursive_dep/__init__.py | 9 ---- .../tests/warn_recursive_dep/expected_stderr | 30 ----------- 6 files changed, 102 insertions(+), 101 deletions(-) create mode 100644 scripts/kconfig/tests/err_recursive_dep/Kconfig create mode 100644 scripts/kconfig/tests/err_recursive_dep/__init__.py create mode 100644 scripts/kconfig/tests/err_recursive_dep/expected_stderr delete mode 100644 scripts/kconfig/tests/warn_recursive_dep/Kconfig delete mode 100644 scripts/kconfig/tests/warn_recursive_dep/__init__.py delete mode 100644 scripts/kconfig/tests/warn_recursive_dep/expected_stderr (limited to 'scripts/kconfig/tests') diff --git a/scripts/kconfig/tests/err_recursive_dep/Kconfig b/scripts/kconfig/tests/err_recursive_dep/Kconfig new file mode 100644 index 000000000000..a65bfcb7137e --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_dep/Kconfig @@ -0,0 +1,62 @@ +# depends on itself + +config A + bool "A" + depends on A + +# select itself + +config B + bool + select B + +# depends on each other + +config C1 + bool "C1" + depends on C2 + +config C2 + bool "C2" + depends on C1 + +# depends on and select + +config D1 + bool "D1" + depends on D2 + select D2 + +config D2 + bool + +# depends on and imply +# This is not recursive dependency + +config E1 + bool "E1" + depends on E2 + imply E2 + +config E2 + bool "E2" + +# property + +config F1 + bool "F1" + default F2 + +config F2 + bool "F2" + depends on F1 + +# menu + +menu "menu depending on its content" + depends on G + +config G + bool "G" + +endmenu diff --git a/scripts/kconfig/tests/err_recursive_dep/__init__.py b/scripts/kconfig/tests/err_recursive_dep/__init__.py new file mode 100644 index 000000000000..5f3821b43ce6 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_dep/__init__.py @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +""" +Detect recursive dependency error. + +Recursive dependency should be treated as an error. +""" + +def test(conf): + assert conf.oldaskconfig() == 1 + assert conf.stderr_contains('expected_stderr') diff --git a/scripts/kconfig/tests/err_recursive_dep/expected_stderr b/scripts/kconfig/tests/err_recursive_dep/expected_stderr new file mode 100644 index 000000000000..3de807dd9cb2 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_dep/expected_stderr @@ -0,0 +1,30 @@ +Kconfig:9:error: recursive dependency detected! +Kconfig:9: symbol B is selected by B +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:3:error: recursive dependency detected! +Kconfig:3: symbol A depends on A +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:15:error: recursive dependency detected! +Kconfig:15: symbol C1 depends on C2 +Kconfig:19: symbol C2 depends on C1 +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:30:error: recursive dependency detected! +Kconfig:30: symbol D2 is selected by D1 +Kconfig:25: symbol D1 depends on D2 +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:59:error: recursive dependency detected! +Kconfig:59: symbol G depends on G +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:50:error: recursive dependency detected! +Kconfig:50: symbol F2 depends on F1 +Kconfig:48: symbol F1 default value contains F2 diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/warn_recursive_dep/Kconfig deleted file mode 100644 index a65bfcb7137e..000000000000 --- a/scripts/kconfig/tests/warn_recursive_dep/Kconfig +++ /dev/null @@ -1,62 +0,0 @@ -# depends on itself - -config A - bool "A" - depends on A - -# select itself - -config B - bool - select B - -# depends on each other - -config C1 - bool "C1" - depends on C2 - -config C2 - bool "C2" - depends on C1 - -# depends on and select - -config D1 - bool "D1" - depends on D2 - select D2 - -config D2 - bool - -# depends on and imply -# This is not recursive dependency - -config E1 - bool "E1" - depends on E2 - imply E2 - -config E2 - bool "E2" - -# property - -config F1 - bool "F1" - default F2 - -config F2 - bool "F2" - depends on F1 - -# menu - -menu "menu depending on its content" - depends on G - -config G - bool "G" - -endmenu diff --git a/scripts/kconfig/tests/warn_recursive_dep/__init__.py b/scripts/kconfig/tests/warn_recursive_dep/__init__.py deleted file mode 100644 index adb21951ba41..000000000000 --- a/scripts/kconfig/tests/warn_recursive_dep/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -""" -Warn recursive inclusion. - -Recursive dependency should be warned. -""" - -def test(conf): - assert conf.oldaskconfig() == 0 - assert conf.stderr_contains('expected_stderr') diff --git a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr deleted file mode 100644 index 3de807dd9cb2..000000000000 --- a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr +++ /dev/null @@ -1,30 +0,0 @@ -Kconfig:9:error: recursive dependency detected! -Kconfig:9: symbol B is selected by B -For a resolution refer to Documentation/kbuild/kconfig-language.txt -subsection "Kconfig recursive dependency limitations" - -Kconfig:3:error: recursive dependency detected! -Kconfig:3: symbol A depends on A -For a resolution refer to Documentation/kbuild/kconfig-language.txt -subsection "Kconfig recursive dependency limitations" - -Kconfig:15:error: recursive dependency detected! -Kconfig:15: symbol C1 depends on C2 -Kconfig:19: symbol C2 depends on C1 -For a resolution refer to Documentation/kbuild/kconfig-language.txt -subsection "Kconfig recursive dependency limitations" - -Kconfig:30:error: recursive dependency detected! -Kconfig:30: symbol D2 is selected by D1 -Kconfig:25: symbol D1 depends on D2 -For a resolution refer to Documentation/kbuild/kconfig-language.txt -subsection "Kconfig recursive dependency limitations" - -Kconfig:59:error: recursive dependency detected! -Kconfig:59: symbol G depends on G -For a resolution refer to Documentation/kbuild/kconfig-language.txt -subsection "Kconfig recursive dependency limitations" - -Kconfig:50:error: recursive dependency detected! -Kconfig:50: symbol F2 depends on F1 -Kconfig:48: symbol F1 default value contains F2 -- cgit v1.2.3