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: 126928 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2440874ljc; Mon, 5 Feb 2018 16:38:09 -0800 (PST) X-Google-Smtp-Source: AH8x226s57Ndajav40arb818af66VfPaFOGiaGb1jjQoR7HwZQiQA5bMofr7dIXY3Djmg7ozYdGD X-Received: by 10.99.126.79 with SMTP id o15mr472678pgn.364.1517877489743; Mon, 05 Feb 2018 16:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877489; cv=none; d=google.com; s=arc-20160816; b=GuEs+bhyxzCZZVzjPsf+9eb6VqH6whIn55BZswtZmtSj9f796BF+iZd99E7lp/vSc8 URtOkyLC7DHgSP2UPejIuBmBpXQyNXU0M+WxzUBWdV47tXcTsx4KD1vBdMBzi6zir72E Ju5/TvDRBPvMr2CP1doMAxZQ68nSpbSy1GZXFD42GBjg7xQVO1OKuUHd7JiKiQ1ahAyP IlckA8FAdKGUck6zfxLGNGvpvXc86s8UKdjUNdRgZwVf05PD8o5oToZbHlqvn7OGd6wA hh7nKR/wzdEYTvWdwhPByVpfvuJ6wqgyK9H4/Ybg2aSpTYT1RSLkzRUn1Yoe6WySDwSY kiQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=XD7I3n5RiSKKYFJXgK1WrirTuPvIOYYcK1MRPL7S890=; b=sP5hjBYexiHFszOWvPfT4R5z5UFD4i+s9JbK/4iEFsmMQVclfvrTRJPsqPK2+F4aVq OsOkIeQbkooKRsgUaWrJbSs8/PIoCOY0/4s2a46YyALnmj8BR1txkX7jMLVj8lKTH3Al uK9/Inefahxk/pDrzv7zL29Ho7bk3cmFAGebvitt9zA0o8rkTWiCadNsgo66gFKWBNzD Yjwf+/aVcvMYZx/QO9zZ/kPQhI7PJSxmFAdz5JwzZ+b0/d31f+e40mIGeyiHHoSmAjBR bCTsjqKO3/pF+4be18LCWzzBmkl83MGqZJ20QX34CZodU1/di4poF+Gy/ORwpQmyS80z lxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rktzfeeo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a91-v6si181184pla.657.2018.02.05.16.38.09; Mon, 05 Feb 2018 16:38:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rktzfeeo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752441AbeBFAiH (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:07 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.7.4 Reviewed-by: Ulf Magnusson 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