Re: [RFC PATCH 4/6] selftests: fix build errors on alpine linux

Hajime Tazaki <[email protected]>
Newsgroups gmane.linux.uml.devel,gmane.linux.kernel.mm
Message-ID <[email protected]>
On Fri, 14 Aug 2026 21:39:33 +0900,
Lorenzo Stoakes (ARM) wrote:
> 
> On Thu, Aug 13, 2026 at 03:33:59PM +0900, Hajime Tazaki wrote:
> > Some nommu architectures only work on Alpine Linux, which doesn't use
> > glibc for the standard library.  It uses musl-libc and is implemented in
> > a different way as glibc, resulting build failures.
> >
> > This commit fixes this issue by adding missing definitions. The fixes
> > are now only covered to TARGETS=mm which was tested for the moment;
> > future contributions are needed to fully build/execute tests on nommu
> > platforms.
> >
> > Cc: Shuah Khan <[email protected]>
> > Cc: Andrew Morton <[email protected]>
> > Cc: David Hildenbrand <[email protected]>
> > Cc: Lorenzo Stoakes <[email protected]>
> > Cc: "Liam R. Howlett" <[email protected]>
> > Cc: Vlastimil Babka <[email protected]>
> > Cc: Mike Rapoport <[email protected]>
> > Cc: Suren Baghdasaryan <[email protected]>
> > Cc: Michal Hocko <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Hajime Tazaki <[email protected]>
> 
> I mean vaguely looks un-invasive which is the test here.
> 
> Couple comments below.
(snip)
> > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> > index f02cc8a2e4ae..2cc819006424 100644
> > --- a/tools/testing/selftests/lib.mk
> > +++ b/tools/testing/selftests/lib.mk
> > @@ -197,7 +197,7 @@ clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
> >  	$(CLEAN)
> >
> >  # Build with _GNU_SOURCE by default
> 
> You probably want to update this comment.

indeed, will update this part (may even not needed to modify this).

> > -CFLAGS += -D_GNU_SOURCE=
> > +CFLAGS += -D_GNU_SOURCE= -D_LARGEFILE64_SOURCE

(snip)
> > diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
> > index fb4600570e13..aee6be530ccb 100644
> > --- a/tools/testing/selftests/mm/hugetlb_dio.c
> > +++ b/tools/testing/selftests/mm/hugetlb_dio.c
> > @@ -22,12 +22,9 @@
> >  #include "kselftest.h"
> >  #include "hugepage_settings.h"
> >
> > -#ifndef STATX_DIOALIGN
> > -#define STATX_DIOALIGN		0x00002000U
> > -#endif
> > -
> >  static int get_dio_alignment(int fd)
> >  {
> > +#ifdef STATX_DIOALIGN
> >  	struct statx stx;
> >  	int ret;
> >
> > @@ -43,6 +40,9 @@ static int get_dio_alignment(int fd)
> >  		return 1;
> >
> >  	return stx.stx_dio_offset_align;
> > +#else
> > +	return -1;
> > +#endif
> 
> Probably better to declare different functions to make this less hideous.

I see your point.  will look for the other way.

-- Hajime
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.