On 1/9/26 03:08, sun jian wrote:
hm, why? Is that a thing people actually do?
Is anyone going to actually test this feature?
Yes — invoking selftests directly from the kernel root can easily happen in practice, for example::
sudo tools/testing/selftests/mm/run_vmtests.sh
This currently results in false failures because relative paths being resolved against the caller's cwd instead of the script directory.
Alternatively we could check that we're in the correct directory and error out if not.
That would also be reasonable, but I slightly prefer auto-cd because it avoids an easy invocation pitfall and makes the runner more robust for wrappers/CI where the cwd is not stable. That said, I'm happy to switch to a fail-fast cwd check if you prefer the behavior.
I'd prefer to just fail for the case that we never supported instead of adding support for it.