public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org,
	surenb@google.com, mhocko@suse.com, shuah@kernel.org
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] selftests/lib.mk: set PWD from CURDIR to avoid wrong extmod path
Date: Tue, 31 Mar 2026 12:01:55 +0800	[thread overview]
Message-ID: <20260331040156.119158-3-liwang@redhat.com> (raw)
In-Reply-To: <20260331040156.119158-1-liwang@redhat.com>

When running selftests from the kernel top-level (e.g. make kselftest-all),
sub-makes might still inherit the caller's PWD from the environment.

Some selftests use $(PWD) in recursive kbuild invocations, which can
then incorrectly resolve to the kernel top directory instead of the
current test directory.

In that case, kbuild may generate an external-module wrapper Makefile in
the wrong location, potentially clobbering the top-level Makefile and
causing recursive include failures ("Too many open files").

Export PWD := $(CURDIR) in selftests/lib.mk so $(PWD) always matches the
actual current selftest directory.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Li Wang <liwang@redhat.com>
---
 tools/testing/selftests/lib.mk                | 2 ++
 tools/testing/selftests/mm/local_config.stamp | 0
 2 files changed, 2 insertions(+)
 create mode 100644 tools/testing/selftests/mm/local_config.stamp

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index f02cc8a2e4ae..2840e98c225c 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -60,6 +60,8 @@ endif
 selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
 top_srcdir = $(selfdir)/../../..
 
+export PWD := $(CURDIR)
+
 # msg: emit succinct information message describing current building step
 # $1 - generic step name (e.g., CC, LINK, etc);
 # $2 - optional "flavor" specifier; if provided, will be emitted as [flavor];
diff --git a/tools/testing/selftests/mm/local_config.stamp b/tools/testing/selftests/mm/local_config.stamp
new file mode 100644
index 000000000000..e69de29bb2d1
-- 
2.53.0



  parent reply	other threads:[~2026-03-31  4:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31  4:01 [PATCH 1/4] selftests/mm: respect build verbosity settings for 32/64-bit targets Li Wang
2026-03-31  4:01 ` [PATCH 2/4] selftests/mm: serialize local_config generation for parallel builds Li Wang
2026-03-31  5:29   ` Andrew Morton
2026-03-31  9:16     ` Li Wang
2026-03-31  4:01 ` Li Wang [this message]
2026-03-31  5:30   ` [PATCH 3/4] selftests/lib.mk: set PWD from CURDIR to avoid wrong extmod path Andrew Morton
2026-03-31  7:19     ` Li Wang
2026-03-31  4:01 ` [PATCH 4/4] selftests/mm: fix cow/gup_longterm link failures when liburing flags are missing Li Wang
2026-03-31  7:13   ` Li Wang
2026-04-01 13:44     ` David Hildenbrand (Arm)
2026-03-31  5:29 ` [PATCH 1/4] selftests/mm: respect build verbosity settings for 32/64-bit targets Andrew Morton
2026-03-31  9:50   ` Li Wang

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=20260331040156.119158-3-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=Liam.Howlett@oracle.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=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@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