From patchwork Tue Feb 6 00:34:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126930 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441084ljc; Mon, 5 Feb 2018 16:38:32 -0800 (PST) X-Google-Smtp-Source: AH8x225B7YdG1NvaDbPuvG0mYx8vyB+lX3sRaU2T0qdgqCTqLP+LUcFpGyqVMiMFAuveWDRl2hQq X-Received: by 10.98.207.6 with SMTP id b6mr575109pfg.187.1517877512697; Mon, 05 Feb 2018 16:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877512; cv=none; d=google.com; s=arc-20160816; b=g9m1ify9vVnyJjyah1meZqZj32HiF8HHRXOE/YCNtmBC6922XjEZCFCPtko/JC19pK Fz7EW9p7LkeUekETw5moXAUUln6Q7x4eULkfxmklgeLhwCkz366S/mYtKRHj5U80q12b Ag4bxbrr9dikhHP/Z57WRPwnq5jyV8ybUXYD4f5Vy6yN98CGsoMfgco0aaOg42QB8/Bd AP23zCFk6GL5t3l1xZgfUtaUHv2vX+2TzxvAAwa/1IYYikVK9UUbEt+g8D1CvH96Z4J3 pIYpgOE4/+2F2syRPU2nXGpZdpcFpe506KHOJUm5Y6Cqe9ozNPX62uQNn1asfMyQSRTj zYiw== 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=sm0FoNarUulcD/w2qLJkmkFC1PlsCAolV4lrUTnLk/g=; b=Kp/Vi0UV5m1tlTPpwQTxviLccv0vv6ylsBQnQliIYPGzVw8G5p7YDvucl5T/fkuqGQ MqwyqRaNt4ter8QN0dch6QMRFKin4rnXqpp72Mf8yk4jTNuF80bXDkrHVeRE2qM5Wscq AS2brOB/moQ/6ySTKtaxshgYvQh8gX6E+2vT/oLXwrYSZ3QER5BkYPO5gqM3zcdhUQKT L2yJp4bioE8Z8T0Mn9EdluTrah37LDDzjM23sH3Fjd1WC2VyrYnKKyL/5qB8/d4C9gG+ PAqRHirloMvhdRwJLfR0IOCdr1jLvf2OgaJpnl3Hcjqo1c2Fl9Fp0sjO3VSRW39of+zi HNSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=RSV3Gzcv; 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 s8si4262968pgv.654.2018.02.05.16.38.32; Mon, 05 Feb 2018 16:38:32 -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=RSV3Gzcv; 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 S1752517AbeBFAib (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:31 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39781 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249AbeBFAh4 (ORCPT ); Mon, 5 Feb 2018 19:37:56 -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 w160ZHAr011351; Tue, 6 Feb 2018 09:35:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAr011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877330; bh=sm0FoNarUulcD/w2qLJkmkFC1PlsCAolV4lrUTnLk/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RSV3GzcvuMfuKMakkGUgvIn23by4uvSJHNwka+aUSftXVxUSrxs0r1RyyZJssY0D0 PYBiNrFeKpTj/qEYKkfYJcQKhnZliP2fwk4caG1Itsepv8jcOv5EB+qjNcMvbNUBcJ nBASfppTOXjbaIlmTLBg4IcPpMDqLTccuOIPV8kueup0qnNcysI4zL8icoWs+WNaa0 AyGKxzGcHV+7Xl7WFFBYa1xVc1grxGc/EijYLRWFWt59t3uMLKb0OxtJMJ17I0NnSD yEuPQ7dwSfGbrlrkpp3aQKHAOIiaL818PCejc2cahsYeUnWXoP1II94hocyUh0vA31 jOTEa/X/sL9Pg== 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 12/14] kconfig: test: check visibility of tristate choice values in y choice Date: Tue, 6 Feb 2018 09:34:52 +0900 Message-Id: <1517877294-4826-13-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 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 --- .../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 -- 2.7.4 Reviewed-by: Ulf Magnusson 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