From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D94122FDE6 for ; Wed, 7 Jan 2026 01:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767751182; cv=none; b=NsLeIIl9+I1wEVauTdhp22M1xOpvFrQdm1MhgGmrmVvwcAQYrhE4hTtLojnmQnUgd9Pjp0r5Adg2c2oSGDM814cKOTUIOmIVpFjuX29l6dZgaudvLZzyFz0WfUyhdpTVY3+++hPHFLxm6xZxPe/O+8eW4MWRrDLzexn88oHL3og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767751182; c=relaxed/simple; bh=fCNgOzeicMmEuMqrRSPuUBXGA6QlmVhzx8zl7naLVHg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pFH+jbUboOnkyiqgO8S+2vKkB+CeR00xq7fjxYFwGc0NWe/k014H1smpoY6E/OWA4hIHSpSJyjXmMWgnIQsDi2xVU9xB7LPbi5fksemgT6ikecM6ND5fHUHYXdMsCCw/8W6618lvwV7qkDFxfny9u53beyy/2BRn3zXcqa/tIvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--davidgow.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Q+8r0fkw; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--davidgow.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Q+8r0fkw" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-7b82c2c2ca2so2396165b3a.1 for ; Tue, 06 Jan 2026 17:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767751181; x=1768355981; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=pPKJBtAWhngfzBfrJffHmf//LwUHhRdPEYWcMzo5trE=; b=Q+8r0fkwC1hqUA7KUsttvOWtLTuHyGb4zMXchgU/M1zeGMlsW74oYwC2NaE1Kcjn7s FTOmvHCXIUU5eXpuYWl6HDVhBR0CyQ7j4KXMLBNADJi+GiNU7iaLgqlxpcQ71mpwD0cq 7XAIPHBQj4cgCeytNdTZZub1K82WKRwp8r+kmzsa0+5wGiCTT/m0OwP24Q0zXUgCo4Nu 8VFNWuUw9DmAp6hnX9nb/oGXbCixlP2WcLGDnf5qh8QWRouufyqM61eiu7dVsgWAg3pD OK8nv18RyjF0RbI+toPqfvL/kQ+4yFgjusrXNukUBuwYYnYCW/TPqBEQP1Sr7qFS8BCu XDTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767751181; x=1768355981; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=pPKJBtAWhngfzBfrJffHmf//LwUHhRdPEYWcMzo5trE=; b=vyc4GCUWcxlRhCiMN7R6bDke+xm9D2BMBowSd2pBQ0imUa5HerkjhUc+gozkiyDLMM H9OcHfJqmBWh1Q8CpM73+hjMRwadsjzD2seWcd1dvErdDctrlBGJWBBllwRq3XHXtqCY NFAeKI3+ZZQMTczZgdeTnyJX2JJ2CGHcsi0ZgJLBORGSTmc1Evhucwat8t5ZPpCiMZ8Y /z9qSTtHAglrghhrZIx1WF+0L92TpqwGp0eC5TOQcGIfeCdKHi/2qOrfxZ89Gpqum8+2 QiDecfh0gZ/Laae3tidZST8Ka1Z0xpOSzgI6Yr+192VBzACJFwAP69AIdRGl1w3AQgtq d/dA== X-Forwarded-Encrypted: i=1; AJvYcCWtbCHxScp2N4R3CWrzo8VfgzkUWprSOmJPq5mGkgDZTK8S/ek8nFdIckKnTd2l1OkgQ+f6TR4LVp4skc4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5bulejqWUerfmPE8kN8rsk6r7GjrBdIBKEfnFgXvhtyimk1Ab o+KhDVhVGDRaMrcGYQWGhADnUdyf8t8l5jTIfsSp4BiQNe3o8MTnlhxzUNsorNC0Rm9CilJM2SJ VzdIh/u54KXiSeg== X-Google-Smtp-Source: AGHT+IGIU8sCgbuagvzSkRlmcHAHbNa/SrZo5u0sCdUV5I2bLY7fjCFau6leaTLOvBZCI2fLGEQOutcorWNBpg== X-Received: from pfbfj31.prod.google.com ([2002:a05:6a00:3a1f:b0:7dd:8bba:639b]) (user=davidgow job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:300d:b0:819:9dee:7a4a with SMTP id d2e1a72fcca58-81b7d65603dmr963459b3a.6.1767751180652; Tue, 06 Jan 2026 17:59:40 -0800 (PST) Date: Wed, 7 Jan 2026 09:59:34 +0800 In-Reply-To: <20260107015936.2316047-1-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260107015936.2316047-1-davidgow@google.com> X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog Message-ID: <20260107015936.2316047-2-davidgow@google.com> Subject: [PATCH v2 2/2] kunit: tool: test: Don't rely on implicit working directory change From: David Gow To: shuah@kernel.org, "=?UTF-8?q?Thomas=20Wei=C3=9Fschuh?=" , Brendan Higgins , Rae Moar Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, David Gow Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: Thomas Wei=C3=9Fschuh 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=C3=9Fschuh Reviewed-by: David Gow Signed-off-by: David Gow --- Changes since v1: https://lore.kernel.org/linux-kselftest/20251230-kunit-pytest-v1-2-e2dae0da= e200@linutronix.de/ - No-op rebase on top of kselftest/kunit --- 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/k= unit_tool_test.py index 30ac1cb6c8ed..238a31a5cc29 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -477,7 +477,8 @@ class LinuxSourceTreeTest(unittest.TestCase): want_kconfig =3D kunit_config.Kconfig() want_kconfig.add_entry('NOT_REAL', 'y') =20 - tree =3D kunit_kernel.LinuxSourceTree('', kconfig_add=3D['CONFIG_NOT_REA= L=3Dy']) + tree =3D kunit_kernel.LinuxSourceTree('', kunitconfig_paths=3D[os.devnul= l], + kconfig_add=3D['CONFIG_NOT_REAL=3Dy']) self.assertTrue(want_kconfig.is_subset_of(tree._kconfig), msg=3Dtree._kc= onfig) =20 def test_invalid_arch(self): @@ -489,7 +490,7 @@ class LinuxSourceTreeTest(unittest.TestCase): return subprocess.Popen(['echo "hi\nbye"'], shell=3DTrue, text=3DTrue, = stdout=3Dsubprocess.PIPE) =20 with tempfile.TemporaryDirectory('') as build_dir: - tree =3D kunit_kernel.LinuxSourceTree(build_dir) + tree =3D kunit_kernel.LinuxSourceTree(build_dir, kunitconfig_paths=3D[o= s.devnull]) mock.patch.object(tree._ops, 'start', side_effect=3Dfake_start).start() =20 with self.assertRaises(ValueError): --=20 2.52.0.351.gbe84eed79e-goog