From patchwork Thu Feb 14 21:37:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Higgins X-Patchwork-Id: 10813881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D74856C2 for ; Thu, 14 Feb 2019 21:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2D3C2E7C5 for ; Thu, 14 Feb 2019 21:39:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B48E22E7D1; Thu, 14 Feb 2019 21:39:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 542C72E7C5 for ; Thu, 14 Feb 2019 21:39:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3B0B1208AE2C9; Thu, 14 Feb 2019 13:39:03 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::a4a; helo=mail-vk1-xa4a.google.com; envelope-from=39d9lxa4kddytjwfvsfzayyafkyggydw.ugedafmp-fnvaeedaklk.st.gjy@flex--brendanhiggins.bounces.google.com; receiver=linux-nvdimm@lists.01.org Received: from mail-vk1-xa4a.google.com (mail-vk1-xa4a.google.com [IPv6:2607:f8b0:4864:20::a4a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 05A69208AE2CF for ; Thu, 14 Feb 2019 13:39:02 -0800 (PST) Received: by mail-vk1-xa4a.google.com with SMTP id x85so3131559vkx.2 for ; Thu, 14 Feb 2019 13:39:01 -0800 (PST) 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=GNGjlJhCWVkVbVZkHNZ4j2GxkLtq29hBLpGHCevAScI=; b=e55gdBIhIqOGFWr69kTRFk5llbRffDUr5rOzT3ycf9t0WLuBIwZ59KoZDVu2n1ATc9 ADuvo2RP80FpwpHyTraJSjbeVO4LzYWuveXK4GhciRPBu2p5rZb+0aIWm/U2ZP6MbJjg +Gacyv5qsq9aU/91B7Id1Zn5H3644UmrAejmddOu3KWxwrt1IPlWYZhk/MvpAU6iZJos a5sFD3XTnhZHI39EEpHOUcRRDnz4fUvO2qw6FhFsD6G1tB9GS097AGjgocTFm3oIQ/Mk m44ICVaeg97H4fSCw7U7GDQMJaJnE56CyunaJiRSS9EuifWcoyGTs0bBdqBIOGTtQ6io mqOw== 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=GNGjlJhCWVkVbVZkHNZ4j2GxkLtq29hBLpGHCevAScI=; b=nyT1afaMpNXyWjpvAQURJn/q1I18OF/aknJ8rMHXWqyutB5BCPbvDs98p3sJ6EUnHW qw0+G0TKJxDFEGiRqfuC7I5Z8Q7kqOIME5rBsL0WEZCZjcdc3SOzQ9w1da1iad5ht9Me bZnjJ7W6Po0umFrDkI53Wkt03mszdKhZ62g4wxY4W7ptRh3hy8mNJJYKSkDtE5MBffwA yZqrS333yp38SDc0+gIj29F4ouAlEfwZ6n1zNGqVZVAev4dVxjawKU8ZLD0yUMzqjPtU 4sMRAwhkCX/1oQI5ezKqh51/JfMQXYsCELcaZHM2ndII9kT3f1YE4e/OzoSN56TE9O/g 7JyA== X-Gm-Message-State: AHQUAubS0Nrem8lexo3AHt+M+IVLk017CPiRe0qj1ZndpX9HQoQFzld0 DnV0tXLyCWXjg4mL0EsM6wT3UzzBGONz9NR+fprmlw== X-Google-Smtp-Source: AHgI3Ib+6QisURxJgK8DqnTorQ+Dxqa7Fcsh0aQhVSV3Kh6hxIJ1cHBWJPRflApfNfu8H17D8PJsiQS18I9aJd06tS/oFw== X-Received: by 2002:a67:ee8e:: with SMTP id n14mr3913380vsp.45.1550180341082; Thu, 14 Feb 2019 13:39:01 -0800 (PST) Date: Thu, 14 Feb 2019 13:37:24 -0800 In-Reply-To: <20190214213729.21702-1-brendanhiggins@google.com> Message-Id: <20190214213729.21702-13-brendanhiggins@google.com> Mime-Version: 1.0 References: <20190214213729.21702-1-brendanhiggins@google.com> X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog Subject: [RFC v4 12/17] kunit: defconfig: add defconfigs for building KUnit tests From: Brendan Higgins To: keescook@google.com, mcgrof@kernel.org, shuah@kernel.org, robh@kernel.org, kieran.bingham@ideasonboard.com, frowand.list@gmail.com X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: brakmo@fb.com, pmladek@suse.com, amir73il@gmail.com, Brendan Higgins , dri-devel@lists.freedesktop.org, Alexander.Levin@microsoft.com, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, richard@nod.at, knut.omang@oracle.com, wfg@linux.intel.com, joel@jms.id.au, jdike@addtoit.com, dan.carpenter@oracle.com, devicetree@vger.kernel.org, Tim.Bird@sony.com, linux-um@lists.infradead.org, rostedt@goodmis.org, julia.lawall@lip6.fr, kunit-dev@googlegroups.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, daniel@ffwll.ch, mpe@ellerman.id.au, joe@perches.com, khilman@baylibre.com Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Changes Since Last Version - This patch is new adding default configs to build KUnit. - NOTE: there is still some discussion to be had here about whether we should go with a defconfig, a config fragment, or both. --- 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):