Received: by 10.223.185.116 with SMTP id b49csp8239529wrg; Thu, 1 Mar 2018 20:51:02 -0800 (PST) X-Google-Smtp-Source: AG47ELtFUtMJgxu0/9BLn1M5IVmiFs+rX/jiJ8fV5bTe8gLPBLN6NL/5GpMw3h3UqAh5j+1Whdhm X-Received: by 2002:a17:902:7608:: with SMTP id k8-v6mr4053497pll.95.1519966262142; Thu, 01 Mar 2018 20:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519966262; cv=none; d=google.com; s=arc-20160816; b=yj1GLFeo09wsrOdcqz1gNZAbznaoggdAgonrmYj6R9vej7cIfoPNKeSlEKvwO7+CA/ l+9pC9ntOheF5Pncc8nmLUELKlM2z9uuWq1RuQGWi+9WlU+js23a9ub9wpLrhNTT0fAx covmK+SwVxl0yIUVFQTBETsU2KSDiu+UT+BAnr1bbxjS9TrXj8tPg4YkTPY7favK75MX BTWKuSrsx7YZO3aXqnXXHHgPNEypj5QqFKCsxeADPaYqNyYgEQTfKYHmgfNg7L0ghKig Ng9jKY8m8tfOjzSlneNHAhm8UKmJyWOx/1+ILVR/nfZnXAi0b5jtqZjgiJkASgOGuZfF 3ARA== 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=CIgyADcpoO0K4EjFo7YjMYB6IgXXC6HyzO1sbrgeduo=; b=UEo+xeBt+LITM76X6aetNmuzvAewG8AjsPGM7DhRHKx9A5El7mTdnsO+o8KWfK+T0X 79xl0w2CJgqKzEQ7dUzTJU0ZH/WVkl/FVClnPyVO0toBGkvTcjlCbJpMHNwKwsqltgaA ZzapIubsTzViwH3GY0vLKzpKI9LkRJyk9SQlfwoeWtHqiu9C8RXahFIZP7pwYaKN3mAK 4S7B9vLMyz1PN7mQ/t5g3i3RaPyT9jakAKPNlAPAItQ620UPzX8/b7xOGP3ZsNTbjIGi 3vqtiJEVuNPXC18eirhB+4odDi74au616hAtt/mOEnp1+FlLvNwxEwfeD8rTv78ymScL ZztQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Ei9pojNn; 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 p14si3471776pgn.333.2018.03.01.20.50.47; Thu, 01 Mar 2018 20:51:02 -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=Ei9pojNn; 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 S1422768AbeCBEg0 (ORCPT + 99 others); Thu, 1 Mar 2018 23:36:26 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:53156 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164988AbeCBEdr (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 w224WURG022085; Fri, 2 Mar 2018 13:32:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w224WURG022085 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519965155; bh=CIgyADcpoO0K4EjFo7YjMYB6IgXXC6HyzO1sbrgeduo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ei9pojNn9JMI+P1jcTv9Yhh3ryrdrrHQ/jceOsTpGRR5zyAmPB5a9y3q7YdyQgBxG J9Ozhp/ALSahzK3DtQc9H0f2Kre8i9UeIXRIkH+pAr1RgbMyuDS9IMg7f7sKt/xoEW 2rb8aBuZ+HWOdagPLeTY4HplFCnmyPABuwjcditqXHASOfyPgNXhomuZcmkSCjDO+h WgKpuPsbHOo4Hx53gNV7twgXkdhbs4IJRJ8bpW0jimKHKTl0thdtux+tuEylXsKw+f T28Zr+Df/IIcB/ZFYa6fabf4ooFLLvlJjVea0ZYXqKeZIgYHp6E3/KKsd9eS2E+1y1 Nxsi5GUpNKH+A== 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 05/11] kconfig: unittest: test if new symbols in choice are asked Date: Fri, 2 Mar 2018 13:31:55 +0900 Message-Id: <1519965121-12017-6-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 new choice values are added with new dependency, and they become visible during user configuration, oldconfig should recognize them as (NEW), and ask the user for choice. This issue was fixed by commit 5d09598d488f ("kconfig: fix new choices being skipped upon config update"). This is a subtle corner case. Add a test case to avoid breakage. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- Changes in v2: - coding style clean-up based on PEP8, PEP257 scripts/kconfig/tests/new_choice_with_dep/Kconfig | 37 ++++++++++++++++++++++ .../kconfig/tests/new_choice_with_dep/__init__.py | 14 ++++++++ scripts/kconfig/tests/new_choice_with_dep/config | 3 ++ .../tests/new_choice_with_dep/expected_stdout | 10 ++++++ 4 files changed, 64 insertions(+) create mode 100644 scripts/kconfig/tests/new_choice_with_dep/Kconfig create mode 100644 scripts/kconfig/tests/new_choice_with_dep/__init__.py create mode 100644 scripts/kconfig/tests/new_choice_with_dep/config create mode 100644 scripts/kconfig/tests/new_choice_with_dep/expected_stdout diff --git a/scripts/kconfig/tests/new_choice_with_dep/Kconfig b/scripts/kconfig/tests/new_choice_with_dep/Kconfig new file mode 100644 index 0000000..53ef1b8 --- /dev/null +++ b/scripts/kconfig/tests/new_choice_with_dep/Kconfig @@ -0,0 +1,37 @@ +config A + bool "A" + help + This is a new symbol. + +choice + prompt "Choice ?" + depends on A + help + "depends on A" has been newly added. + +config CHOICE_B + bool "Choice B" + +config CHOICE_C + bool "Choice C" + help + This is a new symbol, so should be asked. + +endchoice + +choice + prompt "Choice2 ?" + +config CHOICE_D + bool "Choice D" + +config CHOICE_E + bool "Choice E" + +config CHOICE_F + bool "Choice F" + depends on A + help + This is a new symbol, so should be asked. + +endchoice diff --git a/scripts/kconfig/tests/new_choice_with_dep/__init__.py b/scripts/kconfig/tests/new_choice_with_dep/__init__.py new file mode 100644 index 0000000..f0e0ead --- /dev/null +++ b/scripts/kconfig/tests/new_choice_with_dep/__init__.py @@ -0,0 +1,14 @@ +""" +Ask new choice values when they become visible. + +If new choice values are added with new dependency, and they become +visible during user configuration, oldconfig should recognize them +as (NEW), and ask the user for choice. + +Related Linux commit: 5d09598d488f081e3be23f885ed65cbbe2d073b5 +""" + + +def test(conf): + assert conf.oldconfig('config', 'y') == 0 + assert conf.stdout_contains('expected_stdout') diff --git a/scripts/kconfig/tests/new_choice_with_dep/config b/scripts/kconfig/tests/new_choice_with_dep/config new file mode 100644 index 0000000..47ef95d --- /dev/null +++ b/scripts/kconfig/tests/new_choice_with_dep/config @@ -0,0 +1,3 @@ +CONFIG_CHOICE_B=y +# CONFIG_CHOICE_D is not set +CONFIG_CHOICE_E=y diff --git a/scripts/kconfig/tests/new_choice_with_dep/expected_stdout b/scripts/kconfig/tests/new_choice_with_dep/expected_stdout new file mode 100644 index 0000000..74dc0bc --- /dev/null +++ b/scripts/kconfig/tests/new_choice_with_dep/expected_stdout @@ -0,0 +1,10 @@ +A (A) [N/y/?] (NEW) y + Choice ? + > 1. Choice B (CHOICE_B) + 2. Choice C (CHOICE_C) (NEW) + choice[1-2?]: +Choice2 ? + 1. Choice D (CHOICE_D) +> 2. Choice E (CHOICE_E) + 3. Choice F (CHOICE_F) (NEW) +choice[1-3?]: -- 2.7.4