From patchwork Tue Feb 6 00:34:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126937 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2442048ljc; Mon, 5 Feb 2018 16:40:12 -0800 (PST) X-Google-Smtp-Source: AH8x225zSjN5E0u9o17LjZhd7OC5b3HHlnaHREuBagwy1PCFE4lWZs1FELxPj7vDoLcQUIv18RaM X-Received: by 2002:a17:902:15a8:: with SMTP id m37-v6mr612249pla.186.1517877612306; Mon, 05 Feb 2018 16:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877612; cv=none; d=google.com; s=arc-20160816; b=KxMjtNsXEoZXSclX85CRn16/hmPy80P1ZMbvTiuT2Ed0pm9BZwGulKjD6wokleGjzs nNJWj2n1brm3gfvWglc9qSAy5O2O18XfgZzhaIqGd+s/9yL6Q3qdbSsYihkHtGDs1uUD S2mgcSj16C+XXBPNSSzNz0KcNjLPdZWDi9464UPC+vrApT5P/gCF35GZJp1CQRgDiuA5 7Wb5Ot1GAq+VnFobzbAjkPJfgm37WLk8Mk0WPdu+p53u5xVIgRb10pntK9qR5fPbpNm/ qysevIPb/1AKnih7Q3x5L90dDwcW1/gsfSd9JcI08kc8oYkXW8uwD300WrL7X4IhMHbI UxOA== 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=T9u7K+hmWKfvjcjjYHb1paogJ/PbBcbc8jyZmrvK6GA=; b=x16jV2/jSnOOLzdzWeJCULHTDTQdlPoMaxougHpDFnNi3H/RH4LdOkHKhtbfYoDvbY VTPo0T4/E6u5vBKl68jGU2leOZde6WIaMlrloJk2LpLKX5LZx+OK5SfcSX4yLuqmG4ff vMqzfpP82QQgnfhibRrjeotlURCg/z4ByjZZ5e2uFLKVxSWEQ5/wUyIllMSGtOwajxPD NLeDy6BMgN2HNKwf9TmhSvKZrcU6D8AyyCV+wGRZ1N3lY6CCudU0MS4Ew3muUeRzkgTn OXse630MeCsMq+uVs8PDEM1hhRR4NAInG6/DW1g1STNDH+jjiFxXV0+R5aprcmKL8Fe7 lMxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rjWn4lBQ; 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 x63si709625pfk.335.2018.02.05.16.40.11; Mon, 05 Feb 2018 16:40:12 -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=rjWn4lBQ; 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 S1752469AbeBFAkJ (ORCPT + 21 others); Mon, 5 Feb 2018 19:40:09 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39929 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752327AbeBFAiA (ORCPT ); Mon, 5 Feb 2018 19:38:00 -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 w160ZHAg011351; Tue, 6 Feb 2018 09:35:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAg011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877319; bh=T9u7K+hmWKfvjcjjYHb1paogJ/PbBcbc8jyZmrvK6GA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjWn4lBQynyejp41BRZzCosw5lK6nw+ggwckAvLnUBPIdrrnGj6NI/0Ml0yxTDLpX k34Hnhx65dB2Rnq8Sr4hHizuwhGaui2DmlNx5atuo5KDrDMDcGw+HXSN0IJYKGtZn8 EDCPEWzl85IKbgnOdoRPX/k9EJIXHmnizGuMub4OGQDJk9ceoUG1L5NubcHsMb694U hZclVceRrAg3dLAsqy+vVP6Y89GoIj7AC9hRAtyv9gjVBbUth5eymlZ9Kdpv2V8O8u r8b1f5zQMiRZXBECjazynvuRWrEMjkIbHMaub6VwZ1sCLrhk1JBv3SWz3R9j1NJgwE 0T6WqLMLNuxvw== 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, Marc Herbert Subject: [PATCH 01/14] kconfig: send error messages to stderr Date: Tue, 6 Feb 2018 09:34:41 +0900 Message-Id: <1517877294-4826-2-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 These messages should be directed to stderr. Signed-off-by: Masahiro Yamada --- scripts/kconfig/conf.c | 18 +++++++++++------- scripts/kconfig/zconf.l | 27 +++++++++++++++------------ 2 files changed, 26 insertions(+), 19 deletions(-) -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 307bc3f..90a76aa2 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -75,9 +75,11 @@ static void strip(char *str) static void check_stdin(void) { if (!valid_stdin) { - printf(_("aborted!\n\n")); - printf(_("Console input/output is redirected. ")); - printf(_("Run 'make oldconfig' to update configuration.\n\n")); + fprintf(stderr, + _("Aborted!\n" + "Console input/output is redirected.\n" + "Run 'make oldconfig' to update configuration.\n\n") + ); exit(1); } } @@ -565,7 +567,7 @@ int main(int ac, char **av) } } if (ac == optind) { - printf(_("%s: Kconfig file missing\n"), av[0]); + fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]); conf_usage(progname); exit(1); } @@ -590,9 +592,11 @@ int main(int ac, char **av) if (!defconfig_file) defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { - printf(_("***\n" - "*** Can't find default configuration \"%s\"!\n" - "***\n"), defconfig_file); + fprintf(stderr, + _("***\n" + "*** Can't find default configuration \"%s\"!\n" + "***\n"), + defconfig_file); exit(1); } break; diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 07e074d..0ba4900 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -184,7 +184,9 @@ n [A-Za-z0-9_-] append_string(yytext, 1); } \n { - printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); + fprintf(stderr, + "%s:%d:warning: multi-line strings not supported\n", + zconf_curname(), zconf_lineno()); current_file->lineno++; BEGIN(INITIAL); return T_EOL; @@ -294,7 +296,7 @@ void zconf_initscan(const char *name) { yyin = zconf_fopen(name); if (!yyin) { - printf("can't find file %s\n", name); + fprintf(stderr, "can't find file %s\n", name); exit(1); } @@ -315,8 +317,8 @@ void zconf_nextfile(const char *name) current_buf->state = YY_CURRENT_BUFFER; yyin = zconf_fopen(file->name); if (!yyin) { - printf("%s:%d: can't open file \"%s\"\n", - zconf_curname(), zconf_lineno(), file->name); + fprintf(stderr, "%s:%d: can't open file \"%s\"\n", + zconf_curname(), zconf_lineno(), file->name); exit(1); } yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); @@ -325,20 +327,21 @@ void zconf_nextfile(const char *name) for (iter = current_file->parent; iter; iter = iter->parent ) { if (!strcmp(current_file->name,iter->name) ) { - printf("%s:%d: recursive inclusion detected. " - "Inclusion path:\n current file : '%s'\n", - zconf_curname(), zconf_lineno(), - zconf_curname()); + fprintf(stderr, + "%s:%d: recursive inclusion detected. " + "Inclusion path:\n current file : '%s'\n", + zconf_curname(), zconf_lineno(), + zconf_curname()); iter = current_file->parent; while (iter && \ strcmp(iter->name,current_file->name)) { - printf(" included from: '%s:%d'\n", - iter->name, iter->lineno-1); + fprintf(stderr, " included from: '%s:%d'\n", + iter->name, iter->lineno-1); iter = iter->parent; } if (iter) - printf(" included from: '%s:%d'\n", - iter->name, iter->lineno+1); + fprintf(stderr, " included from: '%s:%d'\n", + iter->name, iter->lineno+1); exit(1); } } From patchwork Tue Feb 6 00:34:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126936 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441933ljc; Mon, 5 Feb 2018 16:40:00 -0800 (PST) X-Google-Smtp-Source: AH8x225QegOZNGKeY/0WLDM9+/f1VUp0C15H4wR1ucRPmZu9lzXEpJhAl1xJqXoW1PbFWGNZ+LF/ X-Received: by 2002:a17:902:6042:: with SMTP id a2-v6mr555170plt.335.1517877600288; Mon, 05 Feb 2018 16:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877600; cv=none; d=google.com; s=arc-20160816; b=lvao5mMMMq+wngr8A0B/ag3l4e2+VdYVE37FrndkCj4QeuhBCZOdOJE/HMAXO1/zA4 wBW1B2+TTCe7VdW/llwFpxVXhrtr+lSP8uUV6cmC3BUmXHY4TlgMC5IOksJ8XjnCc8oq pgIg3vOckabBSjNNcca07kPnplzdzUrSShBYY3BHo5EnXJ6aTSx0NWhX4ccIoUHuuekV +q7p0pSgfl+E4Kzh1kjYpFe3W8u85kDwbGMKvXTRPvsuuJFrsm4ytYLi8orUvl3j6Wks dwBALlcV3PWOL4Sk2A9K0YZ8pX9fBN7odLPGJ5MXPcofb/5kNybczyDjWRJHwXuVyQmE TvLg== 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=GMlbL4n4TZmnicc5N3ATpO1/g+JjbJbNcZa/SH7AxAo=; b=TUT2oCsA2K62loL3dCwx8RjTl/s63uwlQeyKUty2IoByW5VfAph1Xe4IdF+8zMogVm xWzf3SaVc9aXFoQfyT/VfJ0q4DIj1zQ9gucIRVjLP43rrpvvGQMDaFZLhvVpEzLqTdF4 6dOdBqvnTTjTR0HoCYgEnvglFKOzGGL4radzIXHw4wPLI/FmEg5Ri7cwJpQMMrWJl5EO GrV0n1JiHCFQb+tfQS7ycz08sJ/885WghoSU4d9PWlh65Hjw4zRuB2UFAMzHMLT7AAuz 5tl3GGk3UZi70B0fDigXAqbWLLq/GsCLPSvnrEsNuo0rzmcHToh7ouE79AT7IKs960nU GWBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=QSclydS1; 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 i22-v6si712233pll.332.2018.02.05.16.40.00; Mon, 05 Feb 2018 16:40:00 -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=QSclydS1; 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 S1752656AbeBFAj6 (ORCPT + 21 others); Mon, 5 Feb 2018 19:39:58 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39985 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752337AbeBFAiB (ORCPT ); Mon, 5 Feb 2018 19:38:01 -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 w160ZHAh011351; Tue, 6 Feb 2018 09:35:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAh011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877320; bh=GMlbL4n4TZmnicc5N3ATpO1/g+JjbJbNcZa/SH7AxAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QSclydS116Lo2ofpkjkI7keS06ykFOx83H3055BbsRYQBtrgkTzkDq+qhUO+9NsCi RepIf792fvyQp/Yg/Fql9GjuJdplz9951sKZMxtAYIz3MQ05N3g/XqUNM66SqzXJYj EWpqoEOFo+7QRS7c0qD2IPelb8dMLxcILyUsMh2Y4mv3UPT0Gz0HoEfiOORH43Vxeg 4G2S5ixB0i9sc2/vXzPvkmeTLKZLA8vXen0QHJDVe2g2nFBxTKVWSHMOGnaMUv6xHm kEweq7QdJJ2cCbTGMtr5TunF//klbMxtz4akvueqyj/Dfx1Dg1KTxdFOqbtTTtU4yz aKlnBboqGDOqQ== 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 , "Luis R. Rodriguez" , linux-kernel@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH 02/14] kconfig: do not write choice values when their dependency becomes n Date: Tue, 6 Feb 2018 09:34:42 +0900 Message-Id: <1517877294-4826-3-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 "# CONFIG_... is not set" for choice values are wrongly written into the .config file if they are once visible, then become invisible later. Test case --------- ---------------------------(Kconfig)---------------------------- config A bool "A" choice prompt "Choice ?" depends on A config CHOICE_B bool "Choice B" config CHOICE_C bool "Choice C" endchoice ---------------------------------------------------------------- ---------------------------(.config)---------------------------- CONFIG_A=y ---------------------------------------------------------------- With the Kconfig and .config above, $ make config scripts/kconfig/conf --oldaskconfig Kconfig * * Linux Kernel Configuration * A (A) [Y/n] n # # configuration written to .config # $ cat .config # # Automatically generated file; DO NOT EDIT. # Linux Kernel Configuration # # CONFIG_A is not set # CONFIG_CHOICE_B is not set # CONFIG_CHOICE_C is not set Here, # CONFIG_CHOICE_B is not set # CONFIG_CHOICE_C is not set should not be written into the .config file because their dependency "depends on A" is unmet. Currently, there is no code that clears SYMBOL_WRITE of choice values. Clear SYMBOL_WRITE for all symbols in sym_calc_value(), then set it again after calculating visibility. Signed-off-by: Masahiro Yamada --- scripts/kconfig/symbol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index c9123ed..5d6f6b1 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -371,8 +371,7 @@ void sym_calc_value(struct symbol *sym) sym->curr.tri = no; return; } - if (!sym_is_choice_value(sym)) - sym->flags &= ~SYMBOL_WRITE; + sym->flags &= ~SYMBOL_WRITE; sym_calc_visibility(sym); @@ -385,6 +384,7 @@ void sym_calc_value(struct symbol *sym) if (sym_is_choice_value(sym) && sym->visible == yes) { prop = sym_get_choice_prop(sym); newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; + sym->flags |= SYMBOL_WRITE; } else { if (sym->visible != no) { /* if the symbol is visible use the user value From patchwork Tue Feb 6 00:34:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126935 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441880ljc; Mon, 5 Feb 2018 16:39:54 -0800 (PST) X-Google-Smtp-Source: AH8x225TzE4VyoVGQYmUD9hOuOQMBZkLKog0NLenQMlGwy1V1x3/yx9dqMXcC84VUkcZ14LWSrS+ X-Received: by 2002:a17:902:9005:: with SMTP id a5-v6mr566946plp.251.1517877593977; Mon, 05 Feb 2018 16:39:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877593; cv=none; d=google.com; s=arc-20160816; b=UXj6oHwkR9eyn166Rq9jDzRa0mzsaJ62K9LO/4yWaB+tW1nOHkVa+eiRpzifBiO35g c2/Edi0u3LsU3M7IMl31kUSzzsIVWYZ0644qms4mFWYb514IFkTBLesLCYbCbI8NUzZY qrWPYWvYwhl0Euih77mUzFjiwWCXCtIAcuYE4Vxq+NKkO5p3lskexTpawwjSgPMZjw4i g4mjrr79oqWcjMFgpzpT0yE8hYlAqSomWbxDykgLMWV5ryAF97e1NIn+WJDKLGRqT1Oz sA0kipMdxjAm4lBjdCWMpYKDMDZR9x4HMBYkCm9/0gm/Xv/3fLXD3j/uLWwNjxO7SXYg ATyw== 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=bLojHb0MdVijoOprmBRkaKTU1H/92xNDhc4zozTi0o8=; b=UkI2JLJyG2DM5izbOjR9NLIr1bf9mvmKyhXwDaOq4RNJ/Ir9fA4/HFu+btJMNWCASI KkXFjNRkbr8h10TvrXeT4B8wQAxlyLH9IGcykj1EvdJmsu/+hNOjYDshZYkas4cVXizF Tif6amg+qbs7pHuEXr6/e2Xf5+4s0UBSc01p6qlmA7GteatInlBeYsGJvFi7z4F5eDJb 1tiT5HORU/brAGjCiXMvvqyEJdaJMLV07ctWjPtxnbq+5zUzzpog4s5V55/uzO9hn7mv p4usmsFmNiPHLpmaPnzKW+Sr9fNKW4kOkwFs4+4qN5l6ahoqWwqZUAKhodm17uaH42uq PGRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JQ0+PpGv; 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 i22-v6si712233pll.332.2018.02.05.16.39.53; Mon, 05 Feb 2018 16:39:53 -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=JQ0+PpGv; 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 S1752642AbeBFAjw (ORCPT + 21 others); Mon, 5 Feb 2018 19:39:52 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40211 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbeBFAiH (ORCPT ); Mon, 5 Feb 2018 19:38:07 -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 w160ZHAi011351; Tue, 6 Feb 2018 09:35:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAi011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877321; bh=bLojHb0MdVijoOprmBRkaKTU1H/92xNDhc4zozTi0o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQ0+PpGvkB1YVC1o0mBV5cyxkFVcbWJ6DVjn4Grnav8lE7wbF2I3HCo6ro+7CIg/h 78bm8UCZ//NHqmejijd9o1c3ZT6JZOSx50SghXnu2Ds7oc2+um0K+c8kPQo6snPTwY skT+u0XBKiYmtsneNfy0nx5hMJquLXxKxheH1QmETp/y5AER9ErZC/9RXxZ71S7Fxv kSQxQw094haJfXf782kJhsr0QhFrdk/MaqgbfPiQSsLrzmdBGLDDEhWdNXSLiXbVNv 4fXlYz1IajtZnR/+1mGGE1U5aog9gcXNuYcSAdzxkMarIV4jCCeeOHksl7ktgCxizN krOE48G0v4J8g== 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, Marc Herbert Subject: [PATCH 03/14] kconfig: show '?' prompt even if no help text is available Date: Tue, 6 Feb 2018 09:34:43 +0900 Message-Id: <1517877294-4826-4-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 'make config', 'make oldconfig', etc. always receive '?' as a valid input and show useful information even if no help text is available. ------------------------>8------------------------ foo (FOO) [N/y] (NEW) ? There is no help available for this option. Symbol: FOO [=n] Type : bool Prompt: foo Defined at Kconfig:1 ------------------------>8------------------------ However, '?' is not shown in the prompt if its help text is missing. Let's show '?' all the time so that the prompt and the behavior match. Signed-off-by: Masahiro Yamada --- scripts/kconfig/conf.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 90a76aa2..d346642 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -201,9 +201,7 @@ static int conf_sym(struct menu *menu) printf("/m"); if (oldval != yes && sym_tristate_within_range(sym, yes)) printf("/y"); - if (menu_has_help(menu)) - printf("/?"); - printf("] "); + printf("/?] "); if (!conf_askvalue(sym, sym_get_string_value(sym))) return 0; strip(line); @@ -305,10 +303,7 @@ static int conf_choice(struct menu *menu) printf("[1]: 1\n"); goto conf_childs; } - printf("[1-%d", cnt); - if (menu_has_help(menu)) - printf("?"); - printf("]: "); + printf("[1-%d?]: ", cnt); switch (input_mode) { case oldconfig: case silentoldconfig: From patchwork Tue Feb 6 00:34:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126929 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2440967ljc; Mon, 5 Feb 2018 16:38:19 -0800 (PST) X-Google-Smtp-Source: AH8x224o6IZbZxr8+VK+XL7d72NuqRgMJKSmU4KlUnTYyujk5MOGrkX+hnNfi221fF53hV0Ugzhe X-Received: by 10.99.100.198 with SMTP id y189mr447969pgb.277.1517877499490; Mon, 05 Feb 2018 16:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877499; cv=none; d=google.com; s=arc-20160816; b=ie51QeldWLe2ytyl3A88yUAwIjw/utJ2UGzK+GNOrWbvLqr1UAupyVxJqfdMbOP1YF qsjmjkBZAspxLrmrIZCbCq+3GHpMocXlUuUkT2NEAJb7zDJJ9xznbjTx63VmdVuC2u2Y nIbfGG+gXlUiSlMpNyG4ULzyYXug9PSC1/cA9VpjT74vK2npFqPxmHZzLhnxEkr9fnL7 swb18DA+XnlqUlEyJR87/Ntf4WGo5ig8tvU5LEGvgKd6xDeTaansDtEcW85Ym/2XbCXS 37e+ImzouB0SqYKk1xM6JfGEbC0rJhQ63KRlPyDeWx3kjHXlq3s96ZcxI5Mh0Wx8eD9D GDOg== 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=bqIObxmbs+IzgdDGruZRzcflE0S0IiR14juIeTQmYtc=; b=txnbrbWeYa0a6VXxMmZmsH1fbotF9mR66SAaG9oX2G4jJ4dV2DunONQfZ6H5sjmVdc bDiJp2XAhFcWlDMdSi6GUpNMYIHDfzI/JE9n9pEd1mY7Lh9fdCgvdLrGXWR6vtW7q/Ox zpVn9QGtBJ+2l6aFUNunIViJZuG1m07P7waHfOs0JUkDruJeNCqIVnMKIZ3q9XxMssOv XPqiRYAkgfZfejXbejF7c3gN9Cc6grBEMxZ+ElHhj8iTm/9075nAZ+iZUiDS0RjN+Ww+ VkMtMpLedwGiLAFatnG6zWZk2fs+ySkoViZeUAaJj0oZdOLdCHEcXsDb2q8d9awOaS1r Agwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=T6Xwwla2; 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 u64si778840pfk.340.2018.02.05.16.38.19; Mon, 05 Feb 2018 16:38:19 -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=T6Xwwla2; 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 S1752485AbeBFAiS (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:18 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39669 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbeBFAhw (ORCPT ); Mon, 5 Feb 2018 19:37:52 -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 w160ZHAj011351; Tue, 6 Feb 2018 09:35:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAj011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877322; bh=bqIObxmbs+IzgdDGruZRzcflE0S0IiR14juIeTQmYtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6Xwwla2i9CItolDKJN7eLb4Dbveik1q1/7q0ueK8vUCAI/imo+xCGTN4VKUyj4GX x1Go02bW9ymiQpOd9y+kIFkmkQB4lUpNAtoUHK1j2KGORN1D33J0Yy9iKwm6xLTvwd C5wMC8K8TQLn7LwuqeHialyZwbOj26o5BeCapsjbq3ltvG0VpYvEnVNjrvzQN+b7IV rllV9Xw3OvnfwVlHWvktfZhQLIO2qYWntqvI29mCPeaEtNkTKi7UrjeIMseyInPpOS gX0dUj6JIpG5azYxGGeCV5b2uTjAkZAB2Q134NRVfLxJ5v0hpwX3FVT7pusC2qJZse S4Vq/DyqRgQ3g== 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, Marc Herbert Subject: [PATCH 04/14] kconfig: print additional new line for choice for redirection Date: Tue, 6 Feb 2018 09:34:44 +0900 Message-Id: <1517877294-4826-5-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 stdout is redirected to a file, prompts look differently due to missing new lines. Currently, conf_askvalue() takes care of this by putting additional new line, but conf_choice() does not. Do likewise so that prompts after 'choice' look properly. Signed-off-by: Masahiro Yamada --- scripts/kconfig/conf.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index d346642..6ce06c8 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -317,6 +317,8 @@ static int conf_choice(struct menu *menu) case oldaskconfig: fflush(stdout); xfgets(line, sizeof(line), stdin); + if (!tty_stdio) + printf("\n"); strip(line); if (line[0] == '?') { print_help(menu); From patchwork Tue Feb 6 00:34:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126927 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2440785ljc; Mon, 5 Feb 2018 16:38:00 -0800 (PST) X-Google-Smtp-Source: AH8x224UA5k7reY/W5fW+xJdeG+zrR6gfgnW81OqI4CmcWutsdc2ri07+ioOeT5teRVo+3RyrRYe X-Received: by 10.98.139.26 with SMTP id j26mr614775pfe.4.1517877480553; Mon, 05 Feb 2018 16:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877480; cv=none; d=google.com; s=arc-20160816; b=HzA/4YM3x4gKZfjxN3KGdo8EbjfAjoHhQnyb0ee/KMw+kRXZYwukVXCkvc91FanjXI MGqS5DHYEfSX8F+ibNwzJgTY1vA5Pds3z5EIc2Z3b2YcSHNPb91iqYfwktwOV7RbRIPb 7oxlyVaG+lGGenw+KFZQawe6A0xEfdTv2bXYpfwNQq8tX6koQ6ftkmrYClLSoZ40h9jj kkDbN9nnJOfnVEv3IKPcmKTOwoEv/IisiIj7MnOxfSZY0SjNvcD5uWWSD6GkxNNhOHGz pgYaONP7A/ZrBM7iRmj5hJF8oBn4GR25XsByhBn1V6oYzQT08jh7187G6RNpjpmKzzKa sBVQ== 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=FpDmM6nkuUt2dyxIaCfbFjcP7kfXRyAs/NTglnLJiro=; b=slnDC6NvXzlBEI4rs7EYX3sZkgmvxaSNmIwZC9NU8O1jGO5RnmL3wBddu5jNUbQi6g WVsHszxb6grl4toRsGahhnfKe8r6LmDNGmtIyfufyLOscYcRa/8j42MzOGXnt7rQOMPE dY5ZwvK2PrIbesVqI+2JCI+5YQat8nPfz6Vm24Uf7k9cUDKkJ9wfoPTRpAkjZXJqQPth cXKYG1i43k991KAxcCdWmeik+htaQ0ylFbaz9zzqPIblRFcakF0g7WmvVVBpO2Ee2gXx Xw3DA+2MZhhuF6h2KOGgQx5y1jKsgxAQBOnhKww35zEXXEnrSwwacSBFghW49A3iux6R S2aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=lL2UTAV0; 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 a91-v6si181184pla.657.2018.02.05.16.38.00; Mon, 05 Feb 2018 16:38:00 -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=lL2UTAV0; 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 S1752308AbeBFAh4 (ORCPT + 21 others); Mon, 5 Feb 2018 19:37:56 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39620 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbeBFAhv (ORCPT ); Mon, 5 Feb 2018 19:37:51 -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 w160ZHAk011351; Tue, 6 Feb 2018 09:35:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAk011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877323; bh=FpDmM6nkuUt2dyxIaCfbFjcP7kfXRyAs/NTglnLJiro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lL2UTAV0mnV3/vBO6P/DIOrZYMBpmUHiPxkbWQKBFbQ2f6k5eGbjhU94NlNqIA+po MIhHCspjub/1At9JojVEqRDVuHp77mWogipyHyURu/zt3ZtprlhqnJ8y0AuXC9bJvG ZRTKF7xpQNNiGVqqdwUIimReb0OlLe7p90imw3A2VG0iMpxdHnqcMt7inmpI8/963a S7DKnQh8aHkMx6Wt5CWummSdL1P2B8AYmQDVYF04v2/1X9cxCQA7iKcUgTn2lL8tyE ntctuZ2NOmU8MBkI2XfQs/tkOVDHDluJBXtBS7+uNBlL1w57eng2tK8XY1GxYsp7Ab KRySS9z6JoL8Q== 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 05/14] kconfig: remove 'config*' pattern from .gitignnore Date: Tue, 6 Feb 2018 09:34:45 +0900 Message-Id: <1517877294-4826-6-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 I could not figure out why this pattern should be ignored. Checking commit 1e65174a3378 ("Add some basic .gitignore files") did not help. Let's remove this pattern, then see if it is really needed. Signed-off-by: Masahiro Yamada --- scripts/kconfig/.gitignore | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index 51f1c87..a76856e 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore @@ -1,7 +1,6 @@ # # Generated files # -config* *.lex.c *.tab.c *.tab.h From patchwork Tue Feb 6 00:34:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126931 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441190ljc; Mon, 5 Feb 2018 16:38:46 -0800 (PST) X-Google-Smtp-Source: AH8x224QVTHWZAmJHmiD2ox7AelglVUg2Z9nU+UFQ213dYyN9lZ/U1t6GCjzqo53jsWBw+Spnkx9 X-Received: by 10.98.63.15 with SMTP id m15mr551539pfa.221.1517877525976; Mon, 05 Feb 2018 16:38:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877525; cv=none; d=google.com; s=arc-20160816; b=WanqFaEzzDvFXVdQDie9SZO/O2eOj/b98rURy/CeECQYrxGVEyJ1catL03Y/6HK9Wa UkYNDajdmBnbCjFi7dzmr+J5MBscp7vftuW/EV8pEZUHJId3fVk7PiH3bXUVESyUeu7g v88rwDqoBjLDDWRl+v+cZUh8aAz61NDfV0aLGnXpmD1hM9c2wqOxWlgLyIh+H5fiYkbN HSHjA0YE+4kDdy3q3MEG69WsDDqDNMXsIJugdiIl/7ots8RZYP5i6sAgVUTKsWtjgaZI SRmsQBVBGIbuO22oqlfKcFz4zlTVcklDi3vE6rZobQaCgh5yDVs6snhPxibwORsnC3Lw yWuw== 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=Noha0QiW63Ao007jCcFxnie6IMNyESx6eW/jUS2GKCc=; b=a0UA5TUGof2fSP+DMrbl6IJc+zYXoQyrAYIFEYtXg4QH5cBOG7RIWvzHf9AGGs8qMo 00GMjg3vhCDCEg72qd2h3503hc0yCD7nqzB+D3iJCT/MbpIDC5J4WOZR9cf4lyLQdaZK 9OAJZSHkJAJA8oPrxfMQJIkd0cM/UymCp9YkEeunN78kVGuFcSlG4+6mbIr/s4DxQC9E DtF8Pqy8GZPem+BTPsRKeCQR4mDsHoAB1T0bd7+DyzvbQmiDRpuAxI8VEz69Fd0IUPlR SYv9Cw92YHZdDOMX/DwOcBrZEBnfqsuEavOqSF9AEjTof0VBD9k6LcVeXovQr2KHhpak 3OUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=YHWqHF4x; 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.45; Mon, 05 Feb 2018 16:38:45 -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=YHWqHF4x; 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 S1752537AbeBFAim (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:42 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40191 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752406AbeBFAiG (ORCPT ); Mon, 5 Feb 2018 19:38:06 -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 w160ZHAl011351; Tue, 6 Feb 2018 09:35:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAl011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877324; bh=Noha0QiW63Ao007jCcFxnie6IMNyESx6eW/jUS2GKCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YHWqHF4xnUzqKT76DKypbfh9q7SBI4Y+bMKt+sljXn/FBo9+05A0Z9nGhJB/nU1il cWAAsCJIBSaci8Asw+n4VxuC2zn1JSYjmdtV9XGWWABhTM6Pc0EU7+GGAaSmhgrXyX 6WY4CqWEVJ7OuzlteDSwD1SBRzdyCVSc9ey32B3Dz9Rjy2KBtq6ZrHwjTBIrLRnMZv sKe0GHR0tE2hRaShhXc7ctBKOHU8neL5GhX0SJUW+06ssM1gc64bwKjHt0yvbCEkwu Eu5fEBNriAnOhMNcu4APY3ku1LUEyhyO/rdY4BIad5tM96/sJwq8TquC1oNjG/Waxp nJBBJqa2IkWXA== 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 , Tony Luck , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu Subject: [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON Date: Tue, 6 Feb 2018 09:34:46 +0900 Message-Id: <1517877294-4826-7-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 The variable 'PYTHON' allows users to specify a proper executable name in case the default 'python' does not work. However, this does not address the case where both Python 2 and Python 3 scripts are used in one system. PEP 394 (https://www.python.org/dev/peps/pep-0394/) provides a convention for Python scripts portability. Here is a quotation: In order to tolerate differences across platforms, all new code that needs to invoke the Python interpreter should not specify 'python', but rather should specify either 'python2' or 'python3'. This distinction should be made in shebangs, when invoking from a shell script, when invoking via the system() call, or when invoking in any other context. arch/ia64/scripts/unwcheck.py is apparently written in Python 2, so it should be invoked by 'python2'. It is legitimate to use 'python' for scripts compatible with both Python 2 and Python 3, but this is rare (at least I do not see the case in kernel tree). You do not need to make efforts to write your scripts in that way. Anyway, Python 2 will retire in 2020. This commit is needed for my new scripts written in Python 3. Signed-off-by: Masahiro Yamada --- Makefile | 5 +++-- arch/ia64/Makefile | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 11aff0f..c4e935c 100644 --- a/Makefile +++ b/Makefile @@ -384,7 +384,8 @@ GENKSYMS = scripts/genksyms/genksyms INSTALLKERNEL := installkernel DEPMOD = /sbin/depmod PERL = perl -PYTHON = python +PYTHON2 = python2 +PYTHON3 = python3 CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ @@ -430,7 +431,7 @@ GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES -export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE +export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON2 PYTHON3 UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 2dd7f51..862a2ba 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile @@ -75,7 +75,7 @@ vmlinux.gz: vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ unwcheck: vmlinux - -$(Q)READELF=$(READELF) $(PYTHON) $(srctree)/arch/ia64/scripts/unwcheck.py $< + -$(Q)READELF=$(READELF) $(PYTHON2) $(srctree)/arch/ia64/scripts/unwcheck.py $< archclean: $(Q)$(MAKE) $(clean)=$(boot) From patchwork Tue Feb 6 00:34:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126933 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441420ljc; Mon, 5 Feb 2018 16:39:08 -0800 (PST) X-Google-Smtp-Source: AH8x2270bQzIRoQGrdqrCm0mxVEWGkm8rbUSci3ZlJlA/+sW4rnU0nkp0+1b83Jf9SM/bJjgQJl3 X-Received: by 2002:a17:902:bc85:: with SMTP id bb5-v6mr572239plb.425.1517877548691; Mon, 05 Feb 2018 16:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877548; cv=none; d=google.com; s=arc-20160816; b=CIgGjwkQ7RePeeo9Qq6iSjClegDsDCv3cvohieF68+eoR5wEuLb4J90c8i70CzQ7zO k0rAhHgNNjVbod6Oya0Ts2ty00ksoYM5g3j0/yO4bMGAgzR3Ge1XsNB2/nejjcUMQX3v iG6lpL8JXFO9dKhGX3pOG40saxRPWjJ6RlplqZS8ajDG64pXOKBFzv8Y7AQVze83eeYj XYcQkCsJ8hFltWKe2yqUk26TdsuM6eB8M8kcbkjCWqeRJ7Xjh8pKqg0XvgeZympsW0iL f79FIIgenVa43IrpayH00OVGdnqcJ9hTnFsEHoo8HDfcF1ZftYRx8QPnlU1BbOV6WAZC 0cvw== 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=ocbZK7hfg3zBpKhDY3y6OVphvGu4HXLex29szBW3HR0=; b=atO8lol0yLyUrmT8xWgxXbZhzd4aOzppfCe6YznyDVHepFio6+U1yxHVTf6UyE1IHs 5BCIqfP8Vvv9K+nsgZk0v4oejGK06Uyb23SgPwhlBFO1C9Xtcy7MFL3Bt6eqxm2EqL2G kmXM0YO6NWRig3U1KQI1PMXDQOuEMT6cZJZKfLv3EwCMqOK0CfoIuRgHutItgssrIAXT 9Kk38LXjo0bZ33yVq3vNdL06cAxB/YhQgkBC1PFbpulQ/RIjdzPO8IrW6tpCQKYc8mSg Tvb1pzQ2QEsENBPOCz7aADOB+/ECtmQq52Tvu4ABQUYcm0U08tS5T57X8NEp5dGEUal+ efJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=mX8c9sVz; 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 i72si295166pfe.310.2018.02.05.16.39.08; Mon, 05 Feb 2018 16:39:08 -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=mX8c9sVz; 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 S1752582AbeBFAjH (ORCPT + 21 others); Mon, 5 Feb 2018 19:39:07 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40952 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752507AbeBFAia (ORCPT ); Mon, 5 Feb 2018 19:38:30 -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 w160ZHAm011351; Tue, 6 Feb 2018 09:35:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAm011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877325; bh=ocbZK7hfg3zBpKhDY3y6OVphvGu4HXLex29szBW3HR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mX8c9sVzjM9V87pS1TfIZj+krgiDPi1SQsEp+yIhb0KmCfNLHyH1Np4925+B9hnRj 7slQ/vl92dpBvAeo5R7oavW/SvfbuAyp701U1B5X96uWF4tTurt6ZgEcVi4bIUoVTq LBsWWbrYkZHnNg41qAbsNZvWm5koBPPoNDpAbFyjKm+uAaCovH/EmudjPAwB/nyWtu V8wOo3NHUkNh9g5Qc96kgMNyEE1MNYpzV9HS4X7PrTJBCZRa+ox3lueQfr99l9hPUf 9Y3Mg6icwzZ0fGJ+EANZVLhzJOVOzhTv1jTdtBQCTKndVX6dedzfVPhiLbH1jGePrh RConCP+Fny0Uw== 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 , Borislav Petkov , linux-kernel@vger.kernel.org, Thomas Gleixner , Yaakov Selkowitz , Marc Herbert Subject: [PATCH 07/14] kconfig: test: add framework for Kconfig unit-tests Date: Tue, 6 Feb 2018 09:34:47 +0900 Message-Id: <1517877294-4826-8-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 I admit various parts in Kconfig are cryptic and need refactoring, but at the same time, I fear regressions. There are several subtle corner cases where it is difficult to notice breakage. It is time to add unit-tests. Here is a simple framework based on pytest. The conftest.py provides a fixture useful to run commands such as 'oldaskconfig' etc. and to compare the resulted .config, stdout, stderr with expectations. How to add test cases? ---------------------- For each test case, you should create a subdirectory under scripts/kconfig/tests/ (so test cases are seperated from each other). Every test case directory must contain the following files: - __init__.py: describes test functions - Kconfig: the top level Kconfig file for this test To do a useful job, test cases generally need additional data like input .config and information about expected results. How to run tests? ----------------- You need python3 and pytest. Then, run "make testconfig". O= option is supported. If V=1 is given, details logs during tests are displayed. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 8 ++ scripts/kconfig/tests/conftest.py | 255 ++++++++++++++++++++++++++++++++++++++ scripts/kconfig/tests/pytest.ini | 6 + 3 files changed, 269 insertions(+) create mode 100644 scripts/kconfig/tests/conftest.py create mode 100644 scripts/kconfig/tests/pytest.ini -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index cb3ec53..c5d1d1a 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -135,6 +135,14 @@ PHONY += tinyconfig tinyconfig: $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config +# CHECK: -o cache_dir= working? +PHONY += testconfig +testconfig: $(obj)/conf + $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ + -o cache_dir=$(abspath $(obj)/tests/.cache) \ + $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) +clean-dirs += tests/.cache + # Help text used by make help help: @echo ' config - Update current config utilising a line-oriented program' diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py new file mode 100644 index 0000000..f0f3237 --- /dev/null +++ b/scripts/kconfig/tests/conftest.py @@ -0,0 +1,255 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2018 Masahiro Yamada +# + +import os +import pytest +import shutil +import subprocess +import tempfile + +conf_path = os.path.abspath(os.path.join('scripts', 'kconfig', 'conf')) + +class Conf: + + def __init__(self, request): + """Create a new Conf object, which is a scripts/kconfig/conf + runner and result checker. + + Arguments: + request - object to introspect the requesting test module + """ + + # the directory of the test being run + self.test_dir = os.path.dirname(str(request.fspath)) + + def __run_conf(self, mode, dot_config=None, out_file='.config', + interactive=False, in_keys=None, extra_env={}): + """Run scripts/kconfig/conf + + mode: input mode option (--oldaskconfig, --defconfig= etc.) + dot_config: the .config file for input. + out_file: file name to contain the output config data. + interactive: flag to specify the interactive mode. + in_keys: key inputs for interactive modes. + extra_env: additional environment. + """ + + command = [conf_path, mode, 'Kconfig'] + + # Override 'srctree' environment to make the test as the top directory + extra_env['srctree'] = self.test_dir + + # scripts/kconfig/conf is run in a temporary directory. + # This directory is automatically removed when done. + with tempfile.TemporaryDirectory() as temp_dir: + + # if .config is given, copy it to the working directory + if dot_config: + shutil.copyfile(os.path.join(self.test_dir, dot_config), + os.path.join(temp_dir, '.config')) + + ps = subprocess.Popen(command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=temp_dir, + env=dict(os.environ, **extra_env)) + + # If user key input is specified, feed it into stdin. + if in_keys: + ps.stdin.write(in_keys.encode('utf-8')) + + while ps.poll() == None: + # For interactive modes such as 'make config', 'make oldconfig', + # send 'Enter' key until the program finishes. + if interactive: + ps.stdin.write(b'\n') + + self.retcode = ps.returncode + self.stdout = ps.stdout.read().decode() + self.stderr = ps.stderr.read().decode() + + # Retrieve the resulted config data only when .config is supposed + # to exist. If the command fails, the .config does not exist. + # 'make listnewconfig' does not produce .config in the first place. + if self.retcode == 0 and out_file: + with open(os.path.join(temp_dir, out_file)) as f: + self.config = f.read() + else: + self.config = None + + # Logging: + # Pytest captures the following information by default. In failure + # of tests, the captured log will be displayed. This will be useful to + # figure out what has happened. + + print("command: {}\n".format(' '.join(command))) + print("retcode: {}\n".format(self.retcode)) + + if dot_config: + print("input .config:".format(dot_config)) + + print("stdout:") + print(self.stdout) + print("stderr:") + print(self.stderr) + + if self.config is not None: + print("output of {}:".format(out_file)) + print(self.config) + + return self.retcode + + def oldaskconfig(self, dot_config=None, in_keys=None): + """Run oldaskconfig (make config) + + dot_config: the .config file for input (optional). + in_key: key inputs (optional). + """ + return self.__run_conf('--oldaskconfig', dot_config=dot_config, + interactive=True, in_keys=in_keys) + + def oldconfig(self, dot_config=None, in_keys=None): + """Run oldconfig + + dot_config: the .config file for input (optional). + in_key: key inputs (optional). + """ + return self.__run_conf('--oldconfig', dot_config=dot_config, + interactive=True, in_keys=in_keys) + + def defconfig(self, defconfig): + """Run defconfig + + defconfig: the defconfig file for input. + """ + defconfig_path = os.path.join(self.test_dir, defconfig) + return self.__run_conf('--defconfig={}'.format(defconfig_path)) + + def olddefconfig(self, dot_config=None): + """Run olddefconfig + + dot_config: the .config file for input (optional). + """ + return self.__run_conf('--olddefconfig', dot_config=dot_config) + + def __allconfig(self, foo, all_config): + """Run all*config + + all_config: fragment config file for KCONFIG_ALLCONFIG (optional). + """ + if all_config: + all_config_path = os.path.join(self.test_dir, all_config) + extra_env = {'KCONFIG_ALLCONFIG': all_config_path} + else: + extra_env = {} + + return self.__run_conf('--all{}config'.format(foo), extra_env=extra_env) + + def allyesconfig(self, all_config=None): + """Run allyesconfig + """ + return self.__allconfig('yes', all_config) + + def allmodconfig(self, all_config=None): + """Run allmodconfig + """ + return self.__allconfig('mod', all_config) + + def allnoconfig(self, all_config=None): + """Run allnoconfig + """ + return self.__allconfig('no', all_config) + + def alldefconfig(self, all_config=None): + """Run alldefconfig + """ + return self.__allconfig('def', all_config) + + def savedefconfig(self, dot_config): + """Run savedefconfig + """ + return self.__run_conf('--savedefconfig', out_file='defconfig') + + def listnewconfig(self, dot_config=None): + """Run listnewconfig + """ + return self.__run_conf('--listnewconfig', dot_config=dot_config, + out_file=None) + + # checkers + def __read_and_compare(self, compare, expected): + """Compare the result with expectation. + + Arguments: + compare: function to compare the result with expectation + expected: file that contains the expected data + """ + with open(os.path.join(self.test_dir, expected)) as f: + expected_data = f.read() + print(expected_data) + return compare(self, expected_data) + + def __contains(self, attr, expected): + print("{0} is expected to contain '{1}':".format(attr, expected)) + return self.__read_and_compare(lambda s, e: getattr(s, attr).find(e) >= 0, + expected) + + def __matches(self, attr, expected): + print("{0} is expected to match '{1}':".format(attr, expected)) + return self.__read_and_compare(lambda s, e: getattr(s, attr) == e, + expected) + + def config_contains(self, expected): + """Check if resulted configuration contains expected data. + + Arguments: + expected: file that contains the expected data. + """ + return self.__contains('config', expected) + + def config_matches(self, expected): + """Check if resulted configuration exactly matches expected data. + + Arguments: + expected: file that contains the expected data. + """ + return self.__matches('config', expected) + + def stdout_contains(self, expected): + """Check if resulted stdout contains expected data. + + Arguments: + expected: file that contains the expected data. + """ + return self.__contains('stdout', expected) + + def stdout_matches(self, cmp_file): + """Check if resulted stdout exactly matches expected data. + + Arguments: + expected: file that contains the expected data. + """ + return self.__matches('stdout', expected) + + def stderr_contains(self, expected): + """Check if resulted stderr contains expected data. + + Arguments: + expected: file that contains the expected data. + """ + return self.__contains('stderr', expected) + + def stderr_matches(self, cmp_file): + """Check if resulted stderr exactly matches expected data. + + Arguments: + expected: file that contains the expected data. + """ + return self.__matches('stderr', expected) + +@pytest.fixture(scope="module") +def conf(request): + return Conf(request) diff --git a/scripts/kconfig/tests/pytest.ini b/scripts/kconfig/tests/pytest.ini new file mode 100644 index 0000000..07b94e0 --- /dev/null +++ b/scripts/kconfig/tests/pytest.ini @@ -0,0 +1,6 @@ +[pytest] +addopts = --verbose +# Pytest requires that test files have unique names, because pytest imports +# them as top-level modules. It is silly to prefix or suffix a test file with +# the directory name that contains it. Use __init__.py for all test files. +python_files = __init__.py From patchwork Tue Feb 6 00:34:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126941 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2442373ljc; Mon, 5 Feb 2018 16:40:48 -0800 (PST) X-Google-Smtp-Source: AH8x224q7bXZENfzOEfqljk5aAKyjtwki194n7lmMEWt8vRn8SsbXKvxmf0rxUvDClx5R6PZYNv+ X-Received: by 2002:a17:902:a612:: with SMTP id u18-v6mr588554plq.129.1517877648749; Mon, 05 Feb 2018 16:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877648; cv=none; d=google.com; s=arc-20160816; b=DqkXSbdtnTxcGg92WKWJUQ84CtGCSP9PoiiLRindUbxfoNZD1D1PlhshHbRbW0GX6P r1cjQW4mXtc6R/OHVeUU0sPed4G7eMrYU3R5XE1YK3qLfJUkDtQWcHTXg2ppIBzxjfVg MtLelnxFEq06slL88afLr+fW+pgwNnJEUEXtu0Zd0a79ZvZ0cBQp244h7tOT0LrefRqQ ncgsOwQLQCySzsIYwafEnmFJ5zzpA/9ynpWcDbJvfK6TYYKV+smqkZaCNiap1h3gH8F5 OIlZxRAk2eSbLWAKDOg4Dleqa+x+EnJ+m7Mgafq6kumZuDCKlKd2D0HMc4eMgjSGWKdp i6SQ== 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=YfS+uMzbjxqGOtPrlZt5FSJaqfha9h1IgjnvvpHbUwo=; b=k2tzLWh3P9QLkkGqrxc5jmRRONuaSidzl9E2EQiD0GYbu/NJbHrrq3u2yAgMxkgmGh 8ROZfiY/bvXLyBKdo3c6/ftScbSre6xlTkjWv1d6H7O4mSmrvXS5obBC8bPRZ24vBjVl 6ODRYARcE0oT01xNGP3oQGYWoPDYX9RY7j8tSL9XdqzTBCq7StWW/rJ2pRTUz3RNidQ8 tPYKpDnXBcbFwPIseC05iPGQiv8s+8jYpkCsn/tkEWzDmpaQt38OJe8n3TRR+nV6FAHI jj1UmarNCSNKiHe+nvRZZ0nXPI0U9bkiqGLq++tbh2pwwOZ+TzpUAd8fhPQIiUUIzlgd gDog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Iqw4E5Vb; 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 x63si709625pfk.335.2018.02.05.16.40.48; Mon, 05 Feb 2018 16:40:48 -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=Iqw4E5Vb; 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 S1752731AbeBFAkq (ORCPT + 21 others); Mon, 5 Feb 2018 19:40:46 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39798 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752264AbeBFAh4 (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 w160ZHAn011351; Tue, 6 Feb 2018 09:35:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAn011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877326; bh=YfS+uMzbjxqGOtPrlZt5FSJaqfha9h1IgjnvvpHbUwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iqw4E5VbOs99Ew8Wb4eISijVSlkl29Ay73wVV8X0XCatjZC//4TKh16jS47EGnY+S DMLo/vVk7NJ2yIPA7Foa7VSM3RBaTdr+eo2XX5kcwanKikOJqM0UHR+2mhAI8vGQFy Ho1e/JTYU0cciDYJieKJOahOJSrSJh/r5NAGOvqY3rxLfdfdoOUD7/j5xwifITdx3G amnaVPjcuTQgqsD2sAD5sjzVQ6QkkqVg8PbnrMLDoPhC3sM4QTaacfV5XMV2FQLW3V Qzy2chbyYV8lepERI+IkhFblQPK+WLm7QxjQb5FA9yn6FOuDiWyEa+BhoEzzqFcxL8 QwOqgpcl3gZ+w== 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 08/14] kconfig: test: add basic 'choice' tests Date: Tue, 6 Feb 2018 09:34:48 +0900 Message-Id: <1517877294-4826-9-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 The calculation of 'choice' is a bit complicated part in Kconfig. The behavior of 'y' choice is intuitive. If choice values are tristate, the choice can be 'm' where each value can be enabled independently. Also, if a choice is marked as 'optional', the whole choice can be invisible. Test basic functionality of choice. Signed-off-by: Masahiro Yamada --- scripts/kconfig/tests/choice/Kconfig | 54 ++++++++++++++++++++++ scripts/kconfig/tests/choice/__init__.py | 37 +++++++++++++++ .../kconfig/tests/choice/alldef_expected_config | 5 ++ .../kconfig/tests/choice/allmod_expected_config | 9 ++++ scripts/kconfig/tests/choice/allno_expected_config | 5 ++ .../kconfig/tests/choice/allyes_expected_config | 9 ++++ .../kconfig/tests/choice/oldask0_expected_stdout | 10 ++++ scripts/kconfig/tests/choice/oldask1_config | 2 + .../kconfig/tests/choice/oldask1_expected_stdout | 15 ++++++ 9 files changed, 146 insertions(+) create mode 100644 scripts/kconfig/tests/choice/Kconfig create mode 100644 scripts/kconfig/tests/choice/__init__.py create mode 100644 scripts/kconfig/tests/choice/alldef_expected_config create mode 100644 scripts/kconfig/tests/choice/allmod_expected_config create mode 100644 scripts/kconfig/tests/choice/allno_expected_config create mode 100644 scripts/kconfig/tests/choice/allyes_expected_config create mode 100644 scripts/kconfig/tests/choice/oldask0_expected_stdout create mode 100644 scripts/kconfig/tests/choice/oldask1_config create mode 100644 scripts/kconfig/tests/choice/oldask1_expected_stdout -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/tests/choice/Kconfig b/scripts/kconfig/tests/choice/Kconfig new file mode 100644 index 0000000..cc60e9c --- /dev/null +++ b/scripts/kconfig/tests/choice/Kconfig @@ -0,0 +1,54 @@ +config MODULES + bool "Enable loadable module support" + option modules + default y + +choice + prompt "boolean choice" + default BOOL_CHOICE1 + +config BOOL_CHOICE0 + bool "choice 0" + +config BOOL_CHOICE1 + bool "choice 1" + +endchoice + +choice + prompt "optional boolean choice" + optional + default OPT_BOOL_CHOICE1 + +config OPT_BOOL_CHOICE0 + bool "choice 0" + +config OPT_BOOL_CHOICE1 + bool "choice 1" + +endchoice + +choice + prompt "tristate choice" + default TRI_CHOICE1 + +config TRI_CHOICE0 + tristate "choice 0" + +config TRI_CHOICE1 + tristate "choice 1" + +endchoice + +choice + prompt "optional tristate choice" + optional + default OPT_TRI_CHOICE1 + +config OPT_TRI_CHOICE0 + tristate "choice 0" + +config OPT_TRI_CHOICE1 + tristate "choice 1" + +endchoice diff --git a/scripts/kconfig/tests/choice/__init__.py b/scripts/kconfig/tests/choice/__init__.py new file mode 100644 index 0000000..42022ac --- /dev/null +++ b/scripts/kconfig/tests/choice/__init__.py @@ -0,0 +1,37 @@ +""" +Basic choice tests +================== + +The handling of 'choice' is a bit complicated part in Kconfig. + +The behavior of 'y' choice is intuitive. If choice values are tristate, +the choice can be 'm' where each value can be enabled independently. +Also, if a choice is marked as 'optional', the whole choice can be +invisible. + +Test basic functionality of choice. +""" + +def test_oldask0(conf): + assert conf.oldaskconfig() == 0 + assert conf.stdout_contains('oldask0_expected_stdout') + +def test_oldask1(conf): + assert conf.oldaskconfig('oldask1_config') == 0 + assert conf.stdout_contains('oldask1_expected_stdout') + +def test_allyes(conf): + assert conf.allyesconfig() == 0 + assert conf.config_contains('allyes_expected_config') + +def test_allmod(conf): + assert conf.allmodconfig() == 0 + assert conf.config_contains('allmod_expected_config') + +def test_allno(conf): + assert conf.allnoconfig() == 0 + assert conf.config_contains('allno_expected_config') + +def test_alldef(conf): + assert conf.alldefconfig() == 0 + assert conf.config_contains('alldef_expected_config') diff --git a/scripts/kconfig/tests/choice/alldef_expected_config b/scripts/kconfig/tests/choice/alldef_expected_config new file mode 100644 index 0000000..7a754bf --- /dev/null +++ b/scripts/kconfig/tests/choice/alldef_expected_config @@ -0,0 +1,5 @@ +CONFIG_MODULES=y +# CONFIG_BOOL_CHOICE0 is not set +CONFIG_BOOL_CHOICE1=y +# CONFIG_TRI_CHOICE0 is not set +# CONFIG_TRI_CHOICE1 is not set diff --git a/scripts/kconfig/tests/choice/allmod_expected_config b/scripts/kconfig/tests/choice/allmod_expected_config new file mode 100644 index 0000000..f1f5dcd --- /dev/null +++ b/scripts/kconfig/tests/choice/allmod_expected_config @@ -0,0 +1,9 @@ +CONFIG_MODULES=y +# CONFIG_BOOL_CHOICE0 is not set +CONFIG_BOOL_CHOICE1=y +# CONFIG_OPT_BOOL_CHOICE0 is not set +CONFIG_OPT_BOOL_CHOICE1=y +CONFIG_TRI_CHOICE0=m +CONFIG_TRI_CHOICE1=m +CONFIG_OPT_TRI_CHOICE0=m +CONFIG_OPT_TRI_CHOICE1=m diff --git a/scripts/kconfig/tests/choice/allno_expected_config b/scripts/kconfig/tests/choice/allno_expected_config new file mode 100644 index 0000000..b88ee7a --- /dev/null +++ b/scripts/kconfig/tests/choice/allno_expected_config @@ -0,0 +1,5 @@ +# CONFIG_MODULES is not set +# CONFIG_BOOL_CHOICE0 is not set +CONFIG_BOOL_CHOICE1=y +# CONFIG_TRI_CHOICE0 is not set +CONFIG_TRI_CHOICE1=y diff --git a/scripts/kconfig/tests/choice/allyes_expected_config b/scripts/kconfig/tests/choice/allyes_expected_config new file mode 100644 index 0000000..e5a062a --- /dev/null +++ b/scripts/kconfig/tests/choice/allyes_expected_config @@ -0,0 +1,9 @@ +CONFIG_MODULES=y +# CONFIG_BOOL_CHOICE0 is not set +CONFIG_BOOL_CHOICE1=y +# CONFIG_OPT_BOOL_CHOICE0 is not set +CONFIG_OPT_BOOL_CHOICE1=y +# CONFIG_TRI_CHOICE0 is not set +CONFIG_TRI_CHOICE1=y +# CONFIG_OPT_TRI_CHOICE0 is not set +CONFIG_OPT_TRI_CHOICE1=y diff --git a/scripts/kconfig/tests/choice/oldask0_expected_stdout b/scripts/kconfig/tests/choice/oldask0_expected_stdout new file mode 100644 index 0000000..b251bba --- /dev/null +++ b/scripts/kconfig/tests/choice/oldask0_expected_stdout @@ -0,0 +1,10 @@ +Enable loadable module support (MODULES) [Y/n/?] (NEW) +boolean choice + 1. choice 0 (BOOL_CHOICE0) (NEW) +> 2. choice 1 (BOOL_CHOICE1) (NEW) +choice[1-2?]: +optional boolean choice [N/y/?] (NEW) +tristate choice [M/y/?] (NEW) + choice 0 (TRI_CHOICE0) [N/m/?] (NEW) + choice 1 (TRI_CHOICE1) [N/m/?] (NEW) +optional tristate choice [N/m/y/?] (NEW) diff --git a/scripts/kconfig/tests/choice/oldask1_config b/scripts/kconfig/tests/choice/oldask1_config new file mode 100644 index 0000000..b67bfe3 --- /dev/null +++ b/scripts/kconfig/tests/choice/oldask1_config @@ -0,0 +1,2 @@ +# CONFIG_MODULES is not set +CONFIG_OPT_BOOL_CHOICE0=y diff --git a/scripts/kconfig/tests/choice/oldask1_expected_stdout b/scripts/kconfig/tests/choice/oldask1_expected_stdout new file mode 100644 index 0000000..c2125e9b --- /dev/null +++ b/scripts/kconfig/tests/choice/oldask1_expected_stdout @@ -0,0 +1,15 @@ +Enable loadable module support (MODULES) [N/y/?] +boolean choice + 1. choice 0 (BOOL_CHOICE0) (NEW) +> 2. choice 1 (BOOL_CHOICE1) (NEW) +choice[1-2?]: +optional boolean choice [Y/n/?] (NEW) +optional boolean choice +> 1. choice 0 (OPT_BOOL_CHOICE0) + 2. choice 1 (OPT_BOOL_CHOICE1) (NEW) +choice[1-2?]: +tristate choice + 1. choice 0 (TRI_CHOICE0) (NEW) +> 2. choice 1 (TRI_CHOICE1) (NEW) +choice[1-2?]: +optional tristate choice [N/y/?] From patchwork Tue Feb 6 00:34:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126932 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441323ljc; Mon, 5 Feb 2018 16:38:59 -0800 (PST) X-Google-Smtp-Source: AH8x224Abo1gD0ia96+iNEK9ULk2oosDMLXaWOwBUn0MXVEtUUp/4fSz0W4lPfipmIYfQ0ZE2Z8s X-Received: by 2002:a17:902:b610:: with SMTP id b16-v6mr593152pls.132.1517877538859; Mon, 05 Feb 2018 16:38:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877538; cv=none; d=google.com; s=arc-20160816; b=xj6qynldOvwsQgK1StBqiVd+dvxKr8Pk5wwDmfY31VIXf2vdDh3R2+tZlK9w1J/WIN /uqxR/3N2fFHwuutiZeSGAC96YhY++mQYmkbiNDxaDlVVfbsTRZWoiN1/znyPp7PJnIG WGzm98KXVNYXEfmqfX4M2DVISsUWWL6iOQE37eIlp5HjFiFN+NsHEpaFRYe3ETNdurhs PT4LcV6qUtGXHTKGdlRJkhMMDTDMg7+Tc6klIDSjp9lO9HrR7Ie2+DmK1Ge8Ts32g52/ pBHZncs7ULzNcn/rm3w6gNI8CK9yFC2OoEpO/TSjt9abnrXkJmW1vL82X8rj2raR+Zyi IV7A== 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=0tMiHBIy1G322QUF9DUnzHnXWHn+vjfiFlPgF9g/e+U=; b=D8sxuzajAkysP05xOdaLVYCRPm2+w1I5ubKLI3EmaUZhF3NlVCzqJMcTsCYvv+X8bA zRwvbOAHCREc67oXGJV5UxBv8fKRUfd8zdHoe58mgaD8hVy0nBwLK4gAVBpG8+Znjiqe wp/GGlriUJuIlz8Zn87Ogs5R3NGwm1isLBw/aPXcxNYNRFl4yq5WW0CjpUd3COb/Q9uE K2Rl7A9Y53lFzuaNjwj2BLdhJo+LoSZn+iWg8XMYGGHJ+RA7tG3P+J6nvScPt6CsxbSZ FSRLZ161U/yGF8UMTpnCv8kSWAtGvw70O2+ENBZEVi75ppI8YQqh4Ek4aoxGARBAUVAR ykow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uji2Pv9h; 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 i72si295166pfe.310.2018.02.05.16.38.55; Mon, 05 Feb 2018 16:38:58 -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=uji2Pv9h; 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 S1752559AbeBFAix (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:53 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40090 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbeBFAiE (ORCPT ); Mon, 5 Feb 2018 19:38:04 -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 w160ZHAo011351; Tue, 6 Feb 2018 09:35:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAo011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877327; bh=0tMiHBIy1G322QUF9DUnzHnXWHn+vjfiFlPgF9g/e+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uji2Pv9hoECqRM6OmVkkTGcjYE0DF66I3wnfecxYv8faSbsg6kDHGdFxal1vZOp9i Dw5ZAgD7GyvIXqQ/lWMQ1sni4M/XCskFWIPnX8/jWkWqaSmk0nQ+HjYBngUvS/s94V e3jwbIwJ/cQYuxnklA4+Lo8jLxwxkL60WApGdlPiTCPBFaJG5Zv7z1OnjRIyobWdGn R54F0ZA3Fpzgy5ByEg6ki10DTfVUbfd13HVPLwfJEQELiWVl4NYzFnLeJ61uRzsKLe aeMATFf4JIhtf0sI2qzyZWyWp9FAWay28uZ5VTJeZ1GriFe++uEcA/395+45UN05Qa cJGIjb6bjgZaw== 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 09/14] kconfig: test: test automatic submenu creation Date: Tue, 6 Feb 2018 09:34:49 +0900 Message-Id: <1517877294-4826-10-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 a symbols has dependency on the preceding symbol, the menu entry should become the submenu of the preceding one, and displayed with deeper indentation. This is done by restructuring the menu tree in menu_finalize(). It is a bit complicated computation, so let's add a test case. Signed-off-by: Masahiro Yamada --- .../kconfig/tests/auto_submenu_creation/Kconfig | 50 ++++++++++++++++++++++ .../tests/auto_submenu_creation/__init__.py | 12 ++++++ .../tests/auto_submenu_creation/expected_stdout | 10 +++++ 3 files changed, 72 insertions(+) create mode 100644 scripts/kconfig/tests/auto_submenu_creation/Kconfig create mode 100644 scripts/kconfig/tests/auto_submenu_creation/__init__.py create mode 100644 scripts/kconfig/tests/auto_submenu_creation/expected_stdout -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/tests/auto_submenu_creation/Kconfig b/scripts/kconfig/tests/auto_submenu_creation/Kconfig new file mode 100644 index 0000000..9e11502 --- /dev/null +++ b/scripts/kconfig/tests/auto_submenu_creation/Kconfig @@ -0,0 +1,50 @@ +config A + bool "A" + default y + +config A0 + bool "A0" + depends on A + default y + help + This depends on A, so should be a submenu of A. + +config A0_0 + bool "A1_0" + depends on A0 + help + Submenus are created recursively. + This should be a submenu of A0. + +config A1 + bool "A1" + depends on A + default y + help + This should line up with A0. + +choice + prompt "choice" + depends on A1 + help + Choice should become a submenu as well. + +config A1_0 + bool "A1_0" + +config A1_1 + bool "A1_1" + +endchoice + +config B + bool "B" + help + This is independent of A. + +config C + bool "C" + depends on A + help + This depends on A, but not a consecutive item, so should not + be a submenu. diff --git a/scripts/kconfig/tests/auto_submenu_creation/__init__.py b/scripts/kconfig/tests/auto_submenu_creation/__init__.py new file mode 100644 index 0000000..dda866d --- /dev/null +++ b/scripts/kconfig/tests/auto_submenu_creation/__init__.py @@ -0,0 +1,12 @@ +""" +Create submenu for symbols that depend on the preceding one +=========================================================== + +If a symbols has dependency on the preceding symbol, the menu entry +should become the submenu of the preceding one, and displayed with +deeper indentation. +""" + +def test(conf): + assert conf.oldaskconfig() == 0 + assert conf.stdout_contains('expected_stdout') diff --git a/scripts/kconfig/tests/auto_submenu_creation/expected_stdout b/scripts/kconfig/tests/auto_submenu_creation/expected_stdout new file mode 100644 index 0000000..bf5236f --- /dev/null +++ b/scripts/kconfig/tests/auto_submenu_creation/expected_stdout @@ -0,0 +1,10 @@ +A (A) [Y/n/?] (NEW) + A0 (A0) [Y/n/?] (NEW) + A1_0 (A0_0) [N/y/?] (NEW) + A1 (A1) [Y/n/?] (NEW) + choice + > 1. A1_0 (A1_0) (NEW) + 2. A1_1 (A1_1) (NEW) + choice[1-2?]: +B (B) [N/y/?] (NEW) +C (C) [N/y/?] (NEW) From patchwork Tue Feb 6 00:34:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126940 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2442262ljc; Mon, 5 Feb 2018 16:40:37 -0800 (PST) X-Google-Smtp-Source: AH8x224V5KXIV0v37PtlWDRmPdnntcxP03aSXUK1X2ZCEaxbu0GgpNHnrfUb6Xg7AxGhen+bBxYG X-Received: by 10.99.116.23 with SMTP id p23mr481047pgc.16.1517877637310; Mon, 05 Feb 2018 16:40:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877637; cv=none; d=google.com; s=arc-20160816; b=JxYXsKcFerflzn6uxaPi2y3V4455N5/nKsVVVfUuPlqGt/SOqo3iDozbgEDJTIeKE0 x9uEya96udWz7A9v1LOLeDMkOYvV47R8XZbLIB3/vX6ZSQmsmYkjRxMLPjH12a1pb1lR cmarVQMcZy/wVWXUKyyYYghWehZVOR4KSuNMKJ1rloDxejJGmIgJBwRq9gikzGv0Ttpy bexJ+4cHLQzBEMTD0vhLyqFMeK5JGmYxIDhyPmfUS2WMrY46ajSa8rlvZe+rV1Sr00Ds JewNaaRlJqZcfj0tq1LDqbUpUI+pTllItgRxrT8xd4Kw7BlOUjEHU+In4lHxpSJQj7yy P+NQ== 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=UyG2oZNDTZKIRYq2fA34r4g+n0Fl50xMf4w/++5QxVI=; b=vrCdo+INa3gppsK0QAaT5XpGXFVXcjJp1e6Od1X/64ErmjwlTByvxt1iOlGquM+UBt DlbOltCsIgj6JObR3V9mrf/VbB9gMPaEDt6YT0LFmgwPdkrO4+DTJ7KQozcm3q2Xc78/ EIT/pIDkQIvSqb+3WXKrjo3b34cPuReh6ULju1G9ztchkSlvjBR9U1oOM80igI5cFGO7 Fl0XRnGPpb3ySTnSSbMEq21PbxvPqRwA59CMKUjd7N0rE2l5eqs6/ObuUWpCUf+L7Mow 8wLT3Dz4YECDaD0yH0W+YS1lttQsUD1BoedxZZeTVa/PeZhzwd9lFjFQVP42RDlAV3lR ZCxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=QXlow55/; 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 x63si709625pfk.335.2018.02.05.16.40.37; Mon, 05 Feb 2018 16:40:37 -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=QXlow55/; 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 S1752461AbeBFAke (ORCPT + 21 others); Mon, 5 Feb 2018 19:40:34 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39806 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbeBFAh4 (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 w160ZHAp011351; Tue, 6 Feb 2018 09:35:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAp011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877328; bh=UyG2oZNDTZKIRYq2fA34r4g+n0Fl50xMf4w/++5QxVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QXlow55/bNU0SDwxYCUprS1pACwWPXzRoyk6MfmFMlv9yPn0EhQ76juEY4aL2aMlg xSAs2M6maSioMeHaFXl6yW2BqzQPIFxDS4ct4vwi2P9LZQTtBKmiUMKBlqhxaAlOOh aE4lgE57VStm0TQy97+EbDMhf3Rn0Sh7qFzSqjJtM0goU6mXQwA79kN3mSfvEA9JHY VHFsqnxjx/4mUNl+AsQRif0Y33Y5MDE+LSrB02NKE015JtBef7oKa5t1KEcig1A6aY N3btngXYAjiCSAIpexxfLis9tlrBP1sHXwJTJV+43Vz/SOYjzB8YzdB3KzbtAkgLx9 csbvBDmZkCoYg== 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 10/14] kconfig: test: check if new symbols in choice are asked Date: Tue, 6 Feb 2018 09:34:50 +0900 Message-Id: <1517877294-4826-11-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 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 --- 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 -- 2.7.4 Reviewed-by: Ulf Magnusson 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..4306ccf --- /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..358d5cf --- /dev/null +++ b/scripts/kconfig/tests/new_choice_with_dep/expected_stdout @@ -0,0 +1,10 @@ +A (A) [N/y/?] (NEW) + 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?]: From patchwork Tue Feb 6 00:34:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126928 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2440874ljc; Mon, 5 Feb 2018 16:38:09 -0800 (PST) X-Google-Smtp-Source: AH8x226s57Ndajav40arb818af66VfPaFOGiaGb1jjQoR7HwZQiQA5bMofr7dIXY3Djmg7ozYdGD X-Received: by 10.99.126.79 with SMTP id o15mr472678pgn.364.1517877489743; Mon, 05 Feb 2018 16:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877489; cv=none; d=google.com; s=arc-20160816; b=GuEs+bhyxzCZZVzjPsf+9eb6VqH6whIn55BZswtZmtSj9f796BF+iZd99E7lp/vSc8 URtOkyLC7DHgSP2UPejIuBmBpXQyNXU0M+WxzUBWdV47tXcTsx4KD1vBdMBzi6zir72E Ju5/TvDRBPvMr2CP1doMAxZQ68nSpbSy1GZXFD42GBjg7xQVO1OKuUHd7JiKiQ1ahAyP IlckA8FAdKGUck6zfxLGNGvpvXc86s8UKdjUNdRgZwVf05PD8o5oToZbHlqvn7OGd6wA hh7nKR/wzdEYTvWdwhPByVpfvuJ6wqgyK9H4/Ybg2aSpTYT1RSLkzRUn1Yoe6WySDwSY kiQw== 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=XD7I3n5RiSKKYFJXgK1WrirTuPvIOYYcK1MRPL7S890=; b=sP5hjBYexiHFszOWvPfT4R5z5UFD4i+s9JbK/4iEFsmMQVclfvrTRJPsqPK2+F4aVq OsOkIeQbkooKRsgUaWrJbSs8/PIoCOY0/4s2a46YyALnmj8BR1txkX7jMLVj8lKTH3Al uK9/Inefahxk/pDrzv7zL29Ho7bk3cmFAGebvitt9zA0o8rkTWiCadNsgo66gFKWBNzD Yjwf+/aVcvMYZx/QO9zZ/kPQhI7PJSxmFAdz5JwzZ+b0/d31f+e40mIGeyiHHoSmAjBR bCTsjqKO3/pF+4be18LCWzzBmkl83MGqZJ20QX34CZodU1/di4poF+Gy/ORwpQmyS80z lxwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rktzfeeo; 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 a91-v6si181184pla.657.2018.02.05.16.38.09; Mon, 05 Feb 2018 16:38:09 -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=rktzfeeo; 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 S1752441AbeBFAiH (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:07 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39630 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbeBFAhv (ORCPT ); Mon, 5 Feb 2018 19:37:51 -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 w160ZHAq011351; Tue, 6 Feb 2018 09:35:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAq011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877329; bh=XD7I3n5RiSKKYFJXgK1WrirTuPvIOYYcK1MRPL7S890=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rktzfeeorRqsHGUlyjYNszxn3sfrkRZoPbAjhRBbK/UA/3WTbLUPIZcfHf2XD3tsm mRRp62uwjMhWIj2fwZZJ8toZaUoaqeOA2ahWTrpBya6MDAsG1npITZ/gVeKn1NBwan rG7fgKYqwwFJV3bPzzG3hsXqISPZa1zDB6w0eIuh3npPU3BDzarmRpsjCXdBh81bUb BJaqnIgsYOfLdr/BMzaHuN4HK/Nuo62az9pJrICOSuUVgbsznNnyQcb8zmmkNVzlIT DKxDi76YkvvPal+ZqtyUSvkyjrm5R6x77VB/G7BJjeXWO0q0AKCZh/7oxAkfXpWkdR 1uvdKVEiXOd+w== 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 11/14] kconfig: test: check .config sanity for choice values with unmet dep Date: Tue, 6 Feb 2018 09:34:51 +0900 Message-Id: <1517877294-4826-12-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 I fixed a problem where "# CONFIG_..." for choice values are wrongly written into the .config file when they are once visible, then become invisible later. Add a test for this subtle case. Signed-off-by: Masahiro Yamada --- scripts/kconfig/tests/no_write_if_dep_unmet/Kconfig | 14 ++++++++++++++ scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py | 17 +++++++++++++++++ scripts/kconfig/tests/no_write_if_dep_unmet/config | 1 + .../kconfig/tests/no_write_if_dep_unmet/expected_config | 5 +++++ 4 files changed, 37 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 Reviewed-by: Ulf Magnusson 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..d096622 --- /dev/null +++ b/scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py @@ -0,0 +1,17 @@ +""" +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. +""" + +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 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 From patchwork Tue Feb 6 00:34:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126939 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2442193ljc; Mon, 5 Feb 2018 16:40:30 -0800 (PST) X-Google-Smtp-Source: AH8x225qSOr4V/dKKQy0IGsC9DBq0oe1jyjGIjJmPTmyrBh3SdHPAcJ65aqTIfa4UCoR6aRCncYt X-Received: by 10.99.116.23 with SMTP id p23mr480842pgc.16.1517877630120; Mon, 05 Feb 2018 16:40:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877630; cv=none; d=google.com; s=arc-20160816; b=0z4cbRZ0MgQbRTXrGhOqY8AS1HCJncs7gtRZyGGR5GSRwGlh3siZ/lYAofypcYXFpz MW3e9KBQQOsKU640PKLRCUi/PITH/bWGIvdz0oF1F1Jkk/THwc7UHKz0ZKEXdP7N2Oqu SdJMizb0JqF14PrG18kdNgaSeWWUaRJzo3Oxej/GXgDb4nT1Q4KkdOBL8CZkKbIiCchZ 5NZnlgrwmD1M5Cu11PpeLhBaGCLWPuMcgMX2AWDO9NG9BhE+peO1Z4YltCmVeEEYoSmp xF/y066Vns0RC9fvpkn16acCUZrKZBT6Ay8WkVSZchoC+7CpczG1W1c4bjU5JTKuSIJi 6oPQ== 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=OgysUZNJJuQDhed5u2YwuFH43q8TTfIJ3GyWfIBQjIM=; b=EHp3rV0smpSztpxylJk6w/VBsdBEuLkibDzj28BzzYQsiDEPGqVT2AjYksp1/zEyrj U96fD5BY+uD2mX29O/Hgh4hEaMFowkNYf1hJSPlBG/PByd/TnInSd5tin2Lwffk4/3tZ jG2gFpLc+SjfEsT/eGOCuLVfpqnwzVABOthpyddLdkly5zP1IFgRx4fKp8487zMv7hny yF/I/Jn9Upx9debwOVsrBrr9xOgtqsEnqu105TfTZuBQWv26X0SqhBWwnzFvrZjxxGHb WIuFh+n3wLFXrFLDjrtiT/0R9DmMZ+6fCVu/+ojdIJRbs9qL36WfLy6luCQNyCQRKu1/ mWRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CMKz2JAQ; 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 x63si709625pfk.335.2018.02.05.16.40.29; Mon, 05 Feb 2018 16:40:30 -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=CMKz2JAQ; 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 S1752701AbeBFAk2 (ORCPT + 21 others); Mon, 5 Feb 2018 19:40:28 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39820 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbeBFAh5 (ORCPT ); Mon, 5 Feb 2018 19:37:57 -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 w160ZHAs011351; Tue, 6 Feb 2018 09:35:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAs011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877331; bh=OgysUZNJJuQDhed5u2YwuFH43q8TTfIJ3GyWfIBQjIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMKz2JAQ2Ozx+doQHEdyx6IFHHv9LFj7gas9guEE+byf4q1NLh1Y/JxkjeVtMlGI3 v6PC3DrnMgELTbcU4c2BuB0jJ3/lQX+uJFUnK6DMrhFpsPEHpuLeN08YbKZasPd/3H luNx4vpp/f/V5qyjBE9rW0ktFurapRAGRyeZNm4VyJJv6Zc/QrfwNyoCnbKhospuUF 8qrPJScvG7s6ZUQbi2HH8fKsKTO7CeJSKmZMVGjm0hvxKJy+eta33UnbEWM7plz44W 9BO7hNtKfZ3UCfigNq3yGjJUgpMXTjN78po7orsOlVNeRpl8zD9api43quU7jRtALp IphZkH/vtF2tA== 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 13/14] kconfig: test: check if recursive dependencies are detected Date: Tue, 6 Feb 2018 09:34:53 +0900 Message-Id: <1517877294-4826-14-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 Recursive dependency should be detected and warned. Test this. Signed-off-by: Masahiro Yamada --- scripts/kconfig/tests/warn_recursive_dep/Kconfig | 62 ++++++++++++++++++++++ .../kconfig/tests/warn_recursive_dep/__init__.py | 10 ++++ .../tests/warn_recursive_dep/expected_stderr | 33 ++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 scripts/kconfig/tests/warn_recursive_dep/Kconfig create mode 100644 scripts/kconfig/tests/warn_recursive_dep/__init__.py create mode 100644 scripts/kconfig/tests/warn_recursive_dep/expected_stderr -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/warn_recursive_dep/Kconfig new file mode 100644 index 0000000..9ab2474 --- /dev/null +++ b/scripts/kconfig/tests/warn_recursive_dep/Kconfig @@ -0,0 +1,62 @@ +# depends on itself + +config A + bool "A" + depends on A + +# select itself + +config B + bool + select B + +# depends on each other + +config C1 + bool "C1 + depends on C2 + +config C2 + bool "C2" + depends on C1 + +# depends on and select + +config D1 + bool "D1" + depends on D2 + select D2 + +config D2 + bool + +# depends on and imply +# This is not recursive dependency + +config E1 + bool "E1" + depends on E2 + imply E2 + +config E2 + bool "E2" + +# property + +config F1 + bool "F1" + default F2 + +config F2 + bool "F2" + depends on F1 + +# menu + +menu "menu depending on its content" + depends on G + +config G + bool "G" + +endmenu diff --git a/scripts/kconfig/tests/warn_recursive_dep/__init__.py b/scripts/kconfig/tests/warn_recursive_dep/__init__.py new file mode 100644 index 0000000..cdf2c13 --- /dev/null +++ b/scripts/kconfig/tests/warn_recursive_dep/__init__.py @@ -0,0 +1,10 @@ +""" +Warn recursive inclusion +======================== + +Recursive dependency should be warned. +""" + +def test(conf): + assert conf.oldaskconfig() == 0 + assert conf.stderr_contains('expected_stderr') diff --git a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr new file mode 100644 index 0000000..ea47cae --- /dev/null +++ b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr @@ -0,0 +1,33 @@ +Kconfig:16:warning: multi-line strings not supported +Kconfig:9:error: recursive dependency detected! +Kconfig:9: symbol B is selected by B +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:3:error: recursive dependency detected! +Kconfig:3: symbol A depends on A +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:15:error: recursive dependency detected! +Kconfig:15: symbol C1 depends on C2 +Kconfig:19: symbol C2 depends on C1 +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:30:error: recursive dependency detected! +Kconfig:30: symbol D2 is selected by D1 +Kconfig:25: symbol D1 depends on D2 +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:59:error: recursive dependency detected! +Kconfig:59: symbol G depends on G +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" + +Kconfig:50:error: recursive dependency detected! +Kconfig:50: symbol F2 depends on F1 +Kconfig:48: symbol F1 default value contains F2 +For a resolution refer to Documentation/kbuild/kconfig-language.txt +subsection "Kconfig recursive dependency limitations" From patchwork Tue Feb 6 00:34:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126938 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2442149ljc; Mon, 5 Feb 2018 16:40:25 -0800 (PST) X-Google-Smtp-Source: AH8x2258+9bPjyIJpx/KIyQU7Z+HpNrF2GsojmpcgqeZnAhmwlWHzJqjU2w2m/1mH51GedDPgsmw X-Received: by 10.98.10.25 with SMTP id s25mr569226pfi.137.1517877625098; Mon, 05 Feb 2018 16:40:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877625; cv=none; d=google.com; s=arc-20160816; b=VRJe2RvwCttRTBemqx7uVKRhk7J6hpYYvkd1oJNOiMvE5REYJc0yYhioYNOCpqdhG4 VvjkOOsuAG+y6RaaAxjbwAqQm3lnNXr45eCD1brXnGXBAVzBj4VXqwSgzK6U8ISMyXsY QA5SNO59OkTha19Kx+SKaPfl6mf1+zRm0JWVD+QykYZiBSrKTPA8theSSfzRuh2HWtFo 7zrpSGqBhl3VhgWPVjNErYXQtZIzY9Y4OiUScPqe3wogXeMxk6ziXDZt4fk/OisQoWm0 LfJl4TS6sldYnUP6fvqAZfd+QesdTp6Ul1ONJ6b96839y02syFDI13myICg0mflamPbo rO2Q== 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=e+bBRzoO0V5YQsvcXSf66n+mUtbbyoF3YBYC04GSbmY=; b=WeIly4jfMSJsQhTVYtP/SQcSlDiUWhgGJEEv0jAUXMNfbswY06He4vc9/wIwUXNCvy m/gbR9GElrMvELYJ5JlVHDgv1cUDfy6yNCXixP8MWbZlNU60dOxznmA2JpCPhsWo+REH NXn3aFwo9j5fyV97BvKblsYDFccCMkKST9Ha7bdguaw4p65dn5hOPW7oUaOEuj9LuU14 CtoqKoj+et2oV96bjuq2MDESIxyIzIIg5dcJKIUiQAHZM2PW5noe4p/tZTqC0NPF9E3v us9YPj9wvkBWyTXG8v7pctHBXTLHW5m+5oOi/XPwaSlcJv9wq3sbWP9qeJJW5EOha1jB hC9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hK/ZFrNh; 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 x63si709625pfk.335.2018.02.05.16.40.24; Mon, 05 Feb 2018 16:40:25 -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=hK/ZFrNh; 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 S1752497AbeBFAkW (ORCPT + 21 others); Mon, 5 Feb 2018 19:40:22 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:39885 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514AbeBFAh6 (ORCPT ); Mon, 5 Feb 2018 19:37:58 -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 w160ZHAt011351; Tue, 6 Feb 2018 09:35:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAt011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877332; bh=e+bBRzoO0V5YQsvcXSf66n+mUtbbyoF3YBYC04GSbmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hK/ZFrNhsaaZXv6SvrBuGXZa+2fFWSGfzBj6F+LlYj3Uyfbk8kt3IcN2NsXPKaEZb XsicLzJBfAFf0HgevRnSg6zxtWabHaen1r/wX8Od34wjXgB5KlDGkxWA/QSi/8XHpj 8u1u/8sUzDa5ijJsfUhZ0flMv8qRajAK5alPO5Jt/srKQ0rqMfB8vha6Q+wCaL+IxV fAw1hiT72hemIRSvFq085r/xQFyWyPO4KD+rH2C7z1ubvlRzsS9+jsRRQRifKk+Frv 9H8DMTcM8UgQYyf+P30bwD0D4vShj+yNSvobiBZr6tcntIDuqgwXtDDhZWGWyZHsSI u6PsvZPKiAzSg== 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 14/14] kconfig: test: check if recursive inclusion is detected Date: Tue, 6 Feb 2018 09:34:54 +0900 Message-Id: <1517877294-4826-15-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 recursive inclusion is detected, it should fail with error messages. Test this. Signed-off-by: Masahiro Yamada --- scripts/kconfig/tests/err_recursive_inc/Kconfig | 1 + scripts/kconfig/tests/err_recursive_inc/Kconfig.inc | 1 + scripts/kconfig/tests/err_recursive_inc/__init__.py | 10 ++++++++++ scripts/kconfig/tests/err_recursive_inc/expected_stderr | 4 ++++ 4 files changed, 16 insertions(+) create mode 100644 scripts/kconfig/tests/err_recursive_inc/Kconfig create mode 100644 scripts/kconfig/tests/err_recursive_inc/Kconfig.inc create mode 100644 scripts/kconfig/tests/err_recursive_inc/__init__.py create mode 100644 scripts/kconfig/tests/err_recursive_inc/expected_stderr -- 2.7.4 Reviewed-by: Ulf Magnusson diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig b/scripts/kconfig/tests/err_recursive_inc/Kconfig new file mode 100644 index 0000000..3ce7a3f --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/Kconfig @@ -0,0 +1 @@ +source "Kconfig.inc" diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc new file mode 100644 index 0000000..1fab1c1 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc @@ -0,0 +1 @@ +source "Kconfig" diff --git a/scripts/kconfig/tests/err_recursive_inc/__init__.py b/scripts/kconfig/tests/err_recursive_inc/__init__.py new file mode 100644 index 0000000..1dae64f --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/__init__.py @@ -0,0 +1,10 @@ +""" +Detect recursive inclusion error +================================ + +If recursive inclusion is detected, it should fail with error messages. +""" + +def test(conf): + assert conf.oldaskconfig() != 0 + assert conf.stderr_contains('expected_stderr') diff --git a/scripts/kconfig/tests/err_recursive_inc/expected_stderr b/scripts/kconfig/tests/err_recursive_inc/expected_stderr new file mode 100644 index 0000000..b256c91 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/expected_stderr @@ -0,0 +1,4 @@ +Kconfig:1: recursive inclusion detected. Inclusion path: + current file : 'Kconfig' + included from: 'Kconfig.inc:1' + included from: 'Kconfig:3'