mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavee Zheng via B4 Relay <devnull+pavee.zheng.gmail.com@kernel.org>
To: Brendan Higgins <brendan.higgins@linux.dev>,
	 David Gow <david@davidgow.net>
Cc: Rae Moar <raemoar63@gmail.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 Ryota Sakamoto <sakamo.ryota@gmail.com>,
	linux-kselftest@vger.kernel.org,  kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org,
	 Pavee Zheng <pavee.zheng@gmail.com>
Subject: [PATCH 0/2] kunit: tool: Create missing build directories and parents
Date: Sat, 05 Dec 2026 09:17:13 +0800	[thread overview]
Message-ID: <20261205-patch-kunit-build-dir-v1-0-52d42f301f40@gmail.com> (raw)

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 <pavee.zheng@gmail.com>



             reply	other threads:[~2026-12-05  1:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  1:17 Pavee Zheng via B4 Relay [this message]
2026-12-05  1:17 ` [PATCH 1/2] kunit: tool: Create missing parent directories for build_dir Pavee Zheng via B4 Relay
2026-12-05  1:17 ` [PATCH 2/2] kunit: tool: Create missing build directory before build Pavee Zheng via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205-patch-kunit-build-dir-v1-0-52d42f301f40@gmail.com \
    --to=devnull+pavee.zheng.gmail.com@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=david@davidgow.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pavee.zheng@gmail.com \
    --cc=raemoar63@gmail.com \
    --cc=sakamo.ryota@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®