From patchwork Thu Dec 5 09:34:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11274443 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 EC11A112B for ; Thu, 5 Dec 2019 09:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB22924651 for ; Thu, 5 Dec 2019 09:35:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="omFIz3tm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728991AbfLEJfQ (ORCPT ); Thu, 5 Dec 2019 04:35:16 -0500 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:18371 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbfLEJfQ (ORCPT ); Thu, 5 Dec 2019 04:35:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575538516; x=1607074516; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=9ZbP6djXj6aBTAcsUIDjFweVfXJf8GOq+UwZ+M2/ok0=; b=omFIz3tmw6ZhTpk87XsKOAsDaWX9ZGcSH+cEsKH9mVlnPDI00pUTgtJ7 ChyMG/X6X6+AqvAV+8v5nTF1O/DSLWww5xVdAM1ibr4O9k3ujd/+560IU V083g2hQwYEf72ZcsIkyc2z+rVzNEDnxHmDwCz2vZcVKpzgvcVJLuDumS U=; IronPort-SDR: SUWJGRidlohcfSvWgzjX7YQkahommtqbg1ZrTHWFhc8y+AaYOo4ub/CbTECP+p1aH/9cZqgmek 8NYx2NAaT9Jg== X-IronPort-AV: E=Sophos;i="5.69,280,1571702400"; d="scan'208";a="11769853" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 05 Dec 2019 09:35:05 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 941D51A1F0C; Thu, 5 Dec 2019 09:35:03 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:02 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.180) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:34:58 +0000 From: SeongJae Park To: CC: , , , , , , , Subject: [PATCH v5 1/6] docs/kunit/start: Use in-tree 'kunit_defconfig' Date: Thu, 5 Dec 2019 10:34:35 +0100 Message-ID: <20191205093440.21824-2-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205093440.21824-1-sjpark@amazon.com> References: <20191205093440.21824-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.180] X-ClientProxiedBy: EX13D23UWC001.ant.amazon.com (10.43.162.196) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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 --- 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 aeeddfafeea2..78a0aed4931d 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -29,9 +29,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 5 09:34:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11274445 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 3514E930 for ; Thu, 5 Dec 2019 09:35:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 125BC2464F for ; Thu, 5 Dec 2019 09:35:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="e8tPWM6y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbfLEJfV (ORCPT ); Thu, 5 Dec 2019 04:35:21 -0500 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:37911 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728932AbfLEJfV (ORCPT ); Thu, 5 Dec 2019 04:35:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575538521; x=1607074521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=2/aNhSLU5O/S7NLog7ZszXLsCI7nZNsLq9HwXG0KqJ0=; b=e8tPWM6yyluCQqvO108R3SI0skKBUAZs/cPoJSCoLY2Ra4zYdl60vuod TehITpStTiKG14XamjuXTRpkN2WKTTsJqLWgydZoOWh15Nt8WvlGrh31O G96TbMQkAajSsAy+dYJSVM5m8RH6eI3D4xqNfR7dD1XjUyS32Ja04uTzZ 8=; IronPort-SDR: 9hHbSPSv5WqiZUROjP5wnDBfj6jCP3dDx1AdxVgY+8lMmOy+SoMxBtooMh1/Ti8k7zpMkmwyXT az45GlSF0iIw== X-IronPort-AV: E=Sophos;i="5.69,280,1571702400"; d="scan'208";a="3361121" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-8549039f.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 05 Dec 2019 09:35:08 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-8549039f.us-west-2.amazon.com (Postfix) with ESMTPS id 3A24EA1EBC; Thu, 5 Dec 2019 09:35:07 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:06 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.180) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:02 +0000 From: SeongJae Park To: CC: , , , , , , , Subject: [PATCH v5 2/6] kunit: Remove duplicated defconfig creation Date: Thu, 5 Dec 2019 10:34:36 +0100 Message-ID: <20191205093440.21824-3-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205093440.21824-1-sjpark@amazon.com> References: <20191205093440.21824-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.180] X-ClientProxiedBy: EX13D23UWC001.ant.amazon.com (10.43.162.196) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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 --- 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 5 09:34:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11274447 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 E2DE2930 for ; Thu, 5 Dec 2019 09:35:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C15D524651 for ; Thu, 5 Dec 2019 09:35:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="TkpWvto5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729236AbfLEJfZ (ORCPT ); Thu, 5 Dec 2019 04:35:25 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:58899 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728932AbfLEJfY (ORCPT ); Thu, 5 Dec 2019 04:35:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575538524; x=1607074524; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=izpxlTvHNZyly8edWZMrhdJhAamFfzshXPvgfM3Kj4U=; b=TkpWvto5hXIllKVe1lT6m2ZdvIaH4W0DxLvWHZscB+0ixMhOg1PZPC+1 dqcRbe3qGcbnpBi2PH3nkClwissPIqcZBRWlU+WETGcLGMbjvTBqsGs6m +jpdaAQ4EudJTEDucOYHWSnJopHcpQU5FjNGrjbpw6tA44W61jmdzSoQN o=; IronPort-SDR: v85zXu7SLzuj5MP+YdOZ2wfxFbQJ83KysH1M59YDzp63PhEEj3RSG2TjYbwoZYMlruGPmJovGR PEOoxtGjd4bw== X-IronPort-AV: E=Sophos;i="5.69,280,1571702400"; d="scan'208";a="13144399" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2c-397e131e.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 05 Dec 2019 09:35:12 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2c-397e131e.us-west-2.amazon.com (Postfix) with ESMTPS id 5F253A21C5; Thu, 5 Dec 2019 09:35:11 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:10 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.180) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:06 +0000 From: SeongJae Park To: CC: , , , , , , , Subject: [PATCH v5 3/6] kunit: Create default config in '--build_dir' Date: Thu, 5 Dec 2019 10:34:37 +0100 Message-ID: <20191205093440.21824-4-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205093440.21824-1-sjpark@amazon.com> References: <20191205093440.21824-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.180] X-ClientProxiedBy: EX13D23UWC001.ant.amazon.com (10.43.162.196) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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. Signed-off-by: SeongJae Park Suggested-by: Brendan Higgins Reported-by: Brendan Higgins 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 5 09:34:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11274449 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 03355112B for ; Thu, 5 Dec 2019 09:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D50902464F for ; Thu, 5 Dec 2019 09:35:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="Ck8gzm/n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729185AbfLEJfU (ORCPT ); Thu, 5 Dec 2019 04:35:20 -0500 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:37911 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729184AbfLEJfT (ORCPT ); Thu, 5 Dec 2019 04:35:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575538519; x=1607074519; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=RrthRCcMi+yKCvsOW6MQckhRdJwt49061MYJsENxmg0=; b=Ck8gzm/nF5IPZB6tcKCZPHmQDGlMT+Utjfy/7XJ32i6ifx70s/OuRFLw J8FXeSoinf6xMiSvKo6Rxh2pbWLYcgSpTe+tKbZEAquLiW5NBcrssv70e hxeM1lGO5tbhWpq+qKXx+yh/+f/z5+dxaZ31AydR+V08/+iXJXTg0judR 8=; IronPort-SDR: FkPH8b9QKu8gqn9J9kTgX0/zpN2AED6j7jB11vwU/AlJezZBHsFwiZP8OttdA+jJSB5+IvpyhJ TVfh4gOLFj6Q== X-IronPort-AV: E=Sophos;i="5.69,280,1571702400"; d="scan'208";a="3361142" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 05 Dec 2019 09:35:16 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id 4F51FA2024; Thu, 5 Dec 2019 09:35:15 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:14 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.180) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:35:10 +0000 From: SeongJae Park To: CC: , , , , , , , Subject: [PATCH v5 4/6] kunit: Place 'test.log' under the 'build_dir' Date: Thu, 5 Dec 2019 10:34:38 +0100 Message-ID: <20191205093440.21824-5-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205093440.21824-1-sjpark@amazon.com> References: <20191205093440.21824-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.180] X-ClientProxiedBy: EX13D23UWC001.ant.amazon.com (10.43.162.196) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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 Thu Dec 5 09:38: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: 11274467 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 2236E930 for ; Thu, 5 Dec 2019 09:38:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 002D324653 for ; Thu, 5 Dec 2019 09:38:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="iBRom0py" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729356AbfLEJi2 (ORCPT ); Thu, 5 Dec 2019 04:38:28 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:55620 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729329AbfLEJi1 (ORCPT ); Thu, 5 Dec 2019 04:38:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575538707; x=1607074707; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=fr4yypOIlHXyvtCM/n2iJREFkZT+H434dWtQtuRZ8lE=; b=iBRom0py9Lxpg4ZtPGriSpwAeLyTC/Npt7y1eC/ll90ISL0jPt1i0SGS DDLupUloKohD26Si8bdYACYzyHjsCIi0XQuAXivAvjKVRf1gznWj7yBvZ exHKx6/V+HwHS+nggtYt28RmMil5ceKFUlFucBi6TFxng8heYI5ePYixl U=; IronPort-SDR: vwKxWpcdIIVEqDKGrA9mACVxdY61nw41IgJp6+LUNLcbBhGIGYI+f9MOgu0jtgicNJAkwvIVne 47fkuN3rxT7Q== X-IronPort-AV: E=Sophos;i="5.69,280,1571702400"; d="scan'208";a="7181764" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 05 Dec 2019 09:38:26 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com (Postfix) with ESMTPS id 527B7A065C; Thu, 5 Dec 2019 09:38:24 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:38:23 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.249) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:38:19 +0000 From: SeongJae Park To: CC: , , , , , , , Subject: [PATCH v5 5/6] kunit: Rename 'kunitconfig' to '.kunitconfig' Date: Thu, 5 Dec 2019 10:38:04 +0100 Message-ID: <20191205093804.22802-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205093440.21824-1-sjpark@amazon.com> References: <20191205093440.21824-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.162.249] X-ClientProxiedBy: EX13D35UWC002.ant.amazon.com (10.43.162.218) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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 --- 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 78a0aed4931d..faa6fa99f903 100644 --- a/Documentation/dev-tools/kunit/start.rst +++ b/Documentation/dev-tools/kunit/start.rst @@ -21,18 +21,16 @@ The wrapper can be run with: ./tools/testing/kunit/kunit.py run -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 --------------------- @@ -147,7 +145,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 5 09:38:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11274491 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 417C0139A for ; Thu, 5 Dec 2019 09:38:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F2562464E for ; Thu, 5 Dec 2019 09:38:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="ECN7i7g0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729018AbfLEJiz (ORCPT ); Thu, 5 Dec 2019 04:38:55 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:55684 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728707AbfLEJiw (ORCPT ); Thu, 5 Dec 2019 04:38:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575538733; x=1607074733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=MiFuavq5Qnjsk7KrDh/upooxJoiEUmzFTrl7IlXIUqw=; b=ECN7i7g06pIiVPa7rsFuPX36xqd/va0c5Jap2E5+owf+j/KcMWwD+vZI /h1ubV2jcp88QSsYxCL72+aokNrV2SgfxcTZkzQqWq77Z6RA+BtOlbrun ei++Bo4XnIdhSbRkA+hBLNTbJ7qrvYY/BvXRoHIrwUAl9XBkj9Dq6bBN+ g=; IronPort-SDR: 5PPOhAW7haH6EKJQEUeZiV1/p09w4tUcgXN3MGy0udA95frYz634gZcjrchm6JYYI7SstiQM18 XnmLmRmNJvkw== X-IronPort-AV: E=Sophos;i="5.69,280,1571702400"; d="scan'208";a="7181812" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-8549039f.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 05 Dec 2019 09:38:52 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-8549039f.us-west-2.amazon.com (Postfix) with ESMTPS id 1A82FA1E55; Thu, 5 Dec 2019 09:38:50 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:38:49 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.100) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 5 Dec 2019 09:38:45 +0000 From: SeongJae Park To: CC: , , , , , , , Subject: [PATCH v5 6/6] kunit/kunit_tool_test: Test '--build_dir' option run Date: Thu, 5 Dec 2019 10:38:31 +0100 Message-ID: <20191205093831.22925-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205093440.21824-1-sjpark@amazon.com> References: <20191205093440.21824-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.100] X-ClientProxiedBy: EX13D05UWC003.ant.amazon.com (10.43.162.226) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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()