From patchwork Tue Mar 13 09:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131417 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp484439ljb; Tue, 13 Mar 2018 02:16:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELth0AWxIl12MoPeECbj2p7s2OyR7M9EmjlS24C1tez36t5Zi0fuy7kl5McJA4ONWP1CrjuF X-Received: by 10.101.87.201 with SMTP id q9mr4910808pgr.215.1520932561129; Tue, 13 Mar 2018 02:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520932561; cv=none; d=google.com; s=arc-20160816; b=THKzzB78EbJ71bDoE04x4adKWuBjbGJqqOVEVOCaQQjMmFwwesTGEXJW/janD93Fct 74FTHO6diVbH6PtpRvww8zXIP5L7aE8AUMYoPTxCk0lgm8zz94grNKSn67I7osxX0r8u jqaYHZEGr9rdLH7EvoX87YVabU8xtILZzhYk4G8NRQlhBSr18/TBAxpBIuppNTJnnBcD drMohPtewVNNYzoKa5HUmQYOo/JWzDy5WnoboDhDMZfDHRqRJz2xkkMg5HdTNpyaoVWH 7UKWng3R0BG5mS0L9YxR4gzYIu7rqQgKsm5F2eMFJKPUupvM78bdvvrBWOnPFcPm4jxi 2fIA== 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=0sNXwR/AFUvRTxtAIC+XUzonrWt0bW64IesI7iNccLI=; b=HY3xtY0MF2z0ny33dgJkocSHWmDqlusx49CVu7k8zpwj71x2MOHfQu0G7SJUPRZH25 3+4kUeCEnz3RufpCHXjYmafHvA207AIxqMtpiW+NgW8gu95hQwlWv53pE1IgRjlDZp9+ Xa+ybmd37VSYd7AU5IF/j8quO+jAQk5RdNpygyC4JVkhPwoQ66S+ZCH5q5DL0I6NEGNB nPXWSUyoVHILG4ZE/qqlnvJnLb0vOa6nvnF+B/rwtf7jtSbfec8kcYts0ZFsYM+DTPIz fsgyuXkXEuBjcYb+G0+uOx52uNO0i5YpQMMKB+zw9+MWIPBQGBTqZiiQITTp/G/DYsLA AZ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nfITK7lU; 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 f1-v6si7496998plb.73.2018.03.13.02.16.00; Tue, 13 Mar 2018 02:16:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nfITK7lU; 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 S1752655AbeCMJP3 (ORCPT + 28 others); Tue, 13 Mar 2018 05:15:29 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:41799 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbeCMJOB (ORCPT ); Tue, 13 Mar 2018 05:14:01 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2D9CIo5016505; Tue, 13 Mar 2018 18:12:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2D9CIo5016505 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520932342; bh=0sNXwR/AFUvRTxtAIC+XUzonrWt0bW64IesI7iNccLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nfITK7lUK0EMu5dvMQbNtJq2q20601wwN0EZLMgoHCg/UaOp63QF93fqm2FEaCJ2w WXdj+BkBKv32ceA3y1VXdBV8MOB8NATskBOMt2aVc9ie9lzyyQlULRVB3/ph088swz q6dBQu/NO+nLD6St/xp0KiqbfCLjMNHwTgMelzdzuvEJ4zcZcDtUw6M3XYkmCNE1rS 8SKm0WgIINrE175wytr1lVQtWVpEDflW3JfhwHc39WoebFZJaUKMkcSI2yFbP6nITg xgeSJhofECnZluaaz7Ajajqyhg7dO5BFidlQKMSYv/rAALeSyTmsOkg5sjYDPbI7x3 cewUFr2B7e5uQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Ulf Magnusson , Randy Dunlap , "Luis R . Rodriguez" , Tony Luck , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v3 04/11] kconfig: tests: test automatic submenu creation Date: Tue, 13 Mar 2018 18:12:05 +0900 Message-Id: <1520932332-2449-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520932332-2449-1-git-send-email-yamada.masahiro@socionext.com> References: <1520932332-2449-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If 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 Reviewed-by: Ulf Magnusson --- Changes in v3: None Changes in v2: - shorten directory name 'auto_submenu_creation' -> 'auto_submenu' - coding style clean-up based on PEP8, PEP257 scripts/kconfig/tests/auto_submenu/Kconfig | 50 ++++++++++++++++++++++ scripts/kconfig/tests/auto_submenu/__init__.py | 12 ++++++ scripts/kconfig/tests/auto_submenu/expected_stdout | 10 +++++ 3 files changed, 72 insertions(+) create mode 100644 scripts/kconfig/tests/auto_submenu/Kconfig create mode 100644 scripts/kconfig/tests/auto_submenu/__init__.py create mode 100644 scripts/kconfig/tests/auto_submenu/expected_stdout -- 2.7.4 diff --git a/scripts/kconfig/tests/auto_submenu/Kconfig b/scripts/kconfig/tests/auto_submenu/Kconfig new file mode 100644 index 0000000..c17bf2ca --- /dev/null +++ b/scripts/kconfig/tests/auto_submenu/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 can/should not + be a submenu. diff --git a/scripts/kconfig/tests/auto_submenu/__init__.py b/scripts/kconfig/tests/auto_submenu/__init__.py new file mode 100644 index 0000000..32e79b8 --- /dev/null +++ b/scripts/kconfig/tests/auto_submenu/__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/expected_stdout b/scripts/kconfig/tests/auto_submenu/expected_stdout new file mode 100644 index 0000000..bf5236f --- /dev/null +++ b/scripts/kconfig/tests/auto_submenu/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)