Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/5] package/libc-test: new package
@ 2026-08-27 18:59 matt
  2026-08-27 18:59 ` [Buildroot] [PATCH 2/5] support/testing: add libc-test runtime test matt
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: matt @ 2026-08-27 18:59 UTC (permalink / raw)
  To: buildroot; +Cc: Matthew Weber, Clayton Shotwell

From: "Matthew Weber" <matthew.l.weber3@boeing.com>

Add the musl libc-test suite as a Buildroot target package. This
provides POSIX API conformance tests for musl libc covering the
upstream test suite.

Includes one patch:
- 0001: adds a cross-compilation build target

Tested using: https://gist.github.com/matthew-l-weber/a028a69bdbb99690a43b5729dcd641c5

Signed-off-by: Matthew Weber <matthew.l.weber3@boeing.com>
Signed-off-by: Clayton Shotwell <clayton.shotwell@boeing.com>
---
 DEVELOPERS                                    |  3 ++
 package/Config.in                             |  1 +
 ...d-build-target-for-cross-compilation.patch | 32 +++++++++++
 package/libc-test/Config.in                   | 14 +++++
 package/libc-test/libc-test.hash              |  3 ++
 package/libc-test/libc-test.mk                | 54 +++++++++++++++++++
 6 files changed, 107 insertions(+)
 create mode 100644 package/libc-test/0001-add-build-target-for-cross-compilation.patch
 create mode 100644 package/libc-test/Config.in
 create mode 100644 package/libc-test/libc-test.hash
 create mode 100644 package/libc-test/libc-test.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 5eb438906f..3fa3cf2378 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2394,6 +2394,9 @@ F:	package/gtkiostream/
 N:	Matt Silva <dev@matt-silva.com>
 F:	package/rlwrap/
 
+N:	Matthew Weber <matthew.l.weber3@boeing.com>
+F:	package/libc-test/
+
 N:	Maksim Kiselev <bigunclemax@gmail.com>
 F:	package/ledmon/
 
diff --git a/package/Config.in b/package/Config.in
index 6058800682..657e345c37 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -114,6 +114,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/kmemd/Config.in"
 	source "package/kvm-unit-tests/Config.in"
 	source "package/kyua/Config.in"
+	source "package/libc-test/Config.in"
 	source "package/libbpf/Config.in"
 	source "package/libtraceevent/Config.in"
 	source "package/libtracefs/Config.in"
diff --git a/package/libc-test/0001-add-build-target-for-cross-compilation.patch b/package/libc-test/0001-add-build-target-for-cross-compilation.patch
new file mode 100644
index 0000000000..8f711d7521
--- /dev/null
+++ b/package/libc-test/0001-add-build-target-for-cross-compilation.patch
@@ -0,0 +1,32 @@
+From cb892239cd677bd74a4633f1bcda02ac57b4e9d3 Mon Sep 17 00:00:00 2001
+From: "Weber (US), Matthew L" <matthew.l.weber3@boeing.com>
+Date: Wed, 22 Jul 2026 18:58:21 +0000
+Subject: [PATCH] add build target for cross-compilation
+
+The default 'all' target both builds and runs tests, which is not
+suitable for cross-compilation. Add a 'build' target that only
+compiles the test executables without attempting to run them on the
+build host.
+
+Upstream: https://repo.or.cz/libc-test.git (not yet submitted)
+Signed-off-by: Matthew Weber <matthew.l.weber3@boeing.com>
+---
+ Makefile | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index cf2ab2b..ccaec4e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -150,5 +150,7 @@ $(B)/%.exe: $(B)/%.o
+ %.err: %.exe
+ 	$(RUN_TEST) $< >$@ || true
+ 
+-.PHONY: all run clean cleanall
++build: $(BINS) $(LIBS)
++
++.PHONY: all run clean cleanall build
+ 
+-- 
+2.34.1
+
diff --git a/package/libc-test/Config.in b/package/libc-test/Config.in
new file mode 100644
index 0000000000..1c1553768a
--- /dev/null
+++ b/package/libc-test/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_LIBC_TEST
+	bool "libc-test"
+	depends on BR2_USE_MMU
+	help
+	  libc-test is a collection of programs for testing the
+	  C library implementation against the requirements of
+	  various standards (C99, POSIX, etc). It includes
+	  functional tests, regression tests, math conformance
+	  tests, and API header verification.
+
+	  This package is typically used with musl libc but also
+	  works with glibc and uClibc-ng.
+
+	  http://nsz.repo.hu/git/?p=libc-test
diff --git a/package/libc-test/libc-test.hash b/package/libc-test/libc-test.hash
new file mode 100644
index 0000000000..8209b84cbf
--- /dev/null
+++ b/package/libc-test/libc-test.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  93d659f35a129e39cc72efa52a0a059ffcbe5b39336126edff8d154588d821f6  libc-test-97e8e863b4fbfa7a9d74254a9a33db0a3dbf41a1-git4.tar.gz
+sha256  41b8f2e2706012eb534f89e72ff547308cb81dcb9acf077c40a9058a7c06088d  COPYRIGHT
diff --git a/package/libc-test/libc-test.mk b/package/libc-test/libc-test.mk
new file mode 100644
index 0000000000..30b3b72200
--- /dev/null
+++ b/package/libc-test/libc-test.mk
@@ -0,0 +1,54 @@
+################################################################################
+#
+# libc-test
+#
+################################################################################
+
+LIBC_TEST_VERSION = 97e8e863b4fbfa7a9d74254a9a33db0a3dbf41a1
+LIBC_TEST_SITE = https://repo.or.cz/libc-test.git
+LIBC_TEST_SITE_METHOD = git
+LIBC_TEST_LICENSE = MIT
+LIBC_TEST_LICENSE_FILES = COPYRIGHT
+
+# The upstream Makefile both builds and runs tests in the default target.
+# We only want to build during the Buildroot build phase; tests are run
+# on the target at runtime. Patch 0001 adds the "build" target.
+#
+# The Makefile uses config.mak for compiler flags. We generate one
+# suitable for musl (no glibc-specific libraries). The Makefile's own
+# CFLAGS already includes -I paths for the test framework headers, so
+# we must not override CFLAGS on the command line.
+define LIBC_TEST_CONFIGURE_CMDS
+	printf '%s\n' \
+		'CC = $(TARGET_CC)' \
+		'AR = $(TARGET_AR)' \
+		'RANLIB = $(TARGET_RANLIB)' \
+		'CFLAGS += -pipe -std=c99 -D_POSIX_C_SOURCE=200809L -Wall' \
+		'CFLAGS += -Wno-unused-function -Wno-missing-braces -Wno-unused' \
+		'CFLAGS += -Wno-overflow -Wno-unknown-pragmas -fno-builtin' \
+		'CFLAGS += -Werror=implicit-function-declaration' \
+		'CFLAGS += -Werror=implicit-int -Werror=pointer-sign' \
+		'LDLIBS += -lpthread -lm -lrt' \
+		> $(@D)/config.mak
+endef
+
+define LIBC_TEST_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) build
+endef
+
+define LIBC_TEST_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/usr/lib/libc-test/src/common
+	mkdir -p $(TARGET_DIR)/usr/lib/libc-test/src/functional
+	mkdir -p $(TARGET_DIR)/usr/lib/libc-test/src/math
+	mkdir -p $(TARGET_DIR)/usr/lib/libc-test/src/regression
+	cp -a $(@D)/src/common/runtest.exe \
+		$(TARGET_DIR)/usr/lib/libc-test/src/common/
+	find $(@D)/src/functional -name "*.exe" -exec cp {} \
+		$(TARGET_DIR)/usr/lib/libc-test/src/functional/ \;
+	find $(@D)/src/math -name "*.exe" -exec cp {} \
+		$(TARGET_DIR)/usr/lib/libc-test/src/math/ \;
+	find $(@D)/src/regression -name "*.exe" -exec cp {} \
+		$(TARGET_DIR)/usr/lib/libc-test/src/regression/ \;
+endef
+
+$(eval $(generic-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-09 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 18:59 [Buildroot] [PATCH 1/5] package/libc-test: new package matt
2026-08-27 18:59 ` [Buildroot] [PATCH 2/5] support/testing: add libc-test runtime test matt
2026-09-09 14:10   ` Thomas Petazzoni via buildroot
2026-08-27 18:59 ` [Buildroot] [PATCH 3/5] package/libc-test: add POSIX functional test extensions matt
2026-09-09 13:54   ` Thomas Petazzoni via buildroot
2026-08-27 18:59 ` [Buildroot] [PATCH 4/5] support/testing: libc-test: add POSIX functional test cases matt
2026-09-09 14:01 ` [Buildroot] [PATCH 1/5] package/libc-test: new package Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox