linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sun Jian <sun.jian.kdev@gmail.com>
To: David Hildenbrand <david@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Sun Jian <sun.jian.kdev@gmail.com>
Subject: [PATCH v2] selftests/mm: run_vmtests.sh: fail if invoked from the wrong directory
Date: Sat, 10 Jan 2026 01:28:33 +0800	[thread overview]
Message-ID: <20260109172833.2989-1-sun.jian.kdev@gmail.com> (raw)
In-Reply-To: <20260108031604.12379-1-sun.jian.kdev@gmail.com>

run_vmtests.sh assumes it is invoked from tools/testing/selftests/mm.
When run from another working directory, relative paths can lead to
confusing failures. Detect this case and abort with a clear message.

Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
---
 tools/testing/selftests/mm/run_vmtests.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index d9173f2312b7..b7025afb56fd 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -5,6 +5,13 @@
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
+# Verify invocation from the script directory.
+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
+if [ "$(pwd -P)" != "$SCRIPT_DIR" ]; then
+    echo "Please run this test from $SCRIPT_DIR" >&2
+    exit 1
+fi
+
 count_total=0
 count_pass=0
 count_fail=0
-- 
2.43.0



  parent reply	other threads:[~2026-01-09 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08  3:16 [PATCH] selftests/mm: run_vmtests.sh: fix relative path handling Sun Jian
2026-01-08 21:28 ` Andrew Morton
2026-01-09  2:08   ` sun jian
2026-01-09 13:41     ` David Hildenbrand (Red Hat)
2026-01-09 17:28 ` Sun Jian [this message]
2026-01-10  1:00   ` [PATCH v2] selftests/mm: run_vmtests.sh: fail if invoked from the wrong directory SeongJae Park

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=20260109172833.2989-1-sun.jian.kdev@gmail.com \
    --to=sun.jian.kdev@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.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