From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796433441; b=Q0qv9tO2nyAtfCR5bIJcwvlFHhoL56BFqiAZA0K/P1jW6o2YobNIhUi9CKffxlzjc5du 8U65uqEgjaDvuUq86w74dYzhmUkyc/dzoXz+5YpA6gTzYNb0Ac5h8GX4hX1A+O3n76NtP VQkF0JGJn+DZlbNSLZffBjlmpErDqdHYCiTPM5OhstuOvSCtNydf1ouxcZqOvk9uBPbLe 6udIRuQLeNOt5OFGmDlZVii0yohfZrSoJOkZThKOHKe3EmV9gTMKK3zKZVak1QjKGLGBO 7pxKgeNTMBW9XWXs2M6IENmJ4kTY+T0po4gZHaEjn04D7trOTSKKIG5m25vVeysAzQQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796433441; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=hGwE3pKLFFhDBYthcnL2FVufbO5AnMjzqQv373nFFpI=; b=QCNal/XfuuXWIPIM97a2T4YvrRA5L38hhkEJIm64L8b3PjVT7KkkIYLdeQr+MdXy1vgL de3taUPAWcplQP+F6bwzCYzLqXIGTy197ilAh/4ALwrZ2/AHstouNGHAF1yGOE8mbbHCE o1Vayh4TNkqcdyUdLbLvm0kpRznVitQ2bcVsTOWfBMiO9qCvBzGB6kyHPa5wrlmf3R6wB EWxCupW9kV1rZVMNWDR7YfrgZV2GbNihO0lZHMULcdf+1uxQQGaxZoajGsfcVipHtkgVH fvyhqVPC4Iu6rOsvWkWA1oJ2t+pzP1CkkxuaCRy/ns25NiFsj8zb1SV6D3Rnc0MDQlA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="mXDp/RCd"; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A91E606A32C; Sat, 5 Dec 2026 01:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mXDp/RCd Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796433440; b=cB4FmFVtYyaABQ3GEVCUQN3EAbf2VhngIDTykxauDYlxER80VLhqPDP9ZqKMRCS0Yucl QDLigtrn4DDgNdXO6jnzxh8jEADZKty/pKdcBOZx+Zc8/33foC+fR0WYWRjaB2NiIPpix ae4h/w+gDip2fyfgax0K1WB+s7kS5aJ8ojgzG5OcIiGw9aEAQe9LOjwxBRLYOv1DnHr3f 9CX+tZ6PR9GNAe6r72w3d23Rn1KPQZGcjUR7mAtntp+w1mfdqsDfRsir3Qqo/XSYOgPCH /cbLFActACK163vWx1Xs3POXcFV6mmUa4KyHHmjNBMhxynhLBno3oRcnbbOoxOsKQSA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796433440; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=hGwE3pKLFFhDBYthcnL2FVufbO5AnMjzqQv373nFFpI=; b=g01nEYOPgCdIvekX2LzwSjQZdgiN8dp7l2Tv7/wVG88Dcvk11x+0J2G7NYZTOOl+2tef TEAtToQyp0KU8a//Xt+uxVPcBwRRDRkCyEYhqGVleQMvqb7hTYygvsHotxRWXtXej2yGI TXYXT3r4rf2Px4iDBS1zGml0a8dH09fLw+NYOqREYo+DgD2Pz3Z5Eg17JjOW3xMNmts6/ 42BvUzmbmG4Tn26tvkamgRSUE0JcsIY2BJTt78zzcm0u9/mK72hd1DMf6yszXwzsvB88m KDa6lzfD+sJ9XOIrUYQKK+5AoFChji9hQFjzU3ARVtGrfj4G2kkzvIPvRBTuxMbwizg== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 5C22C1F0092B; Sat, 5 Dec 2026 01:17:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796433440; bh=hGwE3pKLFFhDBYthcnL2FVufbO5AnMjzqQv373nFFpI=; h=From:Subject:Date:To:Cc:Reply-To; b=mXDp/RCdP++Wm5/ggWkD3CQlkYI9eYwM56uUmiu21SffjwBvB/6ww0W5KLQuAheEZ 4X44nBkteyqMq4yapUlnlKI8R1qT4t+VEAPdkPYK8x08m/p+N+ECUucrL1gx7i1nKM jMxWPBdYO46IPHeof3kIeKV+dSAoiUtG2aAMPOm0zCNPoR1pRGYOtZr6Y0GfFhVAZW r4qEJpKs/u7dgOCDBnx5eqAUXrW+YtJFRxsxg1skadmPR8vqdae742b+tAUT4LAHW2 1620/1Qvd8myZn45zXy9UBqPmy75QvY4hlWkin9n+SsPDc5TxFAidps70e6XU8Jw3V f9f8OcK4UMHmQ== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id B5D9150101; Sat, 5 Dec 2026 01:17:19 +0000 (UTC) From: Pavee Zheng via B4 Relay Subject: [PATCH 0/2] kunit: tool: Create missing build directories and parents Date: Sat, 05 Dec 2026 09:17:13 +0800 Message-Id: <20261205-patch-kunit-build-dir-v1-0-52d42f301f40@gmail.com> X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWMywrCMBBFf6XM2sEmUgV/RVwkk4kZlVjyKELpv 5vU5bncc1bInIQzXIcVEi+S5RMbqMMAFEx8MIprDHrUZ6XHCWdTKOCrRiloq7wdOkl4UeSJ/En biaC5c2Iv3717u/85V/tkKj3WH9ZkRptMpNCnHKoJxz0L2/YD7ehK+ZcAAAA= X-Change-ID: 20261205-patch-kunit-build-dir-71cfccf32b5c To: Brendan Higgins , David Gow Cc: Rae Moar , Shuah Khan , Ryota Sakamoto , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Pavee Zheng X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796433438; l=3069; i=pavee.zheng@gmail.com; s=20261203; h=from:subject:message-id; bh=YRL3RwaQmieA5WpQG6RNTDN2pfQIDb4wJ+6UVzonTRo=; b=D3o6kJu1rqS61+JQZmAKeAN4EYZ1U6cCzayeDRvRaTSKo0tbqED1hAAc9uBATghh0mpfaDJwR CUmS8ijlDdxDYD35+7koQz5BmDXXh/NFhkjmi3MRtXwe/cxq0FvJLkO X-Developer-Key: i=pavee.zheng@gmail.com; a=ed25519; pk=tKWX/JHvHgKJscWsVefc3+t39eSysVDI8/ZkQl1Rlyo= X-Endpoint-Received: by B4 Relay for pavee.zheng@gmail.com/20261203 with auth_id=1729 X-Original-From: Pavee Zheng Reply-To: pavee.zheng@gmail.com This 2-patch series fixes two build-directory creation issues in kunit.py and kunit_kernel.py: 1. run_handler(), config_handler(), and LinuxSourceTree.build_config() use os.mkdir(), which fails with FileNotFoundError when any parent directory does not yet exist (for example with nested --build_dir paths or a not-yet-created KBUILD_OUTPUT directory). Patch 1 switches them to os.makedirs(..., exist_ok=True) while keeping run_handler()'s existing fail-fast behavior for empty --build_dir=. 2. build_handler() does not create build_dir before tree_from_args() copies the default .kunitconfig into build_dir, so running kunit.py build on a clean checkout or with a missing build directory fails with FileNotFoundError before configuring or building. Patch 2 creates non-empty build_dir with os.makedirs(..., exist_ok=True) before calling tree_from_args() in build_handler(). Verification: - python3 tools/testing/kunit/kunit_tool_test.py: 96/96 tests pass on Patch 1 alone and 96/96 tests pass on Patch 1+2 (up from 94 on shuah/kunit; tested on Python 3.9.6 and Python 3.11.2). - End-to-end arm64 build and QEMU boot (Linux aarch64 container, GCC 12.2.0, QEMU 7.2.22, Python 3.11.2): - Clean-tree kunit.py build --arch=arm64 creates .kunit and builds .kunit/arch/arm64/boot/Image.gz cleanly. - Fresh nested KBUILD_OUTPUT=ci/arm64 kunit.py config --arch=arm64 creates ci/arm64/.kunit/.config with CONFIG_KUNIT=y, and a second config run preserves a customized .kunitconfig while regenerating .config. - Fresh nested KBUILD_OUTPUT=/tmp/kunit-run-out/arm64 kunit.py run --arch=arm64 --kunitconfig=lib/kunit builds and boots QEMU cleanly (Ran 95 tests: passed: 89, skipped: 6, failed: 0, crashed: 0). - Isolated CLI reproducer matrix (stub make stopping at olddefconfig) verified across shuah/kunit, Patch 1, and Patch 2 covering build, KBUILD_OUTPUT=out config, KBUILD_OUTPUT=out/sub run, run --build_dir=nested/dir, build --build_dir=nested/dir, fail-fast run --build_dir=, and exec --build_dir=missing/dir (no dirs created). - scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on each patch and on the full series. - Limitations: mypy and pytype are unavailable in the local host and container environments, and UML execution was not run. An AI coding assistant helped refine the code, tests, commit messages, and cover letter, and ran the checks above. --- Pavee Zheng (2): kunit: tool: Create missing parent directories for build_dir kunit: tool: Create missing build directory before build tools/testing/kunit/kunit.py | 11 ++++++----- tools/testing/kunit/kunit_kernel.py | 4 ++-- tools/testing/kunit/kunit_tool_test.py | 35 +++++++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 10 deletions(-) --- base-commit: 79cffdf134300a8c0e95e26224691263477b5f15 change-id: 20261205-patch-kunit-build-dir-71cfccf32b5c Best regards, -- Pavee Zheng From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavee Zheng Subject: [PATCH 0/2] kunit: tool: Create missing build directories and parents Date: Sat, 05 Dec 2026 09:17:13 +0800 Message-Id: <20261205-patch-kunit-build-dir-v1-0-52d42f301f40@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWMywrCMBBFf6XM2sEmUgV/RVwkk4kZlVjyKELpv 5vU5bncc1bInIQzXIcVEi+S5RMbqMMAFEx8MIprDHrUZ6XHCWdTKOCrRiloq7wdOkl4UeSJ/En biaC5c2Iv3717u/85V/tkKj3WH9ZkRptMpNCnHKoJxz0L2/YD7ehK+ZcAAAA= X-Change-ID: 20261205-patch-kunit-build-dir-71cfccf32b5c To: Brendan Higgins , David Gow Cc: Rae Moar , Shuah Khan , Ryota Sakamoto , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Pavee Zheng X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796433438; l=3069; i=pavee.zheng@gmail.com; s=20261203; h=from:subject:message-id; bh=YRL3RwaQmieA5WpQG6RNTDN2pfQIDb4wJ+6UVzonTRo=; b=D3o6kJu1rqS61+JQZmAKeAN4EYZ1U6cCzayeDRvRaTSKo0tbqED1hAAc9uBATghh0mpfaDJwR CUmS8ijlDdxDYD35+7koQz5BmDXXh/NFhkjmi3MRtXwe/cxq0FvJLkO X-Developer-Key: i=pavee.zheng@gmail.com; a=ed25519; pk=tKWX/JHvHgKJscWsVefc3+t39eSysVDI8/ZkQl1Rlyo= X-Endpoint-Received: by B4 Relay for pavee.zheng@gmail.com/20261203 with auth_id=1729 List-Id: B4 Relay Submissions This 2-patch series fixes two build-directory creation issues in kunit.py and kunit_kernel.py: 1. run_handler(), config_handler(), and LinuxSourceTree.build_config() use os.mkdir(), which fails with FileNotFoundError when any parent directory does not yet exist (for example with nested --build_dir paths or a not-yet-created KBUILD_OUTPUT directory). Patch 1 switches them to os.makedirs(..., exist_ok=True) while keeping run_handler()'s existing fail-fast behavior for empty --build_dir=. 2. build_handler() does not create build_dir before tree_from_args() copies the default .kunitconfig into build_dir, so running kunit.py build on a clean checkout or with a missing build directory fails with FileNotFoundError before configuring or building. Patch 2 creates non-empty build_dir with os.makedirs(..., exist_ok=True) before calling tree_from_args() in build_handler(). Verification: - python3 tools/testing/kunit/kunit_tool_test.py: 96/96 tests pass on Patch 1 alone and 96/96 tests pass on Patch 1+2 (up from 94 on shuah/kunit; tested on Python 3.9.6 and Python 3.11.2). - End-to-end arm64 build and QEMU boot (Linux aarch64 container, GCC 12.2.0, QEMU 7.2.22, Python 3.11.2): - Clean-tree kunit.py build --arch=arm64 creates .kunit and builds .kunit/arch/arm64/boot/Image.gz cleanly. - Fresh nested KBUILD_OUTPUT=ci/arm64 kunit.py config --arch=arm64 creates ci/arm64/.kunit/.config with CONFIG_KUNIT=y, and a second config run preserves a customized .kunitconfig while regenerating .config. - Fresh nested KBUILD_OUTPUT=/tmp/kunit-run-out/arm64 kunit.py run --arch=arm64 --kunitconfig=lib/kunit builds and boots QEMU cleanly (Ran 95 tests: passed: 89, skipped: 6, failed: 0, crashed: 0). - Isolated CLI reproducer matrix (stub make stopping at olddefconfig) verified across shuah/kunit, Patch 1, and Patch 2 covering build, KBUILD_OUTPUT=out config, KBUILD_OUTPUT=out/sub run, run --build_dir=nested/dir, build --build_dir=nested/dir, fail-fast run --build_dir=, and exec --build_dir=missing/dir (no dirs created). - scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on each patch and on the full series. - Limitations: mypy and pytype are unavailable in the local host and container environments, and UML execution was not run. An AI coding assistant helped refine the code, tests, commit messages, and cover letter, and ran the checks above. --- Pavee Zheng (2): kunit: tool: Create missing parent directories for build_dir kunit: tool: Create missing build directory before build tools/testing/kunit/kunit.py | 11 ++++++----- tools/testing/kunit/kunit_kernel.py | 4 ++-- tools/testing/kunit/kunit_tool_test.py | 35 +++++++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 10 deletions(-) --- base-commit: 79cffdf134300a8c0e95e26224691263477b5f15 change-id: 20261205-patch-kunit-build-dir-71cfccf32b5c Best regards, -- Pavee Zheng