Received: by 10.223.185.116 with SMTP id b49csp8235189wrg; Thu, 1 Mar 2018 20:43:55 -0800 (PST) X-Google-Smtp-Source: AG47ELtiYP9simwqcbnECGPGCUUo4Y+9IGBX15RBahRc8U6xEVeKaKXHI1rA41rp1QgUZTpsfwmy X-Received: by 10.101.98.17 with SMTP id d17mr3559116pgv.221.1519965835871; Thu, 01 Mar 2018 20:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519965835; cv=none; d=google.com; s=arc-20160816; b=ZvuG537NcIUvnoAV/33PdrK65d4n5gQVxcHyyQB+3ZSrpcx8V2Wx5EwGW4RwsdYkjA Rtto7/t09PxcsEiVeSFiKo3WOb1HsT9zd9vCSTXL9HBKtd07SDXXVcs1gFbu7z48BVa/ LWiIGVywRuWlISXgLjSqhmby130wmbVPYN8eXkHEwXpdzMg8tN6Nfv+uWYmWYk3AU2ec wFCw3Ulz13zjC/EKEMGJp+DbVas3rqXrvMLqmMBG7V4aoRGxKqe3oSJmjTYWSpkQSmzN pL7Qw1cTd/OiF/gYroDYK2A2QuwKHWqMaOmGQCrYCkhPGvfke+knG+mRYz5YpncnRyYZ 33/w== 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=g8R2tmpmVk72gaUbP+xvvOZaMYd+D3hhIOdaQcR3bNA=; b=bKWqVW+UCzBGHXDiPU+SqQEiMt3SrRKeAJd1iM8EFA/9gdzqb9rvclqIt65BdTtgjZ fM1rLHzZwdWdaedAh9/xKYStQlclOyRI7I+yDSZZoDZ3rMbRs/QpxMuIB6+Ys2RbZKvp BT/IU4W4pT//F1EK7+uqA+lgZT0Z81XoygfXG9UjdjJZFQXCvGnq2XhjbYUJkEQvD6cp RpM87zdA5MACQLAKaC7FyPHoUxZa4fYY89YrrWGNFD0OV7keyW7fozoMpR0N73Ghiqcx yLRi4zNcmD8rq9US882N3nL2WTc2xhL1CkkP6kTzK1j2d8idULRszlc6i8vj8qY9gElM kLjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ivHnsPhl; 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 f127si3466247pgc.49.2018.03.01.20.43.41; Thu, 01 Mar 2018 20:43:55 -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=ivHnsPhl; 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 S1165007AbeCBEdt (ORCPT + 99 others); Thu, 1 Mar 2018 23:33:49 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:53157 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164417AbeCBEdr (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 w224WURI022085; Fri, 2 Mar 2018 13:32:36 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w224WURI022085 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519965156; bh=g8R2tmpmVk72gaUbP+xvvOZaMYd+D3hhIOdaQcR3bNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ivHnsPhlHm22WygAUVBN94ISQTp9dw/60ru74+AfruoeQcQ8ElTuweFHsWIoZOu06 b3FYQAixmBDzxo8kt7F2uggHcBW7NE9Nw5TjR9PuiL4E5VrR2uYHkwOLsb7q7PL/Qf b8Cjb4PINXc4zkHu2CWOAtU8uMi60gZyTVKvyfJ4v6UjRSHtc2QnO6fqFr8pmEraiL 2jkiPdbwxhghf/U4e8Nz0qH1vzlgNZ8jhG8X5OhN2sx0PJm+K1TpGfF7wqyMhvTRwZ YdXIJkz5J8qIwPoIrZFUd+x1B82dMaamCJr1Zg3RvWKbFL03JSaTKHibQ84Go2++91 d4DBAafzcT4fw== 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 07/11] kconfig: unittest: check visibility of tri-choice values in y choice Date: Fri, 2 Mar 2018 13:31:57 +0900 Message-Id: <1519965121-12017-8-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 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. With commit cb67ab2cd2b8 ("kconfig: do not write choice values when their dependency becomes n"), it is not written now. In this test, "# CONFIG_CHOICE1 is not set" is don't care. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- Changes in v2: - coding style clean-up based on PEP8, PEP257 .../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 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..f8d728c --- /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..2b50ab6 --- /dev/null +++ b/scripts/kconfig/tests/choice_value_with_m_dep/expected_stdout @@ -0,0 +1,4 @@ +Tristate Choice [M/y/?] y +Tristate Choice +> 1. Choice 0 (CHOICE0) +choice[1]: 1 -- 2.7.4