From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] kbuild: add make check target
Date: Mon, 27 Oct 2025 09:08:23 +0100 [thread overview]
Message-ID: <20251027080832.1989341-1-a.fatoum@pengutronix.de> (raw)
The barebox test suite is invoked by running pytest, but for many
projects running make check is what is usually expected.
Add a make check target that calls pytest to accommodate that.
In future, we may add extra checks to test that pytest is correctly
installed to make it easier to use.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/Makefile b/Makefile
index 9af028cbc6a0..018a206ee8ca 100644
--- a/Makefile
+++ b/Makefile
@@ -463,6 +463,7 @@ KLZOP = lzop
LZMA = lzma
LZ4 = lz4
XZ = xz
+PYTEST = $(if $(shell command -v labgrid-pytest 2>/dev/null),labgrid-pytest,pytest)
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
CFLAGS_KERNEL =
@@ -1054,7 +1055,32 @@ endif
PHONY += install
+# Testing barebox
+# ---------------------------------------------------------------------------
+# This target has pytest select the YAML env matching CONFIG_NAME if available.
+# Use pytest --lg-env $labgrid_env_yaml directly if you need more than that.
+
+labgrid-env := $(srctree)/test/$(SRCARCH)/$(CONFIG_NAME).yaml
+
+check:
+ifeq ($(CONFIG_NAME),"")
+ @echo "error: can't autoload labgrid env with CONFIG_NAME unset!" >&2
+ @exit 1
+endif
+ @if [ ! -r "$(labgrid-env)" ]; then \
+ echo "error: No Labgrid environment at $(labgrid-env)!" >&2; \
+ echo "Choose a different config (or change CONFIG_NAME)" >&2; \
+ echo "that can be automatically tested" >&2; \
+ exit 1; \
+ fi
+ @echo
+ @# This is intentionally not @suppressed, to make it easier to reproduce
+ (cd $(srctree); $(PYTEST))
+
+PHONY += check
+
# barebox image
+# ---------------------------------------------------------------------------
barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE
$(call if_changed_rule,barebox__)
$(Q)rm -f .old_version
--
2.47.3
next reply other threads:[~2025-10-27 8:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 8:08 Ahmad Fatoum [this message]
2025-10-28 9:03 ` Sascha Hauer
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=20251027080832.1989341-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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