From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAA2DC43381 for ; Thu, 14 Feb 2019 21:39:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B488C2147C for ; Thu, 14 Feb 2019 21:39:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="e55gdBIh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503382AbfBNVjv (ORCPT ); Thu, 14 Feb 2019 16:39:51 -0500 Received: from mail-vs1-f73.google.com ([209.85.217.73]:40138 "EHLO mail-vs1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440358AbfBNVjC (ORCPT ); Thu, 14 Feb 2019 16:39:02 -0500 Received: by mail-vs1-f73.google.com with SMTP id e124so1778054vsc.7 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=Z2Jp3KpG6KpTEQ4Oc8nF/gmTAvzOeD+kUfg0ilpfrVGAQbaBWB/1lQVBSApOXsQ4pB XzeDJaRjiuKPEgPSRkMQok7X9Kx7b+PTQ/Zq1//ASV4w1TKjKP5MfY9nfm233RVd4sS0 sFH8wT/uI2c4I5QseKrGVw23Eynu3lZ0P6fLqAjVXpXPhqbgVYQlKfW0ZmWiPf6nydXK 1/r35p78BEGuDRGcIY6ja1xFj7UFIknJo1y1E0BEimEX3WCAda6WkV0IOVLJnJ0LkMGP t1uwxGKwSbJ4lQKfR0gK2IGpUzhnC6RfG4A34UPhKRhpLwD8yRsqsPwwD9UEnlwAZl3b Xarg== X-Gm-Message-State: AHQUAuZqk5YUhtmanWazIwjsM1/hXyHCkmDURvYbDX7kKgPmktNWDlrt nLd2n1nELnriut0pCmSyJYIvhJbNBGu/Xs6nx4NXTA== 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 Cc: gregkh@linuxfoundation.org, joel@jms.id.au, mpe@ellerman.id.au, joe@perches.com, brakmo@fb.com, rostedt@goodmis.org, Tim.Bird@sony.com, khilman@baylibre.com, julia.lawall@lip6.fr, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, jdike@addtoit.com, richard@nod.at, linux-um@lists.infradead.org, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, dan.j.williams@intel.com, linux-nvdimm@lists.01.org, knut.omang@oracle.com, devicetree@vger.kernel.org, pmladek@suse.com, Alexander.Levin@microsoft.com, amir73il@gmail.com, dan.carpenter@oracle.com, wfg@linux.intel.com, Brendan Higgins Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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): -- 2.21.0.rc0.258.g878e2cd30e-goog