All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	"Luis R . Rodriguez" <mcgrof@suse.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Ulf Magnusson <ulfalizer@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 12/14] kconfig: test: check visibility of tristate choice values in y choice
Date: Tue,  6 Feb 2018 09:34:52 +0900	[thread overview]
Message-ID: <1517877294-4826-13-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com>

If tristate choice values depend on symbols set to 'm', they should be
hidden when the choice containing them is changed from 'm' to 'y'
(i.e. exclusive choice).

This issue was fixed by commit fa64e5f6a35e ("kconfig/symbol.c: handle
choice_values that depend on 'm' symbols").

Add a test case to avoid regression.

For the input in this unit test, there is a room for argument if
"# CONFIG_CHOICE1 is not set" should be written to the .config file.

After commit fa64e5f6a35e, this line was written to the .config file.

Then, it is not written after my fix "kconfig: do not write choice
values when their dependency becomes n".

In this test, "# CONFIG_CHOICE1 is not set" is don't care.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 .../kconfig/tests/choice_value_with_m_dep/Kconfig    | 20 ++++++++++++++++++++
 .../tests/choice_value_with_m_dep/__init__.py        | 15 +++++++++++++++
 scripts/kconfig/tests/choice_value_with_m_dep/config |  2 ++
 .../tests/choice_value_with_m_dep/expected_config    |  3 +++
 .../tests/choice_value_with_m_dep/expected_stdout    |  4 ++++
 5 files changed, 44 insertions(+)
 create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
 create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
 create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/config
 create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/expected_config
 create mode 100644 scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout

diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
new file mode 100644
index 0000000..dbc49e2
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig
@@ -0,0 +1,20 @@
+config MODULES
+	bool
+	default y
+	option modules
+
+config DEP
+	tristate
+	default m
+
+choice
+	prompt "Tristate Choice"
+
+config CHOICE0
+	tristate "Choice 0"
+
+config CHOICE1
+	tristate "Choice 1"
+	depends on DEP
+
+endchoice
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
new file mode 100644
index 0000000..ec71777
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/__init__.py
@@ -0,0 +1,15 @@
+"""
+Hide tristate choice values with mod dependency in y choice
+===========================================================
+
+If tristate choice values depend on symbols set to 'm', they should be
+hidden when the choice containing them is changed from 'm' to 'y'
+(i.e. exclusive choice).
+
+Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
+"""
+
+def test(conf):
+    assert conf.oldaskconfig('config', 'y') == 0
+    assert conf.config_contains('expected_config')
+    assert conf.stdout_contains('expected_stdout')
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/config b/scripts/kconfig/tests/choice_value_with_m_dep/config
new file mode 100644
index 0000000..3a126b7
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/config
@@ -0,0 +1,2 @@
+CONFIG_CHOICE0=m
+CONFIG_CHOICE1=m
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/expected_config b/scripts/kconfig/tests/choice_value_with_m_dep/expected_config
new file mode 100644
index 0000000..4d07b44
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/expected_config
@@ -0,0 +1,3 @@
+CONFIG_MODULES=y
+CONFIG_DEP=m
+CONFIG_CHOICE0=y
diff --git a/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout b/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout
new file mode 100644
index 0000000..5eac85d
--- /dev/null
+++ b/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout
@@ -0,0 +1,4 @@
+Tristate Choice [M/y/?] 
+Tristate Choice
+> 1. Choice 0 (CHOICE0)
+choice[1]: 1
-- 
2.7.4

  parent reply	other threads:[~2018-02-06  0:34 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06  0:34 [PATCH 00/14] Add Kconfig unit tests Masahiro Yamada
2018-02-06  0:34 ` Masahiro Yamada
2018-02-06  0:34 ` [PATCH 01/14] kconfig: send error messages to stderr Masahiro Yamada
2018-02-07 20:24   ` Ulf Magnusson
2018-02-08  1:49     ` Masahiro Yamada
2018-02-08  2:02       ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 02/14] kconfig: do not write choice values when their dependency becomes n Masahiro Yamada
2018-02-07 22:55   ` Ulf Magnusson
2018-02-08  2:42     ` Masahiro Yamada
2018-02-08  2:46       ` Ulf Magnusson
2018-02-08 21:21         ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 03/14] kconfig: show '?' prompt even if no help text is available Masahiro Yamada
2018-02-07 20:28   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 04/14] kconfig: print additional new line for choice for redirection Masahiro Yamada
2018-02-07 23:34   ` Ulf Magnusson
2018-02-08  6:00     ` Masahiro Yamada
2018-02-06  0:34 ` [PATCH 05/14] kconfig: remove 'config*' pattern from .gitignnore Masahiro Yamada
2018-02-07 23:43   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON Masahiro Yamada
2018-02-06  0:34   ` Masahiro Yamada
2018-02-06  9:34   ` Greg Kroah-Hartman
2018-02-06  9:34     ` Greg Kroah-Hartman
2018-02-06 10:44     ` Masahiro Yamada
2018-02-06 10:44       ` Masahiro Yamada
2018-02-06 13:10       ` Greg Kroah-Hartman
2018-02-06 13:10         ` Greg Kroah-Hartman
2018-02-06 17:07         ` Luck, Tony
2018-02-06 17:07           ` Luck, Tony
2018-02-06  0:34 ` [PATCH 07/14] kconfig: test: add framework for Kconfig unit-tests Masahiro Yamada
2018-02-08  0:35   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 08/14] kconfig: test: add basic 'choice' tests Masahiro Yamada
2018-02-07 23:57   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 09/14] kconfig: test: test automatic submenu creation Masahiro Yamada
2018-02-07 23:58   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 10/14] kconfig: test: check if new symbols in choice are asked Masahiro Yamada
2018-02-08  0:09   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 11/14] kconfig: test: check .config sanity for choice values with unmet dep Masahiro Yamada
2018-02-08  0:11   ` Ulf Magnusson
2018-02-06  0:34 ` Masahiro Yamada [this message]
2018-02-08  0:13   ` [PATCH 12/14] kconfig: test: check visibility of tristate choice values in y choice Ulf Magnusson
2018-02-06  0:34 ` [PATCH 13/14] kconfig: test: check if recursive dependencies are detected Masahiro Yamada
2018-02-08  0:15   ` Ulf Magnusson
2018-02-06  0:34 ` [PATCH 14/14] kconfig: test: check if recursive inclusion is detected Masahiro Yamada
2018-02-08  0:16   ` Ulf Magnusson
2018-02-06  9:38 ` [PATCH 00/14] Add Kconfig unit tests Greg Kroah-Hartman
2018-02-06  9:38   ` Greg Kroah-Hartman
2018-02-07 23:19   ` Ulf Magnusson
2018-02-07 23:19     ` Ulf Magnusson
2018-02-18 19:38 ` Sam Ravnborg
2018-02-18 19:38   ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517877294-4826-13-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@suse.com \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.pitre@linaro.org \
    --cc=rdunlap@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ulfalizer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.