On Thu, 8 Jan 2026 11:16:04 +0800 Sun Jian <[email protected]> wrote:
> run_vmtests.sh relies on being invoked from its own directory and uses
> relative paths to run tests.
>
> Change to the script directory at startup so it can be run from any
> working directory without failing.
>
> ...
>
hm, why? Is that a thing people actually do?
Is anyone going to actually test this feature?
> --- a/tools/testing/selftests/mm/run_vmtests.sh
> +++ b/tools/testing/selftests/mm/run_vmtests.sh
> @@ -5,6 +5,10 @@
> # Kselftest framework requirement - SKIP code is 4.
> ksft_skip=4
>
> +# Ensure relative paths work regardless of caller's cwd.
> +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
> +cd "$SCRIPT_DIR" || exit 1
> +
Alternatively we could check that we're in the correct directory and
error out if not.