[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOS=gU1_GFN0yyA0MzF_QPY3ueLPvC0egZqP_n210q4LsGw@mail.gmail.com>
Date: Mon, 5 Jan 2026 16:56:07 +0800
From: David Gow <davidgow@...gle.com>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Cc: Brendan Higgins <brendan.higgins@...ux.dev>, Rae Moar <raemoar63@...il.com>,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] kunit: tool: test: Don't rely on implicit working
directory change
On Tue, 30 Dec 2025 at 20:56, Thomas Weißschuh
<thomas.weissschuh@...utronix.de> wrote:
>
> If no kunitconfig_paths are passed to LinuxSourceTree() it falls back to
> DEFAULT_KUNITCONFIG_PATH. This resolution only works when the current
> working directory is the root of the source tree. This works by chance
> when running the full testsuite through the default unittest runner, as
> some tests will change the current working directory as a side-effect of
> 'kunit.main()'. When running a single testcase or using pytest, which
> resets the working directory for each test, this assumption breaks.
>
> Explicitly specify an empty kunitconfig for the affected tests.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
> ---
Reviewed-by: David Gow <davidgow@...gle.com>
Cheers,
-- David
> tools/testing/kunit/kunit_tool_test.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py
> index fd7ca89596c0..584275ce6ba6 100755
> --- a/tools/testing/kunit/kunit_tool_test.py
> +++ b/tools/testing/kunit/kunit_tool_test.py
> @@ -466,7 +466,8 @@ class LinuxSourceTreeTest(unittest.TestCase):
> want_kconfig = kunit_config.Kconfig()
> want_kconfig.add_entry('NOT_REAL', 'y')
>
> - tree = kunit_kernel.LinuxSourceTree('', kconfig_add=['CONFIG_NOT_REAL=y'])
> + tree = kunit_kernel.LinuxSourceTree('', kunitconfig_paths=[os.devnull],
> + kconfig_add=['CONFIG_NOT_REAL=y'])
> self.assertTrue(want_kconfig.is_subset_of(tree._kconfig), msg=tree._kconfig)
>
> def test_invalid_arch(self):
> @@ -478,7 +479,7 @@ class LinuxSourceTreeTest(unittest.TestCase):
> return subprocess.Popen(['echo "hi\nbye"'], shell=True, text=True, stdout=subprocess.PIPE)
>
> with tempfile.TemporaryDirectory('') as build_dir:
> - tree = kunit_kernel.LinuxSourceTree(build_dir)
> + tree = kunit_kernel.LinuxSourceTree(build_dir, kunitconfig_paths=[os.devnull])
> mock.patch.object(tree._ops, 'start', side_effect=fake_start).start()
>
> with self.assertRaises(ValueError):
>
> --
> 2.52.0
>
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5281 bytes)
Powered by blists - more mailing lists