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)