Commit 29c434f367ea7b95bea7057105507c05abdc1297

Authored by Masahiro Yamada
1 parent 3e4888c2e3

kconfig: tests: test if recursive dependencies are detected

Recursive dependency should be detected and warned.  Test this.

This indirectly tests the line number increments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>

Showing 3 changed files with 101 additions and 0 deletions Side-by-side Diff

scripts/kconfig/tests/warn_recursive_dep/Kconfig
  1 +# depends on itself
  2 +
  3 +config A
  4 + bool "A"
  5 + depends on A
  6 +
  7 +# select itself
  8 +
  9 +config B
  10 + bool
  11 + select B
  12 +
  13 +# depends on each other
  14 +
  15 +config C1
  16 + bool "C1"
  17 + depends on C2
  18 +
  19 +config C2
  20 + bool "C2"
  21 + depends on C1
  22 +
  23 +# depends on and select
  24 +
  25 +config D1
  26 + bool "D1"
  27 + depends on D2
  28 + select D2
  29 +
  30 +config D2
  31 + bool
  32 +
  33 +# depends on and imply
  34 +# This is not recursive dependency
  35 +
  36 +config E1
  37 + bool "E1"
  38 + depends on E2
  39 + imply E2
  40 +
  41 +config E2
  42 + bool "E2"
  43 +
  44 +# property
  45 +
  46 +config F1
  47 + bool "F1"
  48 + default F2
  49 +
  50 +config F2
  51 + bool "F2"
  52 + depends on F1
  53 +
  54 +# menu
  55 +
  56 +menu "menu depending on its content"
  57 + depends on G
  58 +
  59 +config G
  60 + bool "G"
  61 +
  62 +endmenu
scripts/kconfig/tests/warn_recursive_dep/__init__.py
  1 +"""
  2 +Warn recursive inclusion.
  3 +
  4 +Recursive dependency should be warned.
  5 +"""
  6 +
  7 +def test(conf):
  8 + assert conf.oldaskconfig() == 0
  9 + assert conf.stderr_contains('expected_stderr')
scripts/kconfig/tests/warn_recursive_dep/expected_stderr
  1 +Kconfig:9:error: recursive dependency detected!
  2 +Kconfig:9: symbol B is selected by B
  3 +For a resolution refer to Documentation/kbuild/kconfig-language.txt
  4 +subsection "Kconfig recursive dependency limitations"
  5 +
  6 +Kconfig:3:error: recursive dependency detected!
  7 +Kconfig:3: symbol A depends on A
  8 +For a resolution refer to Documentation/kbuild/kconfig-language.txt
  9 +subsection "Kconfig recursive dependency limitations"
  10 +
  11 +Kconfig:15:error: recursive dependency detected!
  12 +Kconfig:15: symbol C1 depends on C2
  13 +Kconfig:19: symbol C2 depends on C1
  14 +For a resolution refer to Documentation/kbuild/kconfig-language.txt
  15 +subsection "Kconfig recursive dependency limitations"
  16 +
  17 +Kconfig:30:error: recursive dependency detected!
  18 +Kconfig:30: symbol D2 is selected by D1
  19 +Kconfig:25: symbol D1 depends on D2
  20 +For a resolution refer to Documentation/kbuild/kconfig-language.txt
  21 +subsection "Kconfig recursive dependency limitations"
  22 +
  23 +Kconfig:59:error: recursive dependency detected!
  24 +Kconfig:59: symbol G depends on G
  25 +For a resolution refer to Documentation/kbuild/kconfig-language.txt
  26 +subsection "Kconfig recursive dependency limitations"
  27 +
  28 +Kconfig:50:error: recursive dependency detected!
  29 +Kconfig:50: symbol F2 depends on F1
  30 +Kconfig:48: symbol F1 default value contains F2