From patchwork Fri Mar 2 04:32:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 130461 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp858649lja; Thu, 1 Mar 2018 20:36:31 -0800 (PST) X-Google-Smtp-Source: AG47ELsI9CX81+zI/lMkl25ddf1vrtRIZygaXGYCv0cShu/w1de/wRwqr70HWYgYrAkABG8YXCOu X-Received: by 10.99.0.207 with SMTP id 198mr3558420pga.364.1519965391682; Thu, 01 Mar 2018 20:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519965391; cv=none; d=google.com; s=arc-20160816; b=ESMtBsWD7cSHvR+F0Z8FI14kt6+Y0Lx2/xkwxFngEgQOdqGMw+nnOEq+hDP7UkPBGd oyNO9TmMZ1P4QXKLwtBz/Bq0RkWCC8MqprN1zJIX7uOZ6iARyQ55clMfZiqwDmTDzZwK EytIgk8htn1MWpD3Hl6uqWP5Qvje5yYXY1ujy8Q0gyOodW87NgThPFNgh38BntIG/oiH MWI6wZzlq5PCa1H3BGojjeVhBb3cQS0wG82rY2RF9QNaBnt19pob99Bq2xrdfFFDQtuy lz78fQ72Cs6EGHHft3OzIaDwZw4ppvkQ+Wt7XAQaCqkQZcVhCsgV+g9kX6vSFVlQVWol 5HHg== 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=oNntiM8YDjzK8DDDlYwMBcd7P8ZgUmQckYBmYyraLDw=; b=X+FcM7Bp1/WCx/9I5XMWOhai7JBU6b4woSwU25FSGnr7gLxFul9YTz0ZWQsjfZqDRv KFhr775hFS1r53pix2NRLsuMD5FI8Gc95fCed7DzcSLnpGQ+uqX3d7yGyFHSw7yqv/Kn wtTnT5ef2yHm1T37xj3T1fAEuOKP06aWHA2ozG4/92U+u49MitIw3BaORd5eSwMUSdCs cWY3R5/u3BbtxxAPMMk5Sb4E/BLOtG0exG7lbogCvOtdrrtdJ7R+uf55qxFrHaEVkMA0 FMtsv4G6dYT3EpJ66Z+ei/t4ZNmJ68570MYQ3+hgB8X+pjkW4rPscPSWHGZGbyadTI+N aTIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=xXjcVt2e; 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 w16-v6si4077946plp.87.2018.03.01.20.36.31; Thu, 01 Mar 2018 20:36:31 -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=xXjcVt2e; 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 S1422784AbeCBEg1 (ORCPT + 28 others); Thu, 1 Mar 2018 23:36:27 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:53158 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164985AbeCBEdr (ORCPT ); Thu, 1 Mar 2018 23:33:47 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w224WURM022085; Fri, 2 Mar 2018 13:32:39 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w224WURM022085 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519965159; bh=oNntiM8YDjzK8DDDlYwMBcd7P8ZgUmQckYBmYyraLDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xXjcVt2eV4cmyAtH9TVATPbZ4LFNHw2q+hO5if3hP8KULs2wBaoRMHvBMcwVsiUPJ VNxeIJsQrgAi+nVxKxVh2R1T/TM26PLIK2gVUk0+mvum0UhriUCL1k7NSDE9AUwHuw CJElK4lpZ3Z8HCP1vZio+z9YmnWy4S5AGjRkm/zWE0lUsHSGXnuJCMUeffYvnEFgZS JHYuiL6KpRW8ZX1QDfbIARrPZgAfmJZ6PxJGEiZ/RsmIXr0T++36VMaBAeCA83Rkt4 ijV/Gtb1OnQ8S6vMzfrPHLiZpcPpWxC1kurb/NFXLvyutti2dqyxsU+1Ai+Y1ZfyUW o68nFcGRSzkTg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Michal Marek , Ulf Magnusson , Randy Dunlap , "Luis R . Rodriguez" , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/11] kconfig: unittest: test if recursive inclusion is detected Date: Fri, 2 Mar 2018 13:32:01 +0900 Message-Id: <1519965121-12017-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519965121-12017-1-git-send-email-yamada.masahiro@socionext.com> References: <1519965121-12017-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 recursive inclusion is detected, it should fail with error messages. Test this. Signed-off-by: Masahiro Yamada Reviewed-by: Ulf Magnusson --- Changes in v2: - coding style clean-up based on PEP8, PEP257 scripts/kconfig/tests/err_recursive_inc/Kconfig | 1 + scripts/kconfig/tests/err_recursive_inc/Kconfig.inc | 1 + scripts/kconfig/tests/err_recursive_inc/__init__.py | 10 ++++++++++ scripts/kconfig/tests/err_recursive_inc/expected_stderr | 4 ++++ 4 files changed, 16 insertions(+) create mode 100644 scripts/kconfig/tests/err_recursive_inc/Kconfig create mode 100644 scripts/kconfig/tests/err_recursive_inc/Kconfig.inc create mode 100644 scripts/kconfig/tests/err_recursive_inc/__init__.py create mode 100644 scripts/kconfig/tests/err_recursive_inc/expected_stderr -- 2.7.4 diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig b/scripts/kconfig/tests/err_recursive_inc/Kconfig new file mode 100644 index 0000000..3ce7a3f --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/Kconfig @@ -0,0 +1 @@ +source "Kconfig.inc" diff --git a/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc new file mode 100644 index 0000000..1fab1c1 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/Kconfig.inc @@ -0,0 +1 @@ +source "Kconfig" diff --git a/scripts/kconfig/tests/err_recursive_inc/__init__.py b/scripts/kconfig/tests/err_recursive_inc/__init__.py new file mode 100644 index 0000000..0e4c839 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/__init__.py @@ -0,0 +1,10 @@ +""" +Detect recursive inclusion error. + +If recursive inclusion is detected, it should fail with error messages. +""" + + +def test(conf): + assert conf.oldaskconfig() != 0 + assert conf.stderr_contains('expected_stderr') diff --git a/scripts/kconfig/tests/err_recursive_inc/expected_stderr b/scripts/kconfig/tests/err_recursive_inc/expected_stderr new file mode 100644 index 0000000..b256c91 --- /dev/null +++ b/scripts/kconfig/tests/err_recursive_inc/expected_stderr @@ -0,0 +1,4 @@ +Kconfig:1: recursive inclusion detected. Inclusion path: + current file : 'Kconfig' + included from: 'Kconfig.inc:1' + included from: 'Kconfig:3'