From patchwork Tue Jul 14 20:41:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Higgins X-Patchwork-Id: 11663541 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 C157960D for ; Tue, 14 Jul 2020 20:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7E8520656 for ; Tue, 14 Jul 2020 20:41:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Zy1V71pl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726973AbgGNUlk (ORCPT ); Tue, 14 Jul 2020 16:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbgGNUlj (ORCPT ); Tue, 14 Jul 2020 16:41:39 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9982BC061755 for ; Tue, 14 Jul 2020 13:41:39 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id k1so13929308qko.14 for ; Tue, 14 Jul 2020 13:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=rJt5ovSTMz7G2VZjYNzh69nF3iFTY3dkO7HTEhyGrdo=; b=Zy1V71plqmAkPYMcUoLCETjZ4SBhTvXoo7im64OokW04LYUIsyrJt69U1FcJndkP3x 0AoBKi2urhNe8IcN7fd7chmUIK5jFz6jyT2axji+O3l31gFM/os6kADVzlahumEuzN4Y aC+qSRCxoRsqUGkvsYgK2AE0yLgb3YlxE5DDUJyjief+rOOdpwK7NU3xcHZKzHY9gOPO NvmTppsjOcm28PMXJCtdpqyLPCZEYyfoENj5wJ4AUQDlCpggfx/chuh2rfPKfq51MVyp dDZiiqnUbdX81UNi82/+ND9BjimZognIzNk5YM4EaR6/XbKAAwsF+krL68ZJ1W++Lo5A iGEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=rJt5ovSTMz7G2VZjYNzh69nF3iFTY3dkO7HTEhyGrdo=; b=IVwq45kK0DnMAbUN0H327oeVMjODxNqb2lj8zSiSMlXr5yy4XZRT203GUaeDCY4nLQ 2zMv/0yzjqEg5G8oK/xCvFjVdCTWC1IPlqGuglabkYb8aL8pRh3qnMcUEkNeuCz6rmCD hIeXCJ/5JsDsuM4pOPYugELYVgw2PK2u6LfNfDqHpzPzJ2biNvHPe8kkdchQac0El5Pp ZVAo5lIySn5CMKQuubCr+DpSv1ghmLeMAGpLRWN3wLGbqjwd7p39M0MCzwS60ibpgOzU mtb4Xw9ofa/kCUNhCxRpOzIPztktbp8F8l35/mCWkRVHd7iONGAzd1IH260QahOmN/OZ jIlg== X-Gm-Message-State: AOAM530uF3IdEs2Oz88QpnxzNgfK59AB77t/gFkJ+bgJC5nnCl4PgmdT cNBa3qDVQIyNhID9zmpzw68AW1mBksPQR5M/XC/twA== X-Google-Smtp-Source: ABdhPJzdC1TQxJrTIZOZxQTLrI6CP3Ilr7aTn18Y6mWGirKrbLsVH6XhwZY9qWBUkPUaN346rev2NIN1dB4OyP/Kkus44A== X-Received: by 2002:a05:6214:108c:: with SMTP id o12mr6465155qvr.168.1594759298801; Tue, 14 Jul 2020 13:41:38 -0700 (PDT) Date: Tue, 14 Jul 2020 13:41:29 -0700 In-Reply-To: <20200714204130.54729-1-brendanhiggins@google.com> Message-Id: <20200714204130.54729-2-brendanhiggins@google.com> Mime-Version: 1.0 References: <20200714204130.54729-1-brendanhiggins@google.com> X-Mailer: git-send-email 2.27.0.389.gc38d7665816-goog Subject: [PATCH v1 1/2] kunit: tool: fix broken default args in unit tests From: Brendan Higgins To: shuah@kernel.org, davidgow@google.com, vitor@massaru.org Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Brendan Higgins Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Commit ddbd60c779b4 ("kunit: use --build_dir=.kunit as default") changed the default build directory for KUnit tests, but failed to update associated unit tests for kunit_tool, so update them. Fixes: ddbd60c779b4 ("kunit: use --build_dir=.kunit as default") Signed-off-by: Brendan Higgins --- tools/testing/kunit/kunit_tool_test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index f9eeaea94cad1..ee942d80bdd02 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -258,14 +258,14 @@ class KUnitMainTest(unittest.TestCase): def test_build_passes_args_pass(self): kunit.main(['build'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 0 - self.linux_source_mock.build_um_kernel.assert_called_once_with(False, 8, '', None) + self.linux_source_mock.build_um_kernel.assert_called_once_with(False, 8, '.kunit', None) assert self.linux_source_mock.run_kernel.call_count == 0 def test_exec_passes_args_pass(self): kunit.main(['exec'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 0 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.linux_source_mock.run_kernel.assert_called_once_with(build_dir='.kunit', timeout=300) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_passes_args_pass(self): @@ -273,7 +273,7 @@ class KUnitMainTest(unittest.TestCase): 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) + build_dir='.kunit', timeout=300) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_exec_passes_args_fail(self): @@ -313,7 +313,7 @@ class KUnitMainTest(unittest.TestCase): def test_exec_timeout(self): timeout = 3453 kunit.main(['exec', '--timeout', str(timeout)], self.linux_source_mock) - self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout) + self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='.kunit', timeout=timeout) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_timeout(self): @@ -321,7 +321,7 @@ class KUnitMainTest(unittest.TestCase): 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='', timeout=timeout) + build_dir='.kunit', timeout=timeout) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_builddir(self): From patchwork Tue Jul 14 20:41:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Higgins X-Patchwork-Id: 11663543 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 CCB8513B4 for ; Tue, 14 Jul 2020 20:41:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0B7420758 for ; Tue, 14 Jul 2020 20:41:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GSTmdPmZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727114AbgGNUln (ORCPT ); Tue, 14 Jul 2020 16:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbgGNUll (ORCPT ); Tue, 14 Jul 2020 16:41:41 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65C9CC061755 for ; Tue, 14 Jul 2020 13:41:41 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id n32so13209397pgb.22 for ; Tue, 14 Jul 2020 13:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=6s+MXnvd3oZrHD1TWsZDFjEGlJK3au/LhRDIVmT50mg=; b=GSTmdPmZs5/LuQS+PqoOMDxWmVCXOYNaPR0TT0mmTF3Cn4HxGa4a2g15XgvJGe02D1 N36LC5t8VLDWbjMIAyqQOB2xbnvpkdHoU/yhc+NqUoVxl0rK+h/pDQjGbIWn1qaeUV9T ymE/p+Tg4/Qb1kTQt7Ga33WAxrsA0qutY5MLeffP03E9QFFTBmWRSoZQTaDl+Zi21dAQ /3L1oq4o8N+LfGMVK19VPsJQ7qSAO7T8f+5J0yITXEb4xrVpItGDtvxOalsLEeTAp7BB 3cOyxAXiMXfiRfltwNzvQMqsQjjfCTzD+Nn16pbOF6H06ESJTjETootvdO8gHoKxVX7u rpTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=6s+MXnvd3oZrHD1TWsZDFjEGlJK3au/LhRDIVmT50mg=; b=V+LLVqW72y8mUpOC5Vs2jkDcAPbt/S4z5GzbTB9XDR9ssV6jcxmo04knmDqL0AK+El 6AJqwZ6lpnFe2/CB6niQ5QnEsZZG7APsKn8ToMWieSTc+pJnzqboOoAE2IpmiVXVgu1n KkarwjF2HFgghLbjr2t2g+lvKvQgpUxy6vXuqTPX6UlDQm1+Q2Q21nU9cFRlTOt8tQcJ SAG6IMYwfZceOOsVyZGeSbQmYckw9wVBmDRvLT30Pd2TunxwBTZbT9sPs8hoUPsZZi7E QivEVRei3AA/f9FWDsxZAB504TWn5/BTBQxEo8pPvzfpYADULKNWDm/np/8bNSaK+OM5 6WRw== X-Gm-Message-State: AOAM533O7tHJrF8XbMNABGZYceThL5Dt2+v+K0R8TzZKoayrHMfqEsIE K/bsKOEoEeRO6FOppnRY4GDlHdnjNCQd6hU7j2AEjQ== X-Google-Smtp-Source: ABdhPJy1xaopIsv9GnReFpKEXHapYr4apuN7LZkkOxgiLsmHv25JyILfxJ5xfbB9S0anhxhhkiXVGim/7x7t0OkqdnN8vw== X-Received: by 2002:a17:90a:2465:: with SMTP id h92mr6080491pje.26.1594759300840; Tue, 14 Jul 2020 13:41:40 -0700 (PDT) Date: Tue, 14 Jul 2020 13:41:30 -0700 In-Reply-To: <20200714204130.54729-1-brendanhiggins@google.com> Message-Id: <20200714204130.54729-3-brendanhiggins@google.com> Mime-Version: 1.0 References: <20200714204130.54729-1-brendanhiggins@google.com> X-Mailer: git-send-email 2.27.0.389.gc38d7665816-goog Subject: [PATCH v1 2/2] kunit: tool: fix improper treatment of file location From: Brendan Higgins To: shuah@kernel.org, davidgow@google.com, vitor@massaru.org Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Brendan Higgins Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Commits 01397e822af4 ("kunit: Fix TabError, remove defconfig code and handle when there is no kunitconfig") and 45ba7a893ad8 ("kunit: kunit_tool: Separate out config/build/exec/parse") introduced two closely related issues which built off of each other: they excessively created the build directory when not present and modified a constant (constants in Python only exist by convention). Together these issues broken a number of unit tests for KUnit tool, so fix them. Fixes: 01397e822af4 ("kunit: Fix TabError, remove defconfig code and handle when there is no kunitconfig") Fixes: 45ba7a893ad8 ("kunit: kunit_tool: Separate out config/build/exec/parse") Signed-off-by: Brendan Higgins --- tools/testing/kunit/kunit.py | 24 ------------------------ tools/testing/kunit/kunit_tool_test.py | 4 ++-- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index f9b769f3437dd..425ef40067e7e 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -240,12 +240,6 @@ def main(argv, linux=None): if cli_args.subcommand == 'run': 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 not os.path.exists(kunit_kernel.kunitconfig_path): - create_default_kunitconfig() if not linux: linux = kunit_kernel.LinuxSourceTree() @@ -263,12 +257,6 @@ def main(argv, linux=None): 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 not os.path.exists(kunit_kernel.kunitconfig_path): - create_default_kunitconfig() if not linux: linux = kunit_kernel.LinuxSourceTree() @@ -285,12 +273,6 @@ def main(argv, linux=None): 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 not os.path.exists(kunit_kernel.kunitconfig_path): - create_default_kunitconfig() if not linux: linux = kunit_kernel.LinuxSourceTree() @@ -309,12 +291,6 @@ def main(argv, linux=None): 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 not os.path.exists(kunit_kernel.kunitconfig_path): - create_default_kunitconfig() if not linux: linux = kunit_kernel.LinuxSourceTree() diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index ee942d80bdd02..287c74d821c33 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -251,7 +251,7 @@ class KUnitMainTest(unittest.TestCase): pass def test_config_passes_args_pass(self): - kunit.main(['config'], self.linux_source_mock) + kunit.main(['config', '--build_dir=.kunit'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 1 assert self.linux_source_mock.run_kernel.call_count == 0 @@ -326,7 +326,7 @@ class KUnitMainTest(unittest.TestCase): def test_run_builddir(self): build_dir = '.kunit' - kunit.main(['run', '--build_dir', build_dir], self.linux_source_mock) + kunit.main(['run', '--build_dir=.kunit'], 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)