[PATCH v3 29/30] selftests/nolibc: Append extra cflags

Leo Yan posted 30 patches 1 month ago
There is a newer version of this series
[PATCH v3 29/30] selftests/nolibc: Append extra cflags
Posted by Leo Yan 1 month ago
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
--- a/tools/testing/selftests/nolibc/Makefile.nolibc
+++ b/tools/testing/selftests/nolibc/Makefile.nolibc
@@ -252,6 +252,9 @@ endif
 # Modify CFLAGS based on LLVM=
 include $(srctree)/tools/scripts/Makefile.include
 
+# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
+CFLAGS  += $(EXTRA_CFLAGS)
+
 REPORT  ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
 		/^Total number of errors:/{done++} \
 		END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \

-- 
2.34.1
Re: [PATCH v3 29/30] selftests/nolibc: Append extra cflags
Posted by Thomas Weißschuh 1 month ago
Hi Leo,

On 2026-03-08 16:46:34+0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>  tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
> index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
> --- a/tools/testing/selftests/nolibc/Makefile.nolibc
> +++ b/tools/testing/selftests/nolibc/Makefile.nolibc
> @@ -252,6 +252,9 @@ endif
>  # Modify CFLAGS based on LLVM=
>  include $(srctree)/tools/scripts/Makefile.include
>  
> +# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
> +CFLAGS  += $(EXTRA_CFLAGS)

Makefile.nolibc here is completely self-contained. It is not expected to
inherit any flags from the regular selftests. So I don't think this makes
sense. There is a similar, custom "CFLAGS_EXTRA" variable, which could
be aligned, but probably not as part of this series.

There is a regular 'Makefile' in this directory which *is* integrated
with the regular selftest build system. If you could make sure that
it works correctly with what you are doing, that would be great.


Thomas

> +
>  REPORT  ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
>  		/^Total number of errors:/{done++} \
>  		END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \
> 
> -- 
> 2.34.1
>
Re: [PATCH v3 29/30] selftests/nolibc: Append extra cflags
Posted by Leo Yan 4 weeks, 1 day ago
On Mon, Mar 09, 2026 at 11:24:58PM +0100, Thomas Weißschuh wrote:
> Hi Leo,
> 
> On 2026-03-08 16:46:34+0000, Leo Yan wrote:
> > Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> > the compiler.
> > 
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> > ---
> >  tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
> > index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
> > --- a/tools/testing/selftests/nolibc/Makefile.nolibc
> > +++ b/tools/testing/selftests/nolibc/Makefile.nolibc
> > @@ -252,6 +252,9 @@ endif
> >  # Modify CFLAGS based on LLVM=
> >  include $(srctree)/tools/scripts/Makefile.include
> >  
> > +# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
> > +CFLAGS  += $(EXTRA_CFLAGS)
> 
> Makefile.nolibc here is completely self-contained. It is not expected to
> inherit any flags from the regular selftests. So I don't think this makes
> sense. There is a similar, custom "CFLAGS_EXTRA" variable, which could
> be aligned, but probably not as part of this series.
> 
> There is a regular 'Makefile' in this directory which *is* integrated
> with the regular selftest build system. If you could make sure that
> it works correctly with what you are doing, that would be great.

Sure, I will update the regular Makefile.

As you suggested, I also will drop patch 18 in new version.

Thanks for suggestions!