From patchwork Thu Dec 12 02:27: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: 11286777 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 BDBB314E3 for ; Thu, 12 Dec 2019 02:27:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C310214D8 for ; Thu, 12 Dec 2019 02:27:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XQIaEQxp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727753AbfLLC1Z (ORCPT ); Wed, 11 Dec 2019 21:27:25 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38588 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726793AbfLLC1X (ORCPT ); Wed, 11 Dec 2019 21:27:23 -0500 Received: by mail-pg1-f196.google.com with SMTP id a33so328972pgm.5; Wed, 11 Dec 2019 18:27: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=tTHS0sAFW9uPlD+AqCNYpUarFLmjwnHqD++0UeSB8hU=; b=XQIaEQxpgLBwXmiYR6pgGNgeFnutK6DCycup5orLwxibF5fYc8fMjIopR0VkLtgggt KjI5/JWB4bKTxcALCb0rHq8otftnAoxoX3n1GDzGxeu3qVIhu7QuYyv2+Mwp2Bry6GYp tRsT+zld0GfIWiO585WuHZA0454yZ0ZgGJs/DWoR+s5cSUaAki86/LKYI3WY7ujV5P/y 9LeYFUV9ZeR9kqCSfnsA79SVQeHOXx76+b6UUG0MNWlaw0UIpoGkWr+D4dtHkDbATWE3 HIVIstSxVNQmlB/Xw2ipNa0QI8nimIhCOcMYDhKRxqwf7ry9yk2vEb1cZsQCX7t9K0N3 6tng== 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=tTHS0sAFW9uPlD+AqCNYpUarFLmjwnHqD++0UeSB8hU=; b=PmNkLtEK1wXiG9Ar5308zA+N2V4zsvWXX4rOjIJQY4VOKce84v5ekDAZtxudP8JQ/K /3IL0eP+h0CSK/6erqWqcaFMUO02Cf3aoiGK3yUR5xXSh7Z2CSeM5LoM2QbxT8MeVBY7 FZ7l+S9qPwNbcpy/UKyd53lxbYL+BneIK12NzKBFznXCKJxSsMrLfNkFySRNKFD/SS5B 1rdn0YP1r04A0Lko2xmT7XVSF7c+BiIVKCWGlaxZI9xU8mbALVkyT+/XdH6Cid5wE+lP wVUe1k5kEBPU8KJfO0G2HnPlqZVqu1jOmhvioqUiqojLrTip2ogiEmP5MN3q4zno4dVA eVdA== X-Gm-Message-State: APjAAAUdw+RywvLGleY/vTEJJRYf+nsqqzCKhLMazbcxoFQmnJQJHcKK 6gI4/CRuT7vbpef30i5Tibs= X-Google-Smtp-Source: APXvYqyxoOoOHx1Hg7FJQOpMCtLSu31I0G7JyqkADbCfGNxEQhYGyDSTVOGeuddMmJ2QYMjHO14sMA== X-Received: by 2002:a63:4f59:: with SMTP id p25mr7719374pgl.230.1576117642714; Wed, 11 Dec 2019 18:27:22 -0800 (PST) Received: from localhost.localdomain ([12.176.148.120]) by smtp.gmail.com with ESMTPSA id d22sm4245173pgg.52.2019.12.11.18.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 18:27:21 -0800 (PST) From: SeongJae Park X-Google-Original-From: SeongJae Park To: brendanhiggins@google.com, shuah@kernel.org Cc: sjpark@amazon.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.de Subject: [PATCH v6 1/6] docs/kunit/start: Use in-tree 'kunit_defconfig' Date: Thu, 12 Dec 2019 02:27:06 +0000 Message-Id: <20191212022711.10062-2-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212022711.10062-1-sjpark@amazon.de> References: <20191212022711.10062-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 Thu Dec 12 02:27: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: 11286775 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 EEE4314E3 for ; Thu, 12 Dec 2019 02:27:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CCEDC24653 for ; Thu, 12 Dec 2019 02:27:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M3TboQWY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727773AbfLLC1Z (ORCPT ); Wed, 11 Dec 2019 21:27:25 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35672 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727747AbfLLC1Z (ORCPT ); Wed, 11 Dec 2019 21:27:25 -0500 Received: by mail-pf1-f193.google.com with SMTP id b19so295568pfo.2; Wed, 11 Dec 2019 18:27: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=yFujqdF7KSTFJjQQeDlyK/5HsN3cecg9EghFg3vBGxk=; b=M3TboQWYgdcx0JYFTTeu3fEYtHLHJOQTYEYOvIZodI/Fpx4OVg++6DWa1usRfgvUso zYaHlPPD2LqSVzVn1P+ovu7s+EFLr+4sfQLPouxrsy+ujqGcnsPDPs50XFNucaCfYSJe /f7e3+e5KIdHRg9dxiaD0kv0PCHZVkw9Kwc8ViS0R0MdMARP+FHTNH0DMXxMUXBKAtQP FwAsVEhLBw3v7DBTpXwQWxlUTft2WlKvqaAzFM2HR3WO8d7BZe2ug9xvs2c+CXgGzycs nyQCQZaFFcEnO/IzlvFAEFqKEP99Ws/ftwy1lY/7LoHTri/2zBvNJQChDfdYe/16UHvH JO8w== 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=yFujqdF7KSTFJjQQeDlyK/5HsN3cecg9EghFg3vBGxk=; b=cFOgAh/paEfsTmJXZNxgLxhVbGzmzwKjE87teaHDctFUPJu5qKpJvMjIKGlML9Cf4W rxK77CXsjW9qJeoj/bA5BW1i3M0xTGu3kX1yTiYSB/r4CndaT6qfSGbTkiMN4W0AWExS pbJpcvX3EUXYhrKAU77Fl6f5FNCguztQ1QA/nLPD+KwXKURgi27Ci+D81kO/ud/cPYXs OJYg93bsfrgnoZOXGu5CtMYdkT8ifocCfZb579UQd5zqPAoiLvLSaQh1rQITW97f0/Hy GgWxtjyB0XZ+hO+wIrOM/LxUP+brZqedz3RM0qPf4Ozf4s0+nKnqwxSIV1IlRhwKbzjf siWw== X-Gm-Message-State: APjAAAXcukyn7kUiAKmao0bdg4Kc4X/cwaxEFcjNe9gkZLKQpD1J3j8g //uVRJKmzrc1qIbJxWDmXdA= X-Google-Smtp-Source: APXvYqxITzrasjB22U3/KJWgHX9aDzdbZHo1v+SvqYboBvMwPBgGHw4iXnCWwjsOooH1JKxY8VIlfA== X-Received: by 2002:a63:c406:: with SMTP id h6mr8035736pgd.213.1576117644144; Wed, 11 Dec 2019 18:27:24 -0800 (PST) Received: from localhost.localdomain ([12.176.148.120]) by smtp.gmail.com with ESMTPSA id d22sm4245173pgg.52.2019.12.11.18.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 18:27:23 -0800 (PST) From: SeongJae Park X-Google-Original-From: SeongJae Park To: brendanhiggins@google.com, shuah@kernel.org Cc: sjpark@amazon.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.de Subject: [PATCH v6 2/6] kunit: Remove duplicated defconfig creation Date: Thu, 12 Dec 2019 02:27:07 +0000 Message-Id: <20191212022711.10062-3-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212022711.10062-1-sjpark@amazon.de> References: <20191212022711.10062-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org '--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 Thu Dec 12 02:27: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: 11286767 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 8388F14E3 for ; Thu, 12 Dec 2019 02:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FF72214D8 for ; Thu, 12 Dec 2019 02:27:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IWjQO/l9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727796AbfLLC11 (ORCPT ); Wed, 11 Dec 2019 21:27:27 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41943 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727747AbfLLC10 (ORCPT ); Wed, 11 Dec 2019 21:27:26 -0500 Received: by mail-pl1-f194.google.com with SMTP id bd4so359022plb.8; Wed, 11 Dec 2019 18:27:26 -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=/DmT8fP3US2mNRD3KIo8GttDd8Q9fHyuiepw4gR6YTM=; b=IWjQO/l9nXA+wC1Ym8paKXg4dGklI6sUs1iXWfivJqky3o8bmn7PQtRDp70OMewQlt SUOdZn1Li9dh1zEjX8F0owKAjNZoQbF6WRl/zf2zFTa3eKOhKp1cQ+JHJaCWfRpswaG9 d3CR5SnOodSzgKW3jiN/5KzMgonhyDPHYgPkZdWR9sMh9XhAvILFzwxzeae8XVZBMW1S EdXBRpk7dZGvMvmUMRM+MMJ5fhzdEXptiWMkCYVm+RARmebz/xvFeoesFrywKvhgd7/E oz2r8O5g3iV2RCDrPYTbTytdd560pIf0p4picOrrjTfEzSvrFmPKj/gssVQoDzuVmIvs vHnQ== 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=/DmT8fP3US2mNRD3KIo8GttDd8Q9fHyuiepw4gR6YTM=; b=lApoQfe5VRfXEroDzq3DKZWCtOUVmXFyECLIXJSNpyQC+IH5WfdbenRSvhV+QLf6vf 3+5BbUtyfpBY8EOFUHxnlHm4STFf7TgXrh7C8Q6Z2aXVheGYNOZKL1pKI7uQUWAbnZAJ oWpekL1jAFH7ijjBcz5m6IioUivzC6bHWQjgCtVOU3Mxoz22Hc/+xebO7g8a+Zv+vWN7 aIiZYWDN4zwzpgM7Oi6/lJt766CVILZROa6picBlEgI7vbY4XcG07JSaa9E/nzZnH//W R8j1DsSFsfWj2bVhO+EvNugrvNuDQ2awu6LFj78VT6zhnVd4vQQ5X+TqJOo4d/rmauiO BFPQ== X-Gm-Message-State: APjAAAV0RFVr3LbvvsQywH7BOx5jhmE6d7GMCJg7Bru71Fqw0UVp5QLj oWfMFe0mP99rcG2Kz0JxwGs= X-Google-Smtp-Source: APXvYqwBumUYoleJ4JkKcZMjBqM+8PzAINuXP+9ZxfdCNfDzpF/L6otz74Q/se6CCbe/R5apuGhYmw== X-Received: by 2002:a17:902:ff10:: with SMTP id f16mr6938529plj.312.1576117645778; Wed, 11 Dec 2019 18:27:25 -0800 (PST) Received: from localhost.localdomain ([12.176.148.120]) by smtp.gmail.com with ESMTPSA id d22sm4245173pgg.52.2019.12.11.18.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 18:27:25 -0800 (PST) From: SeongJae Park X-Google-Original-From: SeongJae Park To: brendanhiggins@google.com, shuah@kernel.org Cc: sjpark@amazon.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.de Subject: [PATCH v6 3/6] kunit: Create default config in '--build_dir' Date: Thu, 12 Dec 2019 02:27:08 +0000 Message-Id: <20191212022711.10062-4-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212022711.10062-1-sjpark@amazon.de> References: <20191212022711.10062-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 Thu Dec 12 02:27:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11286773 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 B2F5E14BD for ; Thu, 12 Dec 2019 02:27:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91BAC214D8 for ; Thu, 12 Dec 2019 02:27:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q9g16o0t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727807AbfLLC12 (ORCPT ); Wed, 11 Dec 2019 21:27:28 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46316 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727804AbfLLC12 (ORCPT ); Wed, 11 Dec 2019 21:27:28 -0500 Received: by mail-pg1-f193.google.com with SMTP id z124so307659pgb.13; Wed, 11 Dec 2019 18:27:27 -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=CeHZmew+4fucmWx3flByYCHmWF3GN8c4eetw7jkXQA0=; b=q9g16o0tKc4t6Sf2qGrABEj2tsjyKw2fWr+zPrjkHOoFkt61yA6UumGtek0BqZ+6XC DN2/GPk7hySLkwmkmn9tdGbND5/+B7kdtl94GOfjUwIjqw7dTm7vVVRG1zsUZZb61rMR x9J+pWcIwyJ9cR8GlWeOBYZveVeKleVGi+gIHvBM1iyuS/jN6vB68ms2sdpbsaeZoi1p VMiw3lq6052q+Bbo+XJcm4s21WSnOrUg1M3GB06dQqP0OERgvcGpfx/3WKLPSv3f7b74 apbRtTOEsfJCk9gYhhGD0HzVSuGdXswX9Spn8LAZbisQGt3xtzNDYL5s5O22jtXKLjsO JbAQ== 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=CeHZmew+4fucmWx3flByYCHmWF3GN8c4eetw7jkXQA0=; b=OPMSrJGqPDLCISQJKPMycjGM0f4Lw29IdGFnr2/KhSHvHCG0bvqS1R3jpDLSLL2hqH npCsJTeSR7B8stF+3raLdtd3mVKHiVf0Jiu6wi4yZxJ99sLtIQgPxn8WUvQufumRaNXa TuLtAThuDfggOEm36I3xPiYx1tVX1zwOIOmrHgUrIJ9GnCvxIqP+WIfT1jnVj5B8Tm2E CyCbpc6O0yYWbPKMyg9WA/Gxy07BFz21u3tBHs+CJh+0KwBSYu4+X1oMAfEEScYOSuoK SOZfOaVUCg+fU+9ERowdDr5np6Y2lr1fe0fe0k0NsdnlFxMFuDhS6KjyjQjUpOGmt30B A7hg== X-Gm-Message-State: APjAAAU7lzLzdP8bs9Kbz5L0RlaTcyesugPRejeF8tTaEYRl/yjPDVTD Mp1z3eQs25Us2UYY8bR808U= X-Google-Smtp-Source: APXvYqxJCYQEx6W1kxgsuysVD7Wm5ZbigplWxVjd2E+9qLsnn/jK30+3uJ6y7AMTk5VZfPqthfyURQ== X-Received: by 2002:a63:a4b:: with SMTP id z11mr7526272pgk.97.1576117647259; Wed, 11 Dec 2019 18:27:27 -0800 (PST) Received: from localhost.localdomain ([12.176.148.120]) by smtp.gmail.com with ESMTPSA id d22sm4245173pgg.52.2019.12.11.18.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 18:27:26 -0800 (PST) From: SeongJae Park X-Google-Original-From: SeongJae Park To: brendanhiggins@google.com, shuah@kernel.org Cc: sjpark@amazon.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.de Subject: [PATCH v6 4/6] kunit: Place 'test.log' under the 'build_dir' Date: Thu, 12 Dec 2019 02:27:09 +0000 Message-Id: <20191212022711.10062-5-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212022711.10062-1-sjpark@amazon.de> References: <20191212022711.10062-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org '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 Thu Dec 12 02:27:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11286769 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 DF35414BD for ; Thu, 12 Dec 2019 02:27:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCAB52173E for ; Thu, 12 Dec 2019 02:27:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V4FaCyAt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbfLLC1c (ORCPT ); Wed, 11 Dec 2019 21:27:32 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35676 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727747AbfLLC13 (ORCPT ); Wed, 11 Dec 2019 21:27:29 -0500 Received: by mail-pf1-f194.google.com with SMTP id b19so295660pfo.2; Wed, 11 Dec 2019 18:27:29 -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=4gqvXa2BLZ9bvD5JyWPHEMSVSMpI1RHvNW+8EqyY50g=; b=V4FaCyAthEFgo31Ece9xJ8AvbqOnekpPHgQsN0IdDkZW9vve3CUcgJ+TeQegF9iXzX ta6V9aAPXxnGUz3mhmGXDjtveMsir9EhReVrLiXfwi2iqDtGesxYrGFfQpErfeTGnYbh +RARMa9IgZiN7hfKpn3zUWGrn8gdFCHT+hqx78hF0sswkuGuvcUmLVn388SP3po9JEIg KRUlx0pCEHPrPsEgqZZd6omBi412tWMcpGDDv82Ya4vcVi8sHjPB/wd4KzS1xY3QhhsA JMx8fRIv80BcdWROpTA4poKbIJu7nAuyDgyfw3sdWbf/69MU5VeGjILv4iX10hqbWH0e YM1w== 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=4gqvXa2BLZ9bvD5JyWPHEMSVSMpI1RHvNW+8EqyY50g=; b=cmwHxCRIf/YnqphNctfEi2Jk3CNNy2Bu28YFSnMNiC0Oe1Jhksi8mLbHlKAWGLqeqy RNYt3um63TQpMznS4u6MrfdKMuvKJPGt4FlCubBHBKkLDLZsNFFTVNsZkJ1tqPxuPz+l 7rFHj8fwDrJI107QQr0UoQn0eKXIi7EntO/IdTIzBtVxySX3sCwlYoQFZIUnp7Lti2gQ EDj0JWeBzY7YdFkGipsSGaoQzB7qd68bm6+GafimXUo7KDW/nYnizEaksISVDKB9IoTk X1p5aLvyNw2LpVdnyR8Hx/+z+JPf9m8K3XwoLCw2nwVM8242yrUi1IwsQWq01b5XtmV5 VgtQ== X-Gm-Message-State: APjAAAVovOzEBd50mmeYtCMToR+pDGKwZTC8Tw2hx9J1KR3/qRFy6b/C GjXJDUUDrtMv1FIruNrbUPI= X-Google-Smtp-Source: APXvYqw4GnTOvZB0ywYS9j3IZ2Et1I8n8/EDMGqwD17xKwhUzSk6mgFviVenbWI9Hv4xR93yWt7dyA== X-Received: by 2002:a63:8eca:: with SMTP id k193mr7748242pge.293.1576117648823; Wed, 11 Dec 2019 18:27:28 -0800 (PST) Received: from localhost.localdomain ([12.176.148.120]) by smtp.gmail.com with ESMTPSA id d22sm4245173pgg.52.2019.12.11.18.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 18:27:28 -0800 (PST) From: SeongJae Park X-Google-Original-From: SeongJae Park To: brendanhiggins@google.com, shuah@kernel.org Cc: sjpark@amazon.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.de Subject: [PATCH v6 5/6] kunit: Rename 'kunitconfig' to '.kunitconfig' Date: Thu, 12 Dec 2019 02:27:10 +0000 Message-Id: <20191212022711.10062-6-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212022711.10062-1-sjpark@amazon.de> References: <20191212022711.10062-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 Thu Dec 12 02:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11286771 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 9180F14BD for ; Thu, 12 Dec 2019 02:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BFDC2467C for ; Thu, 12 Dec 2019 02:27:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FJEuZsdm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727843AbfLLC1e (ORCPT ); Wed, 11 Dec 2019 21:27:34 -0500 Received: from mail-pj1-f49.google.com ([209.85.216.49]:36267 "EHLO mail-pj1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727804AbfLLC1b (ORCPT ); Wed, 11 Dec 2019 21:27:31 -0500 Received: by mail-pj1-f49.google.com with SMTP id n96so365760pjc.3; Wed, 11 Dec 2019 18:27:31 -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=Q9POWu9QQdjXlCxWsG8nhRyoRqIP2kXxcG0Qf/wCB4g=; b=FJEuZsdm7LU6Kc4mRJBTldlXcUWbi0J3FW0GL9IJjqw+Wnq/8dEun0vCvWz4vl3iab Fqq/sT9sQ37rX9j/JAClwVomNhzsmdL18W2jAgd+Rg6WWxpdAdw6UowLajZw37yYINwa tRGvDS6pvwvTU32QKheCTmuEowhOTLrU/PM5BnJP/FEEZ4lvHnOOgUyAhWS5NO9rzjqE ngkpugKR6Fygg0bMM7IKY4m6f2tSB1oAJ1MxffpkJUvZM/6X8ccNrDkXqQDsiwAqX4Ez 6Fa3zQIKWYUj4cdi+flr5uFZ+1ywX3u5nGBb/+9pyfM4bg5lsM+Q52vIomQlrUuxKi6F RavQ== 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=Q9POWu9QQdjXlCxWsG8nhRyoRqIP2kXxcG0Qf/wCB4g=; b=fGRws0n7g0BFZr7zHiEKQUriyLzkBbkFt66FQIc/WJCXkoEsdpulNOtNuVLYZhdsBz imxJM4zK15u1sQmNAME5J87aikjI4xmbC2Nv9RtCar0RGrkpI9ZQx2I0e4Yur4VGu9xx ZgQs8M463eEeDzQD3HkTm1TptEQDzHikhGInbjFqHPPnuwHfZsgCmc9xvthEoCb9gqfA QMInf/jbmaFokGoehfnKXwpvks4Fr4RZq9RW/GNe6sSaR4GYsgSmEzXjSTN4nSNrYkW0 +UZsBfPq5cZjfKhGpvybrM8UsdP4lkTKKNn/bkv13Ye6wka9Y6MkmHJWnXQTqtMuHgEk UNlg== X-Gm-Message-State: APjAAAU9Bslon9fm2Uc4+gFSVyULCgHjPod51JsG11gNQOaopAUkjCrt 8Vf1Mq4MAE9WOfVuwDEEqRQ= X-Google-Smtp-Source: APXvYqxFh2T30aiJVZrwFJ4fg7UgrXfuNRbuhdW/gGfmdLi9B8wfIypK0Lxnv4bPvyGHXFEGZPL/Rw== X-Received: by 2002:a17:902:848a:: with SMTP id c10mr6348557plo.209.1576117650497; Wed, 11 Dec 2019 18:27:30 -0800 (PST) Received: from localhost.localdomain ([12.176.148.120]) by smtp.gmail.com with ESMTPSA id d22sm4245173pgg.52.2019.12.11.18.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 18:27:29 -0800 (PST) From: SeongJae Park X-Google-Original-From: SeongJae Park To: brendanhiggins@google.com, shuah@kernel.org Cc: sjpark@amazon.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.de Subject: [PATCH v6 6/6] kunit/kunit_tool_test: Test '--build_dir' option run Date: Thu, 12 Dec 2019 02:27:11 +0000 Message-Id: <20191212022711.10062-7-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212022711.10062-1-sjpark@amazon.de> References: <20191212022711.10062-1-sjpark@amazon.de> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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()