From patchwork Thu Apr 4 22:06:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Higgins X-Patchwork-Id: 1077777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QRs/AWqP"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="fb8e+v1Z"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44ZxwQ1ksZz9sRt for ; Fri, 5 Apr 2019 09:10:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MHPRfihCT6foo55FtHGx9gZhhiQWhQWFH195lBLlKOY=; b=QRs/AWqPj4CipY EyD13ZUV6QxOxvyuqmAMerihCRGIbW4ju4CE6QqLuI9fgvm77N2d0Xn8PWQc43Orms7lbbDSRJBMb AM5LwDNWEtNhhpPK0EfgDGZSFi8BxwZvvyAF5lBEiM9/kyV7JVN48hY6gCXF9L8hMPeGIIqCQr3HO x3OIz1rdT10mureC18YG53ORnmO5geaMx05hT55LCHh30e6P2mmch5qScbC2Iyjv4Lh9M0KwyEZoO XTgrF0hFNHKIygJDjS8pndCIPKPegDG7CjyaoOA1CLZCrDFEdHrHY0THFld1+8bLsNEdcQxt6x9kq NfJz/HgYM+OqBTAzsfdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hCAZC-0000Cp-Sm; Thu, 04 Apr 2019 22:10:38 +0000 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hCAZ9-0000A0-Af for linux-um@lists.infradead.org; Thu, 04 Apr 2019 22:10:36 +0000 Received: by mail-pf1-x449.google.com with SMTP id b12so2719376pfj.5 for ; Thu, 04 Apr 2019 15:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=oW4PDVaJxDnrY6BBc/BAHq/Hfgozzw2Xp2Gy+1ZhIC8=; b=fb8e+v1Z/Vhw8iTIo0CwD5Vx1AmUlpqbB3aiVwU0233WvzFboxwLQMGvesF9ZZX5sX 9JkP4aYiS7YkV/Z9hCpYMVK+jg/ZOxeZi51Jwc7cNQjLdxiqRwdlZHUD4qO0/jFJi1rC AF5KeZIRmUIMVJUXV+gqpCZu0z++hIeqYkYXSPMaWW+MGWB0q1yLWS0sH6QElHUZcYMz sdMJwxyA6SEn+iPtpCgA/U059V0MLpHndFv0eezfjXtcoOhtXiM0qeBn64kGrh17t5hh Ze71xEwtP0paAg9lzOGxi/3QYBJI8ljeo9IHsd9sbq3bfj1p/XNnCO1YjnBJaRA/13IF E+fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=oW4PDVaJxDnrY6BBc/BAHq/Hfgozzw2Xp2Gy+1ZhIC8=; b=nGrFDxjPdtA9AUto/BIkRZNkNx0mDqm+45w9BQfnpq2LsooCWy2Ti+hyKCxtTeFYYc HcEmray+dAeKWT6G5cAwfrkP/wxKzAiJnWOmJCPrXG4z2YGsgRYjJiczVBANaE6nQzHH ce97aKD4t+/CXH4AUrnkPMYRNeapYQ0bYIyHsBJNjkGsWYq5i9o9RX9WQB39PzwKS1z2 e0V4KAsUPe2mrNmLrqhatvDUa945wL5jwAp4lXsB2402lfU0xoMH9jkKFGShnXuPWKuD x79JC7/I6m1QMucINh0/XIqJmRmjAnEbAQPkLc4O3+5dLiS9hQ3LIRAcI5ff/WuOPRUb F6iA== X-Gm-Message-State: APjAAAWdX1uv+kd4BDaJ5/qEVFKB1wuSh+OSp8JxzoMSpf3SzJtRmpPw 8BQki3HcdPQCIise3KhsE7eo/LogYLA/RphyvaZEAA== X-Google-Smtp-Source: APXvYqySlZeZhmHUzbaLxG3cwraMDL8UwYyYOhgsZAcby/Biv7RGMnF/AKvHBa7ap73rPVPaHw4JDtLbjtHNYJgqLR8yTQ== X-Received: by 2002:a65:46c8:: with SMTP id n8mr227144pgr.65.1554415833550; Thu, 04 Apr 2019 15:10:33 -0700 (PDT) Date: Thu, 4 Apr 2019 15:06:48 -0700 In-Reply-To: <20190404220652.19765-1-brendanhiggins@google.com> Message-Id: <20190404220652.19765-14-brendanhiggins@google.com> Mime-Version: 1.0 References: <20190404220652.19765-1-brendanhiggins@google.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog Subject: [PATCH v1 13/17] kunit: defconfig: add defconfigs for building KUnit tests From: Brendan Higgins To: corbet@lwn.net, frowand.list@gmail.com, keescook@google.com, kieran.bingham@ideasonboard.com, mcgrof@kernel.org, robh@kernel.org, shuah@kernel.org, yamada.masahiro@socionext.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_151035_369020_20B44192 X-CRM114-Status: GOOD ( 12.63 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:449 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pmladek@suse.com, linux-doc@vger.kernel.org, amir73il@gmail.com, Brendan Higgins , dri-devel@lists.freedesktop.org, Alexander.Levin@microsoft.com, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, khilman@baylibre.com, knut.omang@oracle.com, wfg@linux.intel.com, joel@jms.id.au, jdike@addtoit.com, dan.carpenter@oracle.com, devicetree@vger.kernel.org, linux-kbuild@vger.kernel.org, Tim.Bird@sony.com, linux-um@lists.infradead.org, rostedt@goodmis.org, julia.lawall@lip6.fr, dan.j.williams@intel.com, kunit-dev@googlegroups.com, richard@nod.at, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, daniel@ffwll.ch, mpe@ellerman.id.au, linux-fsdevel@vger.kernel.org Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add defconfig for UML and a fragment that can be used to configure other architectures for building KUnit tests. Add option to kunit_tool to use a defconfig to create the kunitconfig. Signed-off-by: Brendan Higgins --- arch/um/configs/kunit_defconfig | 8 ++++++++ tools/testing/kunit/configs/all_tests.config | 8 ++++++++ tools/testing/kunit/kunit.py | 17 +++++++++++++++-- tools/testing/kunit/kunit_kernel.py | 3 ++- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 arch/um/configs/kunit_defconfig create mode 100644 tools/testing/kunit/configs/all_tests.config diff --git a/arch/um/configs/kunit_defconfig b/arch/um/configs/kunit_defconfig new file mode 100644 index 0000000000000..bfe49689038f1 --- /dev/null +++ b/arch/um/configs/kunit_defconfig @@ -0,0 +1,8 @@ +CONFIG_OF=y +CONFIG_OF_UNITTEST=y +CONFIG_OF_OVERLAY=y +CONFIG_I2C=y +CONFIG_I2C_MUX=y +CONFIG_KUNIT=y +CONFIG_KUNIT_TEST=y +CONFIG_KUNIT_EXAMPLE_TEST=y diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config new file mode 100644 index 0000000000000..bfe49689038f1 --- /dev/null +++ b/tools/testing/kunit/configs/all_tests.config @@ -0,0 +1,8 @@ +CONFIG_OF=y +CONFIG_OF_UNITTEST=y +CONFIG_OF_OVERLAY=y +CONFIG_I2C=y +CONFIG_I2C_MUX=y +CONFIG_KUNIT=y +CONFIG_KUNIT_TEST=y +CONFIG_KUNIT_EXAMPLE_TEST=y diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index 7413ec7351a20..63e9fb3b60200 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -11,6 +11,7 @@ import argparse import sys import os import time +import shutil import kunit_config import kunit_kernel @@ -36,14 +37,26 @@ parser.add_argument('--build_dir', 'directory.', type=str, default=None, metavar='build_dir') -cli_args = parser.parse_args() +parser.add_argument('--defconfig', + help='Uses a default kunitconfig.', + action='store_true') -linux = kunit_kernel.LinuxSourceTree() +def create_default_kunitconfig(): + if not os.path.exists(kunit_kernel.KUNITCONFIG_PATH): + shutil.copyfile('arch/um/configs/kunit_defconfig', + kunit_kernel.KUNITCONFIG_PATH) + +cli_args = parser.parse_args() build_dir = None if cli_args.build_dir: build_dir = cli_args.build_dir +if cli_args.defconfig: + create_default_kunitconfig() + +linux = kunit_kernel.LinuxSourceTree() + config_start = time.time() success = linux.build_reconfig(build_dir) config_end = time.time() diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index 07c0abf2f47df..bf38768353313 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -14,6 +14,7 @@ import os import kunit_config KCONFIG_PATH = '.config' +KUNITCONFIG_PATH = 'kunitconfig' class ConfigError(Exception): """Represents an error trying to configure the Linux kernel.""" @@ -81,7 +82,7 @@ class LinuxSourceTree(object): def __init__(self): self._kconfig = kunit_config.Kconfig() - self._kconfig.read_from_file('kunitconfig') + self._kconfig.read_from_file(KUNITCONFIG_PATH) self._ops = LinuxSourceTreeOperations() def clean(self):