From: Sasha Levin <sashal@kernel.org>
To: Shuah Khan <shuah@kernel.org>
Cc: "Sasha Levin" <sashal@kernel.org>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
linux-riscv@lists.infradead.org,
"Mark Brown" <broonie@kernel.org>,
"Ricardo B. Marlière" <rbm@suse.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] selftests/riscv: keep building and installing after a subdirectory fails
Date: Wed, 14 Oct 2026 16:01:13 -0400 [thread overview]
Message-ID: <20261014200115.1363363-6-sashal@kernel.org> (raw)
In-Reply-To: <20261014200115.1363363-1-sashal@kernel.org>
The RISC-V suite builds and installs its subdirectories in shell loops
whose status is that of the last subdirectory. A failure in any other
subdirectory is lost, while a failure in the last one fails "make all"
and, through "install: all", drops the installation of every other
RISC-V test as well. FORCE_TARGETS has no effect on the loops either.
Make each loop fail only when no subdirectory succeeds, which matches
how the top-level selftests Makefile treats its targets, and stop at the
first failure when FORCE_TARGETS is set. When a build report is
requested, record each subdirectory as riscv/<subdir> so that a
partially built suite is visible even though make succeeds. Default
OUTPUT to the current directory, as the arm64 suite does, so that the
loops also work when the suite is built directly.
Fixes: 287dcc2b0c83 ("selftests: Test the new RISC-V hwprobe interface")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/riscv/Makefile | 39 +++++++++++++++++++-------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/riscv/Makefile b/tools/testing/selftests/riscv/Makefile
index 5671b4405a129..52d1228be8d03 100644
--- a/tools/testing/selftests/riscv/Makefile
+++ b/tools/testing/selftests/riscv/Makefile
@@ -20,21 +20,35 @@ CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
CFLAGS += $(KHDR_INCLUDES)
+OUTPUT ?= $(CURDIR)
+
export CFLAGS
export top_srcdir
+include $(top_srcdir)/tools/testing/selftests/build_report.mk
+
all:
- @for DIR in $(RISCV_SUBTARGETS); do \
+ @ret=$(if $(RISCV_SUBTARGETS),1,0); \
+ for DIR in $(RISCV_SUBTARGETS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
- mkdir -p $$BUILD_TARGET; \
- $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
- done
+ mkdir -p $$BUILD_TARGET && \
+ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
+ status=$$?; \
+ $(call ksft_record_build_status,all,riscv/$$DIR); \
+ $(if $(FORCE_TARGETS),[ $$status -eq 0 ] || exit $$status;) \
+ [ $$status -eq 0 ] && ret=0; \
+ done; exit $$ret
install: all
- @for DIR in $(RISCV_SUBTARGETS); do \
+ @ret=$(if $(RISCV_SUBTARGETS),1,0); \
+ for DIR in $(RISCV_SUBTARGETS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
- $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
- done
+ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
+ status=$$?; \
+ $(call ksft_record_build_status,install,riscv/$$DIR); \
+ $(if $(FORCE_TARGETS),[ $$status -eq 0 ] || exit $$status;) \
+ [ $$status -eq 0 ] && ret=0; \
+ done; exit $$ret
run_tests: all
@for DIR in $(RISCV_SUBTARGETS); do \
@@ -44,10 +58,15 @@ run_tests: all
# Avoid any output on non riscv on emit_tests
emit_tests:
- @for DIR in $(RISCV_SUBTARGETS); do \
+ @ret=$(if $(RISCV_SUBTARGETS),1,0); \
+ for DIR in $(RISCV_SUBTARGETS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
- $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
- done
+ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
+ status=$$?; \
+ $(call ksft_record_build_status,install,riscv/$$DIR); \
+ $(if $(FORCE_TARGETS),[ $$status -eq 0 ] || exit $$status;) \
+ [ $$status -eq 0 ] && ret=0; \
+ done; exit $$ret
clean:
@for DIR in $(RISCV_SUBTARGETS); do \
--
2.53.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2026-10-14 20:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 20:01 [PATCH 0/7] selftests: report per-suite build results without failing the build Sasha Levin
2026-10-14 20:01 ` Sasha Levin [this message]
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=20261014200115.1363363-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rbm@suse.com \
--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