From patchwork Fri Dec 20 05:14:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11304821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8666713A4 for ; Fri, 20 Dec 2019 05:14:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63B5F24680 for ; Fri, 20 Dec 2019 05:14:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y91UTjSC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbfLTFOW (ORCPT ); Fri, 20 Dec 2019 00:14:22 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:52184 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbfLTFOV (ORCPT ); Fri, 20 Dec 2019 00:14:21 -0500 Received: by mail-wm1-f66.google.com with SMTP id d73so7629512wmd.1; Thu, 19 Dec 2019 21:14:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cljTni9v+UR/6x17SI6kPpo9aSuUSmuodBBC+WhKsng=; b=Y91UTjSCr7XliMIFAnNosZVIuq/vCTHtQRA4omAahL0g7w3eZ1ISL/LQ8dBH/sDWhY EwMZpgGApJwb0eP6GbXWqwdDlVOFzcq/JXDGLv0YjjAFTJ9wWwXoQy4mI+cu3cCpO51h Y2DCnXoDc8MY6oxa2RsvNYCkNIoRr8B8NfI61kHMn5prJ3Y7XakCTi5s2ixKUwqB0j8G xQei0I2Kzba58voWPkcXdbHuVCQQbR/nk9Bu/+SnSA2erjOpLSz5lAvKHh9CDGszuzVe r500pKF4uivTnCgg56T8QHFOlaIUqDTonI/LAcVVJlJyQKYQI5132S0QZVVf6Ymj8I8i duNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cljTni9v+UR/6x17SI6kPpo9aSuUSmuodBBC+WhKsng=; b=J2zMAKGGAuX/jHl9Ob7HVG6Ma1DgB4Rfv+DnwDjW0q7nGuw/Aa4wDHQdxLD9v9BU2Y EgviuMcFmNpXVPPosnpSaWYkQT8CucbI0NuFztTHq2Q0hNsaylsPssmFiwZsnjVygokH OE9oyIlgqmdChuBGqpQsk3Zh1Ftb8gOS+8cNHzKBwriBzIdtTZ8wKeLmbWLWkCg5v68Z iY6rn5UUIIquQDfZEm/653S0Mlw90PTu4BoGU0kTHyVk6fBD6KVibR6Rmid4TbcHVbwk 6k8MORxoQcKGcepuIKxNA7fhTs/u6yL+vPdcFTnpRbQOVeG96wpUYNUyRIDmM6Tnj4JW +U9Q== X-Gm-Message-State: APjAAAUUVOGeOzEN1EpguT+5AfHNHBHYGg3et9nzCu8Mlrc7Uc+lZILB ZE/R2aaZAm7yvf2K0Ga/exU= X-Google-Smtp-Source: APXvYqxm8la5hKk/hQwczOZ9e76OlFLTr0r2TqThMcqi0DqOfjCeDxXetOFGWfsXUEOLaZY67sIEMg== X-Received: by 2002:a1c:3c45:: with SMTP id j66mr13522534wma.2.1576818858721; Thu, 19 Dec 2019 21:14:18 -0800 (PST) Received: from localhost.localdomain (cable-86-56-100-90.cust.telecolumbus.net. [86.56.100.90]) by smtp.gmail.com with ESMTPSA id j12sm8703863wrt.55.2019.12.19.21.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 21:14:18 -0800 (PST) From: sj38.park@gmail.com X-Google-Original-From: sjpark@amazon.de To: shuah@kernel.org Cc: brendanhiggins@google.com, corbet@lwn.net, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sj38.park@gmail.com, sjpark@amazon.com, sjpark@amazon.de Subject: [PATCH v7 1/6] docs/kunit/start: Use in-tree 'kunit_defconfig' Date: Fri, 20 Dec 2019 05:14:03 +0000 Message-Id: <20191220051408.3591-2-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220051408.3591-1-sjpark@amazon.de> References: <20191220051408.3591-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: SeongJae Park The kunit doc suggests users to get the default `kunitconfig` from an external git tree. However, the file is already located under the `arch/um/configs/` of the kernel tree. Because the local file is easier to access and maintain, this commit updates the doc to use it. Signed-off-by: SeongJae Park Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins --- Documentation/dev-tools/kunit/start.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index 9d6db892c41c..d5197f1a45cb 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -32,9 +32,8 @@ regular Kernel config, with the specific test targets as well. .. code-block:: bash - git clone -b master https://kunit.googlesource.com/kunitconfig $PATH_TO_KUNITCONFIG_REPO cd $PATH_TO_LINUX_REPO - ln -s $PATH_TO_KUNIT_CONFIG_REPO/kunitconfig kunitconfig + cp arch/um/configs/kunit_defconfig kunitconfig You may want to add kunitconfig to your local gitignore. From patchwork Fri Dec 20 05:14:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11304815 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB9B013A4 for ; Fri, 20 Dec 2019 05:14:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BDCB24686 for ; Fri, 20 Dec 2019 05:14:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nrU5T60U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727192AbfLTFOW (ORCPT ); Fri, 20 Dec 2019 00:14:22 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38742 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfLTFOW (ORCPT ); Fri, 20 Dec 2019 00:14:22 -0500 Received: by mail-wm1-f65.google.com with SMTP id u2so7869737wmc.3; Thu, 19 Dec 2019 21:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mZWHQXNZbjWrCsuUxUN1Y9Qc19tYv4n773phxKWQndE=; b=nrU5T60UysGF2YIRLSk3nPP6cbi85Zv2mW4ThA0MXV//JR3YjzosHdwu19Wx4BqX1T IWcUVn1EE1JDi+Xplbd7zmCnUkMpcCsGgmCCZ+ZH7VUFOHYNjsS/cPVG5+2aQUzLV1c5 HIM2pKhzFS6Ylg77RJo2PIdrAA7l39tojwedjAij36Nuc+DcNGU85dPLU81NCZsr2JR+ 99+5mLXAxc8lCEqg5C5ODQqG91Hct4x8ryFZdLpSuSNGS2VG2SFyjSe2KcOylk6taKjN kjpW1OCjHLzUN6vkWevuCkG+sYK5ci48GQOXuJ2d8jcApC5DiXb7ZuAKwq3ibIZk8PUS D74Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mZWHQXNZbjWrCsuUxUN1Y9Qc19tYv4n773phxKWQndE=; b=MBjlHZKy2dDeMOev9wnCT4dCdj0RqPU5BF+62PjXqdpJzvbtWHLJnOLoUj7jS+hqMx KZ2vOndaSVpSSd5U0nrBHCvrDKm3n/FXFsLe7lNJVrH8UdOssMuzuHF08AQAFba5SdX2 kMKUEwp+b8lCWJ2jNu9kdisss2MYUh72Eb86D/1qjpf1B4weenU6gaDHSfiULiXAt1Bu 4i6GRt5pZ1Boz6pFRgvjdTL+ezUbvwj/27QTOH7KhZAccOPHRo16ho7vO1sfioqOg1HM 53D8bLPgGVSbA1rsNhW9UQMi9q949qxKnnypUyRxhLGtGCXOOsio4y7gZ1CDQVqxNk3D UzoQ== X-Gm-Message-State: APjAAAVDepGARMYIemvwWQvUiLw6H+djxFft8FgWBZLT/Z92GHXjolO+ echCc2tzDEYmRzMEdQw3iuI= X-Google-Smtp-Source: APXvYqzaWtnwNBBPRPmZs/K2n1dWihJXuAFPZmbYBp7ZO3xDMfSEP3ovrD0no3EXS4/nHRA/QIUN4A== X-Received: by 2002:a05:600c:2549:: with SMTP id e9mr14422062wma.6.1576818859888; Thu, 19 Dec 2019 21:14:19 -0800 (PST) Received: from localhost.localdomain (cable-86-56-100-90.cust.telecolumbus.net. [86.56.100.90]) by smtp.gmail.com with ESMTPSA id j12sm8703863wrt.55.2019.12.19.21.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 21:14:19 -0800 (PST) From: sj38.park@gmail.com X-Google-Original-From: sjpark@amazon.de To: shuah@kernel.org Cc: brendanhiggins@google.com, corbet@lwn.net, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sj38.park@gmail.com, sjpark@amazon.com, sjpark@amazon.de Subject: [PATCH v7 2/6] kunit: Remove duplicated defconfig creation Date: Fri, 20 Dec 2019 05:14:04 +0000 Message-Id: <20191220051408.3591-3-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220051408.3591-1-sjpark@amazon.de> References: <20191220051408.3591-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: SeongJae Park '--defconfig' option is handled by the 'main() of the 'kunit.py' but again handled in following 'run_tests()'. This commit removes this duplicated handling of the option in the 'run_tests()'. Signed-off-by: SeongJae Park Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins --- tools/testing/kunit/kunit.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index efe06d621983..f8f26951cd1b 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -37,9 +37,6 @@ def create_default_kunitconfig(): def run_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitRequest) -> KunitResult: - if request.defconfig: - create_default_kunitconfig() - config_start = time.time() success = linux.build_reconfig(request.build_dir) config_end = time.time() From patchwork Fri Dec 20 05:14:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11304817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D217D109A for ; Fri, 20 Dec 2019 05:14:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B038624687 for ; Fri, 20 Dec 2019 05:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Oey+1Lh1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbfLTFOl (ORCPT ); Fri, 20 Dec 2019 00:14:41 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36936 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbfLTFOW (ORCPT ); Fri, 20 Dec 2019 00:14:22 -0500 Received: by mail-wm1-f67.google.com with SMTP id f129so7877238wmf.2; Thu, 19 Dec 2019 21:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yEihcqRjJqHrf9Dkz24+7uPB1xqJDuWaD0UNYMAzXH4=; b=Oey+1Lh1vua7bwuLqvnioSrUimFGSdjDvUm++wJZMdPMXLEFIb0HagR7AZ3NA7fmPV xA1hQH2L45QcmZOWSYJTcObaT4lLyLyqKN7YGRDluiqgm/ctu+5nZfD59tdB0SH/GZuZ m1iYChIarzCu99KU3wmasSMH4Q+AYmDYPZXK3EAiBd6KClkzu9Dy3LGlSOsAwlI6IVO5 0hAQx4On0+YPHrlOyaz3IoH1wTgMhzyNoHYsrTxkgfv2PsOeMh9+Oypwk/KSMwFzAjwz OIVtC+KRIKkDJnXweOZ0AaCsuf9/PtyLXlqsxC6crx8fODrTCR43uNt2b07nsmSgEF2F 4Y6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yEihcqRjJqHrf9Dkz24+7uPB1xqJDuWaD0UNYMAzXH4=; b=YjJ5+22AWCNBpa9BmClDHdbCEOd5rvSE2AhfaZsvIeuv2O2+rivUetTcC975ITS4Vm UzuO+w+l/C5hnEVGlC5RVkxX13uDrrPxMeWUsKeLA+eUttDiaBBRJ8nqDsJbCKCsv/Fz Rcg9G2Ng2FbfX4MiX2HYh8WEh6r5sCHHGnWnx1/zBwu2vkZigYxBXhJAiIo5VRdnL6OK /D5or8ueM2zOXY2WpKo8C35XrXFk9FXHaofJHT2+S8J4OOgt8zVTx3CtSnYcot8x91Pg VLFqCsg4OHm4Ae4Q0HslennsEwohpoU5zW/z08EC3pUTLgJoeBNdBhyIQq0LAqAeKz9a Gt8w== X-Gm-Message-State: APjAAAVluo1UcMUlb8sNSef3nDqHKaonYlIblE2rZwPfuoHY8oYStadV x2xVUzXMoziOlt/wkXdn4vM= X-Google-Smtp-Source: APXvYqygnBhWMk6eRkP7fEJeqrMQVSoKmmWXhGHJpnJdKEGFIcuWLPUEVGU0DCoNEjmFkykgGkUSFQ== X-Received: by 2002:a7b:c190:: with SMTP id y16mr14256880wmi.107.1576818861122; Thu, 19 Dec 2019 21:14:21 -0800 (PST) Received: from localhost.localdomain (cable-86-56-100-90.cust.telecolumbus.net. [86.56.100.90]) by smtp.gmail.com with ESMTPSA id j12sm8703863wrt.55.2019.12.19.21.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 21:14:20 -0800 (PST) From: sj38.park@gmail.com X-Google-Original-From: sjpark@amazon.de To: shuah@kernel.org Cc: brendanhiggins@google.com, corbet@lwn.net, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sj38.park@gmail.com, sjpark@amazon.com, sjpark@amazon.de Subject: [PATCH v7 3/6] kunit: Create default config in '--build_dir' Date: Fri, 20 Dec 2019 05:14:05 +0000 Message-Id: <20191220051408.3591-4-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220051408.3591-1-sjpark@amazon.de> References: <20191220051408.3591-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: SeongJae Park If both '--build_dir' and '--defconfig' are given, the handling of '--defconfig' ignores '--build_dir' option. This commit modifies the behavior to respect '--build_dir' option. Reported-by: Brendan Higgins Suggested-by: Brendan Higgins Signed-off-by: SeongJae Park Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins --- tools/testing/kunit/kunit.py | 11 +++++++++-- tools/testing/kunit/kunit_kernel.py | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index f8f26951cd1b..5b222418eacd 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -31,9 +31,9 @@ class KunitStatus(Enum): TEST_FAILURE = auto() def create_default_kunitconfig(): - if not os.path.exists(kunit_kernel.KUNITCONFIG_PATH): + if not os.path.exists(kunit_kernel.kunitconfig_path): shutil.copyfile('arch/um/configs/kunit_defconfig', - kunit_kernel.KUNITCONFIG_PATH) + kunit_kernel.kunitconfig_path) def run_tests(linux: kunit_kernel.LinuxSourceTree, request: KunitRequest) -> KunitResult: @@ -114,6 +114,13 @@ def main(argv, linux=None): cli_args = parser.parse_args(argv) if cli_args.subcommand == 'run': + if cli_args.build_dir: + if not os.path.exists(cli_args.build_dir): + os.mkdir(cli_args.build_dir) + kunit_kernel.kunitconfig_path = os.path.join( + cli_args.build_dir, + kunit_kernel.kunitconfig_path) + if cli_args.defconfig: create_default_kunitconfig() diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index bf3876835331..c04a12e2f711 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -14,7 +14,7 @@ import os import kunit_config KCONFIG_PATH = '.config' -KUNITCONFIG_PATH = 'kunitconfig' +kunitconfig_path = 'kunitconfig' class ConfigError(Exception): """Represents an error trying to configure the Linux kernel.""" @@ -82,7 +82,7 @@ class LinuxSourceTree(object): def __init__(self): self._kconfig = kunit_config.Kconfig() - self._kconfig.read_from_file(KUNITCONFIG_PATH) + self._kconfig.read_from_file(kunitconfig_path) self._ops = LinuxSourceTreeOperations() def clean(self): From patchwork Fri Dec 20 05:14:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11304819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96957109A for ; Fri, 20 Dec 2019 05:14:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73C9224688 for ; Fri, 20 Dec 2019 05:14:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iDO3yFxx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727378AbfLTFOl (ORCPT ); Fri, 20 Dec 2019 00:14:41 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46327 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727201AbfLTFOY (ORCPT ); Fri, 20 Dec 2019 00:14:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id z7so8094346wrl.13; Thu, 19 Dec 2019 21:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tsoM+tENaiFBqsqZQ09FDA9C5Ccx/Wof1Q5+yXLoE5Y=; b=iDO3yFxxCOo8POg0aFkAFvfoNDhtjvMJFMaj9+uqvzl4IgLx5GGs1QW51zl0EURVqP 8nwdXuIQhdDjwrMPq43HuJ7f0dhKm4xITkc2NSXPd+zVI96Df3RmhY68ZDvSJ0UFjqNs +0RPbokS2VSMmSrlLz3pcOYTneQY/9CFciQ/4JcJYucW1QlJVzX1FdG5GkMVaBsFyOeU QzuREpEv6lLEVDWY2tH+ui+umv6mIsQe5JIY4t+yINpONTi5Pj33/+HDtJKgYWDmnRn3 dzWhGlZcpwoXDxK6r9AH/2KkflYwYXKVMbVt5KVIx+Q8UtrjtvlA5zxb5GjFFk7dfnPT KGew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tsoM+tENaiFBqsqZQ09FDA9C5Ccx/Wof1Q5+yXLoE5Y=; b=ulKl2IT+xT5bfVtRMEaunsq6AGEy8+pbVnMUc0LCoHf6WX7FIvA6AuYNBSWKorMPRc HbWzzBrdNL5VTLcvEHgX26t+XERuL06EKWQ/MT0ZuELAPvyziqTDv1yZdsJ+bjV6w0+L +gdaieZtcy23CDtU9zN0IoMdAju+sDJbg8tfxU/4p0R68XJpBQ2Hgv3or/xtRchzK2rx 45h66Wxe5C3xHpkXvf1w1g7KDxSd+T5Mgs3/aMYiBxTLr3LBZ2gI+wb+frCLZuz91euu Fa7XlfVLKg+Gf9zFbkDuL/4/YUGphI1QEXkOOxZ0M17sLawA+dIGDE9gPVpDNhvrizEZ 0cQw== X-Gm-Message-State: APjAAAVCTflxZle0iaO8d20uIXgIQWpRVbBTRLVipeHhWKMYKaTOB8E6 pJu77upHxh0vYIdsUYKvo8nGgIVZ X-Google-Smtp-Source: APXvYqwhKvQyCeqRH856GG4jVzX/chAb6GCO6SK9wi0Gwf4bHpFjmSwt3YAEys0Hoc9rUU43wZnilg== X-Received: by 2002:a5d:690e:: with SMTP id t14mr12921320wru.65.1576818862279; Thu, 19 Dec 2019 21:14:22 -0800 (PST) Received: from localhost.localdomain (cable-86-56-100-90.cust.telecolumbus.net. [86.56.100.90]) by smtp.gmail.com with ESMTPSA id j12sm8703863wrt.55.2019.12.19.21.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 21:14:21 -0800 (PST) From: sj38.park@gmail.com X-Google-Original-From: sjpark@amazon.de To: shuah@kernel.org Cc: brendanhiggins@google.com, corbet@lwn.net, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sj38.park@gmail.com, sjpark@amazon.com, sjpark@amazon.de Subject: [PATCH v7 4/6] kunit: Place 'test.log' under the 'build_dir' Date: Fri, 20 Dec 2019 05:14:06 +0000 Message-Id: <20191220051408.3591-5-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220051408.3591-1-sjpark@amazon.de> References: <20191220051408.3591-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: SeongJae Park 'kunit' writes the 'test.log' under the kernel source directory even though a 'build_dir' option is given. As users who use the option might expect the outputs to be placed under the specified directory, this commit modifies the logic to write the log file under the 'build_dir'. Signed-off-by: SeongJae Park Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins --- tools/testing/kunit/kunit.py | 2 +- tools/testing/kunit/kunit_kernel.py | 4 ++-- tools/testing/kunit/kunit_tool_test.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index 5b222418eacd..e4250c4b06fb 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -105,7 +105,7 @@ def main(argv, linux=None): run_parser.add_argument('--build_dir', help='As in the make command, it specifies the build ' 'directory.', - type=str, default=None, metavar='build_dir') + type=str, default='', metavar='build_dir') run_parser.add_argument('--defconfig', help='Uses a default kunitconfig.', diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index c04a12e2f711..a10c0c787bc1 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -140,10 +140,10 @@ class LinuxSourceTree(object): return False return True - def run_kernel(self, args=[], timeout=None, build_dir=None): + def run_kernel(self, args=[], timeout=None, build_dir=''): args.extend(['mem=256M']) process = self._ops.linux_bin(args, timeout, build_dir) - with open('test.log', 'w') as f: + with open(os.path.join(build_dir, 'test.log'), 'w') as f: for line in process.stdout: f.write(line.rstrip().decode('ascii') + '\n') yield line.rstrip().decode('ascii') diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index a2a8ea6beae3..22f16e66b3c1 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -199,7 +199,7 @@ class KUnitMainTest(unittest.TestCase): timeout = 3453 kunit.main(['run', '--timeout', str(timeout)], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 1 - self.linux_source_mock.run_kernel.assert_called_once_with(build_dir=None, timeout=timeout) + self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout) self.print_mock.assert_any_call(StrContains('Testing complete.')) if __name__ == '__main__': From patchwork Fri Dec 20 05:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11304811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F629109A for ; Fri, 20 Dec 2019 05:14:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D1C024680 for ; Fri, 20 Dec 2019 05:14:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IVWfBjRJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725874AbfLTFO1 (ORCPT ); Fri, 20 Dec 2019 00:14:27 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34844 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727229AbfLTFOZ (ORCPT ); Fri, 20 Dec 2019 00:14:25 -0500 Received: by mail-wr1-f65.google.com with SMTP id g17so8154899wro.2; Thu, 19 Dec 2019 21:14:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=inbP6pGKtJxItdKOeeuDolxjjunfcHjYuKaxBqpxDrE=; b=IVWfBjRJRqaIGCacBEb+txUGuYGchEc3SzdoOwUuW4r4HzAzPgRYpIzG7vjyVGxLwK wwTH0nM3J2KCGbCnpq0+nBO0xNfwjK/yDSBETHIs40P6rK5vkDaC/NLojfesofJTL/lS WjL2w3AttGgKAFRIDP8VbkpDZwWBHgSFVQHIo3jKmFhe/cXj4tUvfRPTurZt5oY+sQqU 8bBkodbhLWPNPykLOi3v10kjkoFe37f35Gf3NGHFJ+8oL3zck7DV3VnY01ppqhVT+B45 iXVKzMSGdGgyZem3A/6FwuCk2ddb70RJgRgO6mop9CETKXkwApPXcwMZXZyt8PbGvOe1 WsVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=inbP6pGKtJxItdKOeeuDolxjjunfcHjYuKaxBqpxDrE=; b=t1xaIBGyA6Z17ElKBKavr+4iPGmYgDECDIQL6rL+uapi3LXDVWciqKP3DWfOakwnov hJg3RcNedmEWF/rDQLR5Kdb0Xi79ycGDqsAsVso3siLOHFh1JOAWlxbh0ZkITIhb+FXI h44eLtJ56yJacqHEmOyxcmOsZtx4Pa8sxIMxk+xOC+Wl4G3hfCF+QJD+mwSJsMs+o4pL 6JlnTUBfnCNMq2TbVSetrGsPIMO4uCUiqRTQmeT23QuPZmRcO9nxNgakP1dXPB+adBtI WUHbwd+FTOhy8NRAaJ6OqexZScixilT+7Jug9LEhE4jWyPBidFwhvH/Ki/eC2rKFq2wU 8vPg== X-Gm-Message-State: APjAAAXuJA8QRSfrjTE8c995dSluFsIOB4SZC9e5CN0bOW8HNaBytqAV 4TCfk8hjFdaAf+rpWAY8byk= X-Google-Smtp-Source: APXvYqxfFKBom/UlscLNj/eyveSar2ly0Z+JmQKMrrOd6TKgCR6aBNnyx3dPWgaNrdfsG6pVoEgW0A== X-Received: by 2002:adf:fd84:: with SMTP id d4mr13025748wrr.211.1576818863463; Thu, 19 Dec 2019 21:14:23 -0800 (PST) Received: from localhost.localdomain (cable-86-56-100-90.cust.telecolumbus.net. [86.56.100.90]) by smtp.gmail.com with ESMTPSA id j12sm8703863wrt.55.2019.12.19.21.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 21:14:22 -0800 (PST) From: sj38.park@gmail.com X-Google-Original-From: sjpark@amazon.de To: shuah@kernel.org Cc: brendanhiggins@google.com, corbet@lwn.net, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sj38.park@gmail.com, sjpark@amazon.com, sjpark@amazon.de Subject: [PATCH v7 5/6] kunit: Rename 'kunitconfig' to '.kunitconfig' Date: Fri, 20 Dec 2019 05:14:07 +0000 Message-Id: <20191220051408.3591-6-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220051408.3591-1-sjpark@amazon.de> References: <20191220051408.3591-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: SeongJae Park This commit renames 'kunitconfig' to '.kunitconfig' so that it can be automatically ignored by git and do not disturb people who want to type 'kernel/' by pressing only the 'k' and then 'tab' key. Signed-off-by: SeongJae Park Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins --- Documentation/dev-tools/kunit/start.rst | 12 +++++------- tools/testing/kunit/kunit.py | 2 +- tools/testing/kunit/kunit_kernel.py | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst index d5197f1a45cb..4e1d24db6b13 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -24,18 +24,16 @@ The wrapper can be run with: For more information on this wrapper (also called kunit_tool) checkout the :doc:`kunit-tool` page. -Creating a kunitconfig -====================== +Creating a .kunitconfig +======================= The Python script is a thin wrapper around Kbuild. As such, it needs to be -configured with a ``kunitconfig`` file. This file essentially contains the +configured with a ``.kunitconfig`` file. This file essentially contains the regular Kernel config, with the specific test targets as well. .. code-block:: bash cd $PATH_TO_LINUX_REPO - cp arch/um/configs/kunit_defconfig kunitconfig - -You may want to add kunitconfig to your local gitignore. + cp arch/um/configs/kunit_defconfig .kunitconfig Verifying KUnit Works --------------------- @@ -150,7 +148,7 @@ and the following to ``drivers/misc/Makefile``: obj-$(CONFIG_MISC_EXAMPLE_TEST) += example-test.o -Now add it to your ``kunitconfig``: +Now add it to your ``.kunitconfig``: .. code-block:: none diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index e4250c4b06fb..e59eb9e7f923 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -108,7 +108,7 @@ def main(argv, linux=None): type=str, default='', metavar='build_dir') run_parser.add_argument('--defconfig', - help='Uses a default kunitconfig.', + help='Uses a default .kunitconfig.', action='store_true') cli_args = parser.parse_args(argv) diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index a10c0c787bc1..cc5d844ecca1 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -14,7 +14,7 @@ import os import kunit_config KCONFIG_PATH = '.config' -kunitconfig_path = 'kunitconfig' +kunitconfig_path = '.kunitconfig' class ConfigError(Exception): """Represents an error trying to configure the Linux kernel.""" @@ -111,7 +111,7 @@ class LinuxSourceTree(object): return True def build_reconfig(self, build_dir): - """Creates a new .config if it is not a subset of the kunitconfig.""" + """Creates a new .config if it is not a subset of the .kunitconfig.""" kconfig_path = get_kconfig_path(build_dir) if os.path.exists(kconfig_path): existing_kconfig = kunit_config.Kconfig() From patchwork Fri Dec 20 05:14:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11304813 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C60E13A4 for ; Fri, 20 Dec 2019 05:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A48024680 for ; Fri, 20 Dec 2019 05:14:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CPvicxW9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727283AbfLTFOb (ORCPT ); Fri, 20 Dec 2019 00:14:31 -0500 Received: from mail-wr1-f41.google.com ([209.85.221.41]:41335 "EHLO mail-wr1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727235AbfLTFO0 (ORCPT ); Fri, 20 Dec 2019 00:14:26 -0500 Received: by mail-wr1-f41.google.com with SMTP id c9so8136500wrw.8; Thu, 19 Dec 2019 21:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wvc6mp8TpYnIrD2kv/SKRsGHLV9BbyYFN352NxRckX0=; b=CPvicxW9ofjoU9RfDadM9o6pV/o7TIeOb7amdLqoW7zVXt7a8iWmfEw/USKNBoLotT SN6+a8nBjwd9H3rD14fcR2In5tc+SyPy0m+Wit28PlEJ+B7shdkrizIfKNXkI1RF/dSp bkRxZbMUQEkVfJ/XTsbt15fMvuaq8AycVp2RG8wTeuAyo5vzLhXvDY32QLRhdwkQtrAY B/kEaxyXDrCj+HmlgPq7Tr99t5dpXl600taZWePd+7KB8CHfiPGSJVeN8sHMxzjEDyW4 bjPYSy3141YPvyBLFYMWXEe66kZ+aA/TX72hikxnDbaN0VSivx3/vXh7nEByqZqyFGdt oMJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wvc6mp8TpYnIrD2kv/SKRsGHLV9BbyYFN352NxRckX0=; b=e5ruXRYFG/wP1HDCqnHLgrQMdpav0CxOMKJtk/qa+kb5HDi3EOjH7Ozb10bLe3l9+M IczuZ1fuCjztCAz5EE0onu1XBjJS5V88QqPQrfEL0ItRrmJWPMrS7kHem/24H4+p747g 9HJY/ixe0Z1FJLMDjA0uiE08I/xu5Ogr6xx/8zgx9FzGOXXE1JwEfgwTQj/WPqzWk4r/ 9QGtLUqjYe+IAQaNhARbDIXfPFxaTtxyJ47MYB/YRYyhRDMPfn2l7/ppBjmgRpEQzXV9 bKpx6R6AsEiCsWm9UiT7ETM6wLzab3oDEV6dHJUmTLYAqvWP7ays4rOitD/VKD1zWD81 3inA== X-Gm-Message-State: APjAAAV+aF8woP4JQzCj+Rq9NKsPxBOxiPpMM8k3sHkk7a2bhaGrQ/8x +1w6gtpeDrPUqmCOIQXXixY= X-Google-Smtp-Source: APXvYqxBnPAvPA9JEkJThZNdOy1K1asm1Hw77D3N+Npjpi6OIwkyCiYRLJzJXr9mB0JzRciXSaLOBw== X-Received: by 2002:a5d:4984:: with SMTP id r4mr12462934wrq.137.1576818864742; Thu, 19 Dec 2019 21:14:24 -0800 (PST) Received: from localhost.localdomain (cable-86-56-100-90.cust.telecolumbus.net. [86.56.100.90]) by smtp.gmail.com with ESMTPSA id j12sm8703863wrt.55.2019.12.19.21.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 21:14:24 -0800 (PST) From: sj38.park@gmail.com X-Google-Original-From: sjpark@amazon.de To: shuah@kernel.org Cc: brendanhiggins@google.com, corbet@lwn.net, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sj38.park@gmail.com, sjpark@amazon.com, sjpark@amazon.de Subject: [PATCH v7 6/6] kunit/kunit_tool_test: Test '--build_dir' option run Date: Fri, 20 Dec 2019 05:14:08 +0000 Message-Id: <20191220051408.3591-7-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220051408.3591-1-sjpark@amazon.de> References: <20191220051408.3591-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: SeongJae Park This commit adds kunit tool test for the '--build_dir' option. Signed-off-by: SeongJae Park Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins --- tools/testing/kunit/kunit_tool_test.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 22f16e66b3c1..cba97756ac4a 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -174,6 +174,7 @@ class KUnitMainTest(unittest.TestCase): kunit.main(['run'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 1 assert self.linux_source_mock.run_kernel.call_count == 1 + self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=300) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_passes_args_fail(self): @@ -202,5 +203,12 @@ class KUnitMainTest(unittest.TestCase): self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout) self.print_mock.assert_any_call(StrContains('Testing complete.')) + def test_run_builddir(self): + build_dir = '.kunit' + kunit.main(['run', '--build_dir', build_dir], self.linux_source_mock) + assert self.linux_source_mock.build_reconfig.call_count == 1 + self.linux_source_mock.run_kernel.assert_called_once_with(build_dir=build_dir, timeout=300) + self.print_mock.assert_any_call(StrContains('Testing complete.')) + if __name__ == '__main__': unittest.main()