From patchwork Tue Mar 13 09:12:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131411 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp482843ljb; Tue, 13 Mar 2018 02:14:02 -0700 (PDT) X-Google-Smtp-Source: AG47ELsUDct2TVrXR5oK178BPqXOGCg00nyvi/csxsSMIGgn49WP8Yq0wMmZXSP3aIDM+HSsNuZo X-Received: by 10.98.28.202 with SMTP id c193mr10997981pfc.109.1520932442372; Tue, 13 Mar 2018 02:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520932442; cv=none; d=google.com; s=arc-20160816; b=tKFcCwM4fv0VkuV93Ph6cHt0QbWw90HJQR3XiDQAs0XdSWXmp4svH8bZ7K5dvMV+2U mAWedg7eQBakayPoR3pLdIkDFkEk/LNj9M//Xkvuj00gPInknYoxkgahEkwzw1d0zbQ/ ChpzNvEZHFedMVBPYgpuIbpQPbJKZ6rN0nw4zi8r1E6k1oifwxIjUDU95xBVbqeI6VCn vfLcIQN16I5ERrKV3Rn0WkUGGJfrewzMQ+C8fNHF55LAIMYtvELoEhDdq8YoN3gZXl47 0bXEDKard7f/uj5sCmQOjlk5kUvlp0XNwMnyD+0q9FcT6AtrBzFcn7SvxupyVMoOBQbw +u+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=pPPUXuP/OavNIYDfLQH0wMWarHU7wLntc30/ogFJGW0=; b=f3Yv3SQxM2+uUffz7T4gGvPvsvKJiHELCO92QPgB0udo3M0JX4kQz8M4hqiLUwm8OF 1axIAeASL8SJO7qUJMGKW2MGSUdgYRyJF2Rk87Gi7jiIN/rJ3HgF1KN3DLVa96aXfMOZ 2zZs99FU2+RjKGk5p6w7wk/w8/AveoOXyB8gcVXyODbRFLbqLF+J7HFo9iUxk3Z1yQTd /z3dOkTWIefoNVmq52H/S3CEKk2oewWLZ3CgxszqLAcyI2M4hOjqN2hHy+P3cX1ClXEj V6U/Rxnq5e3BBnzxNPtBXeQ4CwOlNdZYO6YUhlnV4rMeEdvb/riFSRz6VIqMcLuFgaaF 97DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=xn1dn2h8; 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 38-v6si7479115pln.397.2018.03.13.02.14.02; Tue, 13 Mar 2018 02:14:02 -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=xn1dn2h8; 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 S1752474AbeCMJN7 (ORCPT + 28 others); Tue, 13 Mar 2018 05:13:59 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:41661 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752188AbeCMJN4 (ORCPT ); Tue, 13 Mar 2018 05:13:56 -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 w2D9CIo8016505; Tue, 13 Mar 2018 18:12:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2D9CIo8016505 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520932344; bh=pPPUXuP/OavNIYDfLQH0wMWarHU7wLntc30/ogFJGW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xn1dn2h8ijA9YXQD02qTTfyk2EriMfO39m7GKewVqbTxGLarYISglF580wI1h/lRZ BfYx0nJU5qVz0876uqgGsPYYRNADZGnULfmE4eZsChFaRu5Ls77IJBjULYUSNMemtk e2s3kpuv+wboyL1fEf1r9+tc8RJ1KYIG7SAJ1Z7LHJV8Dn43q0Ac3WXS0CvFecTCFo dDtbW7YUoR/bWbmpPkIX49yKkIQjgEIYRTekRRNRX30RtiluQUYs6oTAd8uEZXascf UUQCtjxVJC2+PUX6Tu5H1wbVc1M07JZ8M5he9ik1zUyBQ1gItkwRGR6Cidc4v1Ev5R euHA265djBeLw== 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 07/11] kconfig: tests: check visibility of tristate choice values in y choice Date: Tue, 13 Mar 2018 18:12:08 +0900 Message-Id: <1520932332-2449-8-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 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 v3: None Changes in v2: - coding style clean-up based on PEP8, PEP257 scripts/kconfig/tests/choice_value_with_m_dep/Kconfig | 19 +++++++++++++++++++ .../kconfig/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, 43 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 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..11ac25c --- /dev/null +++ b/scripts/kconfig/tests/choice_value_with_m_dep/Kconfig @@ -0,0 +1,19 @@ +config MODULES + def_bool 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