From patchwork Tue Feb 6 00:34:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10202073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E89960134 for ; Tue, 6 Feb 2018 00:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C84928814 for ; Tue, 6 Feb 2018 00:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6115D2882F; Tue, 6 Feb 2018 00:37:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97CC128814 for ; Tue, 6 Feb 2018 00:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbeBFAhx (ORCPT ); Mon, 5 Feb 2018 19:37:53 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39630 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbeBFAhv (ORCPT ); Mon, 5 Feb 2018 19:37:51 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w160ZHAq011351; Tue, 6 Feb 2018 09:35:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAq011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877329; bh=XD7I3n5RiSKKYFJXgK1WrirTuPvIOYYcK1MRPL7S890=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rktzfeeorRqsHGUlyjYNszxn3sfrkRZoPbAjhRBbK/UA/3WTbLUPIZcfHf2XD3tsm mRRp62uwjMhWIj2fwZZJ8toZaUoaqeOA2ahWTrpBya6MDAsG1npITZ/gVeKn1NBwan rG7fgKYqwwFJV3bPzzG3hsXqISPZa1zDB6w0eIuh3npPU3BDzarmRpsjCXdBh81bUb BJaqnIgsYOfLdr/BMzaHuN4HK/Nuo62az9pJrICOSuUVgbsznNnyQcb8zmmkNVzlIT DKxDi76YkvvPal+ZqtyUSvkyjrm5R6x77VB/G7BJjeXWO0q0AKCZh/7oxAkfXpWkdR 1uvdKVEiXOd+w== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg Kroah-Hartman , Andrew Morton , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Linus Torvalds , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 11/14] kconfig: test: check .config sanity for choice values with unmet dep Date: Tue, 6 Feb 2018 09:34:51 +0900 Message-Id: <1517877294-4826-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com> References: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I fixed a problem where "# CONFIG_..." for choice values are wrongly written into the .config file when they are once visible, then become invisible later. Add a test for this subtle case. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig | 14 ++++++++++++++ scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py | 17 +++++++++++++++++ scripts/kconfig/tests/no_write_if_dep_unmet/config | 1 + .../kconfig/tests/no_write_if_dep_unmet/expected_config | 5 +++++ 4 files changed, 37 insertions(+) create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/config create mode 100644 scripts/kconfig/tests/no_write_if_dep_unmet/expected_config diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig b/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig new file mode 100644 index 0000000..c00b8fe --- /dev/null +++ b/scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig @@ -0,0 +1,14 @@ +config A + bool "A" + +choice + prompt "Choice ?" + depends on A + +config CHOICE_B + bool "Choice B" + +config CHOICE_C + bool "Choice C" + +endchoice diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py new file mode 100644 index 0000000..d096622 --- /dev/null +++ b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py @@ -0,0 +1,17 @@ +""" +Do not write choice values to .config if the dependency is unmet +================================================================ + +"# CONFIG_... is not set" should not be written into the .config file +for symbols with unmet dependency. + +This was not working correctly for choice values because choice needs +a bit different symbol computation. + +This checks that no unneeded "# COFIG_... is not set" is contained in +the .config file. +""" + +def test(conf): + assert conf.oldaskconfig('config', 'n') == 0 + assert conf.config_matches('expected_config') diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/config b/scripts/kconfig/tests/no_write_if_dep_unmet/config new file mode 100644 index 0000000..abd280e --- /dev/null +++ b/scripts/kconfig/tests/no_write_if_dep_unmet/config @@ -0,0 +1 @@ +CONFIG_A=y diff --git a/scripts/kconfig/tests/no_write_if_dep_unmet/expected_config b/scripts/kconfig/tests/no_write_if_dep_unmet/expected_config new file mode 100644 index 0000000..0d15e41 --- /dev/null +++ b/scripts/kconfig/tests/no_write_if_dep_unmet/expected_config @@ -0,0 +1,5 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux Kernel Configuration +# +# CONFIG_A is not set