From patchwork Tue Mar 13 09:12:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131415 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp483694ljb; Tue, 13 Mar 2018 02:15:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELvulx6S1oVQP3ai30qz0lVkliwJB9divVry8w1XL5zT3SY5BKKX2GrQPy4uPm3Tvh8h0pqW X-Received: by 10.98.25.10 with SMTP id 10mr10872298pfz.136.1520932507928; Tue, 13 Mar 2018 02:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520932507; cv=none; d=google.com; s=arc-20160816; b=s4I3gFsaJhU8rIGEiEag5nkwwd/MxOmUQZ2YX+E0ejGIk8q7xOirqBdRg/+KPRs4oA 4kZABkAfvopLYza9Z9zGTkv8rnUA1fPdm/WFp1R83g+AWMGqKRfv1Tw+ehvh0HM7MDd+ ea3PbrTq920UNt1S4TFK3421cwDpNPcGRNQLw3nYi3JW7/8QHYlrJOF1qrFWyFCpd6Uu p81fGw77+HEx5l9kneQwYm/K0EeIbJkml2bEY2pAXF8ijYnW7Wungrkk2j3WIrnkUt78 7SddfnOJFUAmB3mlieCfqVGzTp6hhIOeFz6kbIZQNNNpNop1hE2onwsIZJgeDHa/iyiG ezKw== 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=tUux/rAgM8Vq2kda7UvIS8vONG/OaP5yiipXGtRpvwk=; b=YFLLwNpx3L2tr9tOUm3Oi63feL21Afc0gna0N6sd7jAzX+bC1hmPpoD8XHWKtd2lDf hzDFGzpmrGLLb8dqO2io+3G9nPr082sJ8SgHBH/plff32au+iaCdoYdv5Z+7Mq/I8wQH /+xtsAWtpt4FLlrJ5SuA2O3FuvzgSHEEQNZLEsVDzyS55iTWUH0y38VWtGw61OLJMZK1 KAW58iVxsvdo7gsiVnOlEytw6BbuooSK0KmvWizLWK4/LVT2ekMX2qkUKiSjPlh1NsKv OsoeK5i2iJgqR1c4AfAPbQnRvEaWbrxS8lxQ5OojmWe03BrGdb4Ge3ZXC+z7kYW5UEAp e55Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=cICmmhPc; 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 a15-v6si5656630pln.421.2018.03.13.02.15.07; Tue, 13 Mar 2018 02:15:07 -0700 (PDT) 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=cICmmhPc; 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 S1752595AbeCMJOQ (ORCPT + 28 others); Tue, 13 Mar 2018 05:14:16 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:41835 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752511AbeCMJOB (ORCPT ); Tue, 13 Mar 2018 05:14:01 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2D9CIo7016505; Tue, 13 Mar 2018 18:12:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2D9CIo7016505 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520932343; bh=tUux/rAgM8Vq2kda7UvIS8vONG/OaP5yiipXGtRpvwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cICmmhPc629+M7kgmBSVKT+ywfdg857usrrrYBQKM2w7Dg4GBeLg2lw2YsGKew5ZN scS0I2h5pETnYNx2UJlkUXReb2ahQfGNVAwGZUAlc1rqXr/BSNPwGOuxkiQkITN6dK 4pck8y2bxQbFirPqziDwYDtG06tETuUPeK3qeUjpFey+9O57YuLG+ak6w27vsuSJ6L vE1JDaDtKrXebAIzZx7xEPcF5XRLX2J7iS3RhZpuLqNr+JNtOFuvPEWFAElEPswcqA dRz6dbrD/MFhDVjJot9apooEqQAQ1BXWOmV/gWF/ouQuOZLVGhGSozSz/tf7fGJLiF cBvcXBx1ZwMcQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Ulf Magnusson , Randy Dunlap , "Luis R . Rodriguez" , Tony Luck , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 06/11] kconfig: tests: check unneeded "is not set" with unmet dependency Date: Tue, 13 Mar 2018 18:12:07 +0900 Message-Id: <1520932332-2449-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520932332-2449-1-git-send-email-yamada.masahiro@socionext.com> References: <1520932332-2449-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 v3: None 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