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"