Received: by 10.223.176.5 with SMTP id f5csp60835wra; Mon, 5 Feb 2018 16:41:27 -0800 (PST) X-Google-Smtp-Source: AH8x225Hi+35L20VzQ3r7MqGhFjXw8eNKyqU02DSPEC7l8eCYkbFuQo+Cer2QMTDLuM/Cj4ilQlO X-Received: by 2002:a17:902:bc3:: with SMTP id 61-v6mr560861plr.407.1517877687320; Mon, 05 Feb 2018 16:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877687; cv=none; d=google.com; s=arc-20160816; b=wbttVAZU3aBWaZUpM1P3NA/1AyOsuWAFy5k75qlcdNR5DGNiUlgkKfLWPjhGLSmNhV nOT1XZ64Sp06OfxOOZvVql4G4GgaXaNhEBdbxhUNKEURPs8nRlP4OycSy21rrZIU1ssx +/vL5CPV7AdGh2afedEMwiQhedYF8c6TRuj4ZRmmiMRopNZhxPm+o/OQnG9hotIlWuzR cZ29SqYEYjtg+8kzvxcb8ALK7/j78gnrRrxbpYgPctjJ2Sk5R5nUnm4sf4CfCNo5X1ei 9uEWvBAahHZoUWhxjA5SP4LxpD8I+hvYsSDQpf8+5IxPOhhRh0HQV65UAclRy9ZRqjWU cY0A== 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 u13si3424105pgr.530.2018.02.05.16.41.10; Mon, 05 Feb 2018 16:41:27 -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 S1752191AbeBFAiw (ORCPT + 99 others); Mon, 5 Feb 2018 19:38:52 -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 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) -- 2.7.4