From patchwork Fri Mar 2 04:31:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 130460 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp858465lja; Thu, 1 Mar 2018 20:36:14 -0800 (PST) X-Google-Smtp-Source: AG47ELv+CPr0GeW9dLkiXMW2rZ0wgAI3Tt36wrYz087tQh86CcWiYfK0IO8DYVqBnP9ed30Z59FL X-Received: by 2002:a17:902:ab8f:: with SMTP id f15-v6mr4113212plr.214.1519965373890; Thu, 01 Mar 2018 20:36:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519965373; cv=none; d=google.com; s=arc-20160816; b=EucseOT/+9zzKdaQOGwD7VjRW17qzbxAdhbgIEZ5ppRZdjPt9fFmNzp9fU5DRRVCIi +W1/eqZxKU+X4iofPPHgchFZ5UE5Epd2bOs1cl8Kw+aWwnVxbRzrM80Po2V11idTvnPD ABdaLTsD8oRH9jnaNqRX9LmNE/kD/KY5zRI6CF/u3j4nYIQE+0SCJFWcTQUSETduRb+7 TUCJ8wIWSYXRlITtkVpTrZFd2cwzbb8SywnavZSIQUYCTGEAPYtheFHXj6so5rvgsWYP GDcwludNqy1UEMxFr71kURAVz/KtgbRiWSaiYZ+YMU1ec7ZF6CxE/WNm7jCUshgMWFiC sIPw== 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=YHlYGf4K4v1ahFqlIfSIY0z7Pp4emSL3/A4X48tqt5U=; b=BXjXtlvJA4a23EkLjQqOBjq4kmi/wybkzbirh+2fOTN+Y/XISCQQxOy63qeM0AEa1P GY/33cQsEEiQLDycTIeauEMJ9NgeWS9YcDTQbRLXz7nMXFT2mv35twmZvyemkueQb9LI P/kl2SuPiukW6qr6Dj7rhKUGSqFzt9+UApkuPYjpL3W051qbj+8TvQte6Ki9RX/Dgz3b Ga+NDhgpGW+l0XqxZwghUXXVUXzi6pMDlUMUJH8KBoC9gNj2vWeP2V3bfNsv4Zp+FlTJ XmIwNKVSRW5qivsi5HA7iCiy/qBddPNYNUb5WDXRcXU1SAQSeDljmoK7yGEn9u4Bd4pm Y6Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=RCmoy2nL; 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 w16-v6si4077946plp.87.2018.03.01.20.36.13; Thu, 01 Mar 2018 20:36:13 -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=RCmoy2nL; 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 S1422698AbeCBEf3 (ORCPT + 28 others); Thu, 1 Mar 2018 23:35:29 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:53187 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164991AbeCBEdr (ORCPT ); Thu, 1 Mar 2018 23:33:47 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w224WURH022085; Fri, 2 Mar 2018 13:32:35 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w224WURH022085 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519965156; bh=YHlYGf4K4v1ahFqlIfSIY0z7Pp4emSL3/A4X48tqt5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RCmoy2nLtR3hzN2V8tShelNQzssgM+wPt2pmZi8LJ8MJFVj0wzd5EReXI3Uce8maA bEwJRbCK7yRrBIpKszzZ86EVBltYjarvTKy6eqxaSbC2uKDa1Qf/eMJ2gm8wH0ya9U 8t/dYNzGfy7ESWlgUvTftSi6GF7NLKT3SdaSJa9utQGxvvIFeCI7v8DfI8rBHnbdLv VfU9eiJx10GXAWQBHeSenDwMC8NsmE7KlQH4jezOT7Hw9LyotJOjsB5SK9vIcVV8mW uul/uu6RVUQynCs0B732eIlm367QQzN4oq7fDrS3lowDfeqD/7Oah5LkFBJkuE2W2g bGQAp9nmnnAGw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Michal Marek , Ulf Magnusson , Randy Dunlap , "Luis R . Rodriguez" , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/11] kconfig: unittest: check unneeded "is not set" with unmet dependency Date: Fri, 2 Mar 2018 13:31:56 +0900 Message-Id: <1519965121-12017-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519965121-12017-1-git-send-email-yamada.masahiro@socionext.com> References: <1519965121-12017-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 Commit cb67ab2cd2b8 ("kconfig: do not write choice values when their dependency becomes n") fixed a problem where "# CONFIG_... is not set" for choice values are wrongly written into the .config file when they are once visible, then become invisible later. Add a test for this naive case. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- Changes in v2: - coding style clean-up based on PEP8, PEP257 scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig | 14 ++++++++++++++ .../kconfig/tests/no_write_if_dep_unmet/__init__.py | 19 +++++++++++++++++++ scripts/kconfig/tests/no_write_if_dep_unmet/config | 1 + .../tests/no_write_if_dep_unmet/expected_config | 5 +++++ 4 files changed, 39 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 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..207261b --- /dev/null +++ b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py @@ -0,0 +1,19 @@ +""" +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. + +Related Linux commit: cb67ab2cd2b8abd9650292c986c79901e3073a59 +""" + + +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