Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: matt@thewebers.ws
Cc: buildroot@buildroot.org,
	Matthew Weber <matthew.l.weber3@boeing.com>,
	 Clayton Shotwell <clayton.shotwell@boeing.com>
Subject: Re: [Buildroot] [PATCH 1/5] package/libc-test: new package
Date: Wed, 9 Sep 2026 16:01:15 +0200	[thread overview]
Message-ID: <aqFllswijRr-sqsf@windsurf> (raw)
In-Reply-To: <20260827185951.3180679-1-matt@thewebers.ws>

Hello,

On Thu, Aug 27, 2026 at 06:59:48PM +0000, matt@thewebers.ws wrote:
> 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>

Thanks for this contribution, which makes sense.

Note that we received PATCH 1/5, 2/5, 3/5 and 4/5 on the mailing list,
but not PATCH 5/5. Is it intentional, or was there a technical issue
along the way?

> 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)

Can you submit it? It seems simple and reasonable.

> +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/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.

I'm not sure how relevant that is here. At best this should go above
the LIBC_TEST_BUILD_CMDS.

> +# The Makefile uses config.mak for compiler flags. We generate one
> +# suitable for musl (no glibc-specific libraries). The Makefile's own

I don't think it makes sense to generate "one suitable for musl" since
the package is musl-independent: it can be used for musl, uclibc-ng,
glibc.

> +# 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' \

Why do we need those gazillions CFLAGS? I mean in the context of
Buildroot, we don't really care about all those warnings. Same for
-pipe, etc.

> +		'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/

$(INSTALL) -D -m 0755 $(@D)/src/common/runtest.exe \
	   $(TARGET_DIR)/usr/lib/libc-test/src/common/runtest.exe

> +	find $(@D)/src/functional -name "*.exe" -exec cp {} \
> +		$(TARGET_DIR)/usr/lib/libc-test/src/functional/ \;

	find $(@D)/src/functional -name "*.exe" -exec \
		$(INSTALL) -D -m 0755 {} \
		$(TARGET_DIR)/usr/lib/libc-test/{} \;

and then drop the mkdir -p above.

> +	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/ \;

Ditto.

Of course, completely untested :-)

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Thomas Petazzoni via buildroot [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=aqFllswijRr-sqsf@windsurf \
    --to=buildroot@buildroot.org \
    --cc=clayton.shotwell@boeing.com \
    --cc=matt@thewebers.ws \
    --cc=matthew.l.weber3@boeing.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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