[PATCH v2] libsframe: testsuite: Fix testsuite build on Solaris

Alan Modra amodra@gmail.com
Sat Sep 6 00:48:16 GMT 2025


On Fri, Sep 05, 2025 at 01:25:02PM +0200, Rainer Orth wrote:
> Hi Alan,
> 
> >> Thanks for taking care of this.
> >>
> >> sframe-test.h in toplevel include/ looks odd IMO.  Adding to
> >> libsframe/testsuite/ folder along with the -I${top_srcdir}/testsuite
> >> addition in libsframe/testsuite/libsframe.decode/local.mk,
> >> libsframe/testsuite/libsframe.encode/local.mk,
> >> libsframe/testsuite/libsframe.find/local.mk may be a better thing to do.
> >
> > I thought about this, but this seems like lots of duplication to me.
> > Besides, these files are extremly repetetive, doing the same over and
> > over again.  I wonder if this cannot be simplified, avoiding the massive
> > duplication to improve maintainablitly?  Let's see what Alan thinks
> > about this.
> 
> any word on how to handle this.  The current duplication worries me,
> especially for a patch that tries to reduce duplication in one place
> increasing duplication even more in a different place.

Did you try putting the new include file in libsframe/?  I agree with
Indu that sframe-test.h does not belong in the top level include/.

Or even fix the makefile fragment duplication like this, and put
sframe-test.h in libsframe/testsuite.  I've taken out -Wall from
testsuite_CPPFLAGS and -I$(srcdir) from AM_CPPFLAGS because they don't
seem to be needed.

The testsuite object file naming is somewhat annoying too.  I don't
know how to wrestle automake into dropping testsuite_libsframe_decode_
prefix here:
  CC       testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o


diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am
index 89e471fd3d5..864e4975e8c 100644
--- a/libsframe/Makefile.am
+++ b/libsframe/Makefile.am
@@ -27,7 +27,7 @@ MAINTAINERCLEANFILES =
 
 INCDIR = $(srcdir)/../include
 # include libctf for swap.h
-AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf
+AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../libctf
 AM_CFLAGS = @ac_libsframe_warn_cflags@
 libsframe_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
 # libsframe does not restrict the set of exported symbols.  So, if linker does
diff --git a/libsframe/testsuite/local.mk b/libsframe/testsuite/local.mk
index 5e5ba927f75..4f2ea9b8710 100644
--- a/libsframe/testsuite/local.mk
+++ b/libsframe/testsuite/local.mk
@@ -19,6 +19,9 @@ check-DEJAGNU: site.exp
 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi
 
+testsuite_LDADD = $(top_builddir)/libsframe.la
+testsuite_CPPFLAGS = -I$(srcdir)/testsuite -I$(srcdir)/../include
+
 # libsframe encoder/decoder/find testsuite
 include %D%/libsframe.decode/local.mk
 include %D%/libsframe.encode/local.mk
diff --git a/libsframe/testsuite/libsframe.decode/local.mk b/libsframe/testsuite/libsframe.decode/local.mk
index 0e4279b8c8e..de34bbcfab8 100644
--- a/libsframe/testsuite/libsframe.decode/local.mk
+++ b/libsframe/testsuite/libsframe.decode/local.mk
@@ -4,13 +4,13 @@ if HAVE_COMPAT_DEJAGNU
 endif
 
 %C%_be_flipping_SOURCES = %D%/be-flipping.c
-%C%_be_flipping_LDADD = ${top_builddir}/libsframe.la
-%C%_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_be_flipping_LDADD = $(testsuite_LDADD)
+%C%_be_flipping_CPPFLAGS = $(testsuite_CPPFLAGS)
 
 %C%_frecnt_1_SOURCES = %D%/frecnt-1.c
-%C%_frecnt_1_LDADD = ${top_builddir}/libsframe.la
-%C%_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_frecnt_1_LDADD = $(testsuite_LDADD)
+%C%_frecnt_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 
 %C%_frecnt_2_SOURCES = %D%/frecnt-2.c
-%C%_frecnt_2_LDADD = ${top_builddir}/libsframe.la 
-%C%_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_frecnt_2_LDADD = $(testsuite_LDADD)
+%C%_frecnt_2_CPPFLAGS = $(testsuite_CPPFLAGS)
diff --git a/libsframe/testsuite/libsframe.encode/local.mk b/libsframe/testsuite/libsframe.encode/local.mk
index 477d4b64929..6b09651dc7b 100644
--- a/libsframe/testsuite/libsframe.encode/local.mk
+++ b/libsframe/testsuite/libsframe.encode/local.mk
@@ -3,5 +3,5 @@ if HAVE_COMPAT_DEJAGNU
 endif
 
 %C%_encode_1_SOURCES = %D%/encode-1.c
-%C%_encode_1_LDADD = ${top_builddir}/libsframe.la
-%C%_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_encode_1_LDADD = $(testsuite_LDADD)
+%C%_encode_1_CPPFLAGS = $(testsuite_CPPFLAGS)
diff --git a/libsframe/testsuite/libsframe.find/local.mk b/libsframe/testsuite/libsframe.find/local.mk
index 52741e8063d..05c7a10a8db 100644
--- a/libsframe/testsuite/libsframe.find/local.mk
+++ b/libsframe/testsuite/libsframe.find/local.mk
@@ -4,17 +4,17 @@ if HAVE_COMPAT_DEJAGNU
 endif
 
 %C%_findfre_1_SOURCES = %D%/findfre-1.c
-%C%_findfre_1_LDADD = ${top_builddir}/libsframe.la
-%C%_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_findfre_1_LDADD = $(testsuite_LDADD)
+%C%_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 
 %C%_findfunc_1_SOURCES = %D%/findfunc-1.c
-%C%_findfunc_1_LDADD = ${top_builddir}/libsframe.la
-%C%_findfunc_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_findfunc_1_LDADD = $(testsuite_LDADD)
+%C%_findfunc_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 
 %C%_plt_findfre_1_SOURCES = %D%/plt-findfre-1.c
-%C%_plt_findfre_1_LDADD = ${top_builddir}/libsframe.la
-%C%_plt_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_plt_findfre_1_LDADD = $(testsuite_LDADD)
+%C%_plt_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 
 %C%_plt_findfre_2_SOURCES = %D%/plt-findfre-2.c
-%C%_plt_findfre_2_LDADD = ${top_builddir}/libsframe.la
-%C%_plt_findfre_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_plt_findfre_2_LDADD = $(testsuite_LDADD)
+%C%_plt_findfre_2_CPPFLAGS = $(testsuite_CPPFLAGS)

-- 
Alan Modra


More information about the Binutils mailing list