From patchwork Tue Mar 13 09:12:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131414 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp483045ljb; Tue, 13 Mar 2018 02:14:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELuDT5Gq1MjmjgA3BeT5qIhgxPOvxJ+tbNtRPL6xa3lqtqNFBlQfyquFa2HnZLu0yZU65ix8 X-Received: by 10.98.12.82 with SMTP id u79mr11053403pfi.192.1520932460325; Tue, 13 Mar 2018 02:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520932460; cv=none; d=google.com; s=arc-20160816; b=zoGGAobjEu/kFueY1IYpDTov5lywVuBe6Ej2QBt2i8Z1k++LzQpRPqgA3gTzbWBnhG Px3B28jPUoTGkaxntpyAstX501+2+bz9IbDNXosQxuPqiePVn5Y96p/CsD8mwtmSwSrA K7BVjGySRXiDqcMBJF25P0Vuo+3JonwG2XBmM5nyNmrndKXWkRFO5twuSgqWeNkT8Q93 we9a0IQXdvDeiDklVVLDQ8aE+40DfWKgQ5PR6G79gmU1dURGVsOTO1Gww/uge8kVWSmP Ytt08vqRXEuXnLAQAgCzLJ9nMltt2D2r7QWeSY3yFHBX/0sHLTo76Rm0NFh3c3jzlsVP Z2sA== 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=i5RVMFP5eZLVq0Us8WhBjUfqWNJ2ofQXk7usvJBEckw=; b=shPJpN4Th1wiwSFsGZ3YfCJ+05cjyQK9Mly78QkUyNMuf2C5GGiASHQapalxTs+1lK 2zyveVj1SH/lJ0Q4FlKLEWBjC1FvNU4oJi6Bm8n3zykFuI/poaImuvBzTIU1SRvAVR2z Qw97Gb60lQVnSonQXCZj0jkVjpTI2O4q50S6z/CO/e5+lXK32Izyivo5ajUqpaQsFTuS YwMPbPL3I9IA801OGXQUGGB3QAL28voz8/OpnZCCz2fkZv3Hd6V+hjZC1lCbXwcGI00C 1L/XNl+NeS1VLN+DKoRGLcKqa0JN5egx+SzSwx/hkAt2UDKYD9N0ihyr8ba+qAZKSRiK zFqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=p6awXAPu; 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 4-v6si1334564plb.205.2018.03.13.02.14.19; Tue, 13 Mar 2018 02:14:20 -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=p6awXAPu; 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 S932312AbeCMJOR (ORCPT + 28 others); Tue, 13 Mar 2018 05:14:17 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:41805 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488AbeCMJOB (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 w2D9CIoB016505; Tue, 13 Mar 2018 18:12:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2D9CIoB016505 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520932347; bh=i5RVMFP5eZLVq0Us8WhBjUfqWNJ2ofQXk7usvJBEckw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6awXAPuDR3inGZYWiiOT8NL/bcVe1o2mFwWK4e2yRxg99CePfpytyQRHT5BJemPf mSBCj6GuZD7XCPeb/Rccrv3IqbZbZ36Roof/f6sDtTLM/BGvPWMmt1JujF6faE8GTi oTOWhFCbPHrmeAEMlYSeF3zymFF99sTJBZaPcxibMryV5ErgMdu0A3raUKBU61dl/N us8gQI104MoAeT1p9NijrIKv6y/bw/wr9oRvrBSfKfa2nYFl8d3TWKUjl4l3NASyRL CobGocKJ9436r0qJELwgRMqS3YwXFMAsZ94XH6D8AluisymhSxtK3/w2yYF0NFRsxV WrD3UZE8cD8CA== 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 10/11] kconfig: tests: test if recursive dependencies are detected Date: Tue, 13 Mar 2018 18:12:11 +0900 Message-Id: <1520932332-2449-11-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 Recursive dependency should be detected and warned. Test this. This indirectly tests the line number increments. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- Changes in v3: None Changes in v2: - Fix missing end quote - coding style clean-up based on PEP8, PEP257 scripts/kconfig/tests/warn_recursive_dep/Kconfig | 62 ++++++++++++++++++++++ .../kconfig/tests/warn_recursive_dep/__init__.py | 9 ++++ .../tests/warn_recursive_dep/expected_stderr | 30 +++++++++++ 3 files changed, 101 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 diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/warn_recursive_dep/Kconfig new file mode 100644 index 0000000..a65bfcb --- /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..adb2195 --- /dev/null +++ b/scripts/kconfig/tests/warn_recursive_dep/__init__.py @@ -0,0 +1,9 @@ +""" +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..3de807d --- /dev/null +++ b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr @@ -0,0 +1,30 @@ +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