[v3] libsframe: testsuite: Fix testsuite build on Solaris

Message ID yddy0qn4m73.fsf_-_@CeBiTec.Uni-Bielefeld.DE
State New
Headers
Series [v3] libsframe: testsuite: Fix testsuite build on Solaris |

Commit Message

Rainer Orth Sept. 9, 2025, 4:36 p.m. UTC
  As reported in PR libsframe/33168, the libsframe tests don't build on
Solaris.  The failure is

In file included from libsframe/testsuite/libsframe.decode/be-flipping.c:28:
/usr/include/dejagnu.h:48:1: error: conflicting types for ‘wait’; have ‘void(void)’
   48 | wait (void)
      | ^~~~
In file included from /usr/include/stdlib.h:16,
                 from libsframe/testsuite/libsframe.decode/be-flipping.c:21:
/usr/include/sys/wait.h:85:14: note: previous declaration of ‘wait’ with type ‘pid_t(int *)’ {aka ‘long int(int *)’}
   85 | extern pid_t wait(int *);
      |              ^~~~

We have a combination of two factors here:

* Solaris <stdlib.h> has

#if defined(__EXTENSIONS__) || defined(_XPG4)
#include <sys/wait.h>
#endif

  and configure.ac predefines __EXTENSIONS__ due to the use of
  AC_USE_SYSTEM_EXTENSIONS.

* This conflicts with <dejagnu.h>'s definition

void
wait (void) 
{
...
}

While this version of wait was removed in upstream DejaGnu, the removal
only happened after the latest release, 1.6.3.

To avoid this, I've moved all testsuite includes into a new
sframe-test.h, adding a workaround for the wait conflict.

-Wall and -I$(srcdir) have been removed from AM_CPPFLAGS since they
don't seem to be needed.  To fix the Makefile fragment duplication, the
local.mk files now use $(testsuite_LDADD) and $(testsuite_CPPFLAGS)
throughout.

Tested on {i386,amd64}-pc-solaris2.11, {sparc,sparcv9}-sun-solaris2.11,
{x86_64,i686}-pc-linux-gnu, and amd64-pc-freebsd14.0.

Coauthored-By: Alan Modra <amodra@gmail.com>

Ok for trunk?

	Rainer
  

Comments

Alan Modra Sept. 9, 2025, 9:41 p.m. UTC | #1
On Tue, Sep 09, 2025 at 06:36:48PM +0200, Rainer Orth wrote:
> Ok for trunk?

This looks good to me, but wait for Indu's OK.
  
Indu Bhagat Sept. 10, 2025, 6:33 a.m. UTC | #2
On 9/9/25 9:36 AM, Rainer Orth wrote:
> As reported in PR libsframe/33168, the libsframe tests don't build on
> Solaris.  The failure is
> 
> In file included from libsframe/testsuite/libsframe.decode/be-flipping.c:28:
> /usr/include/dejagnu.h:48:1: error: conflicting types for ‘wait’; have ‘void(void)’
>     48 | wait (void)
>        | ^~~~
> In file included from /usr/include/stdlib.h:16,
>                   from libsframe/testsuite/libsframe.decode/be-flipping.c:21:
> /usr/include/sys/wait.h:85:14: note: previous declaration of ‘wait’ with type ‘pid_t(int *)’ {aka ‘long int(int *)’}
>     85 | extern pid_t wait(int *);
>        |              ^~~~
> 
> We have a combination of two factors here:
> 
> * Solaris <stdlib.h> has
> 
> #if defined(__EXTENSIONS__) || defined(_XPG4)
> #include <sys/wait.h>
> #endif
> 
>    and configure.ac predefines __EXTENSIONS__ due to the use of
>    AC_USE_SYSTEM_EXTENSIONS.
> 
> * This conflicts with <dejagnu.h>'s definition
> 
> void
> wait (void)
> {
> ...
> }
> 
> While this version of wait was removed in upstream DejaGnu, the removal
> only happened after the latest release, 1.6.3.
> 
> To avoid this, I've moved all testsuite includes into a new
> sframe-test.h, adding a workaround for the wait conflict.
> 
> -Wall and -I$(srcdir) have been removed from AM_CPPFLAGS since they
> don't seem to be needed.  To fix the Makefile fragment duplication, the
> local.mk files now use $(testsuite_LDADD) and $(testsuite_CPPFLAGS)
> throughout.
> 
> Tested on {i386,amd64}-pc-solaris2.11, {sparc,sparcv9}-sun-solaris2.11,
> {x86_64,i686}-pc-linux-gnu, and amd64-pc-freebsd14.0.
> 
> Coauthored-By: Alan Modra<amodra@gmail.com>
> 
> Ok for trunk?

Patch looks good to me.  Two comments inlined below.

Thanks for doing this.  This being your work/fix, I've reassigned the PR 
33168 to you.  It will be good to add a "PR libsframe/33168" to the 
commit log for marking the fix.

Thanks
Indu

> 
> 	Rainer
> 
> -- 
> ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University
> 
> 
> sol2-libsframe-testsuite-dg.patch
> 
> # HG changeset patch
> # Parent  09bfbccd94ccc0b3e0efcd20831e30014192dafc
> libsframe: testsuite: Fix testsuite build on Solaris [PR33168]
> 
> diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am
> --- 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/Makefile.in b/libsframe/Makefile.in
> --- a/libsframe/Makefile.in
> +++ b/libsframe/Makefile.in
> @@ -201,42 +201,37 @@ am_testsuite_libsframe_decode_be_flippin
>   testsuite_libsframe_decode_be_flipping_OBJECTS =  \
>   	$(am_testsuite_libsframe_decode_be_flipping_OBJECTS)
>   testsuite_libsframe_decode_be_flipping_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +	$(testsuite_LDADD)
>   am_testsuite_libsframe_decode_frecnt_1_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.$(OBJEXT)
>   testsuite_libsframe_decode_frecnt_1_OBJECTS =  \
>   	$(am_testsuite_libsframe_decode_frecnt_1_OBJECTS)
> -testsuite_libsframe_decode_frecnt_1_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +testsuite_libsframe_decode_frecnt_1_DEPENDENCIES = $(testsuite_LDADD)
>   am_testsuite_libsframe_decode_frecnt_2_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.$(OBJEXT)
>   testsuite_libsframe_decode_frecnt_2_OBJECTS =  \
>   	$(am_testsuite_libsframe_decode_frecnt_2_OBJECTS)
> -testsuite_libsframe_decode_frecnt_2_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +testsuite_libsframe_decode_frecnt_2_DEPENDENCIES = $(testsuite_LDADD)
>   am_testsuite_libsframe_encode_encode_1_OBJECTS = testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.$(OBJEXT)
>   testsuite_libsframe_encode_encode_1_OBJECTS =  \
>   	$(am_testsuite_libsframe_encode_encode_1_OBJECTS)
> -testsuite_libsframe_encode_encode_1_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +testsuite_libsframe_encode_encode_1_DEPENDENCIES = $(testsuite_LDADD)
>   am_testsuite_libsframe_find_findfre_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_findfre_1-findfre-1.$(OBJEXT)
>   testsuite_libsframe_find_findfre_1_OBJECTS =  \
>   	$(am_testsuite_libsframe_find_findfre_1_OBJECTS)
> -testsuite_libsframe_find_findfre_1_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +testsuite_libsframe_find_findfre_1_DEPENDENCIES = $(testsuite_LDADD)
>   am_testsuite_libsframe_find_findfunc_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_findfunc_1-findfunc-1.$(OBJEXT)
>   testsuite_libsframe_find_findfunc_1_OBJECTS =  \
>   	$(am_testsuite_libsframe_find_findfunc_1_OBJECTS)
> -testsuite_libsframe_find_findfunc_1_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +testsuite_libsframe_find_findfunc_1_DEPENDENCIES = $(testsuite_LDADD)
>   am_testsuite_libsframe_find_plt_findfre_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_plt_findfre_1-plt-findfre-1.$(OBJEXT)
>   testsuite_libsframe_find_plt_findfre_1_OBJECTS =  \
>   	$(am_testsuite_libsframe_find_plt_findfre_1_OBJECTS)
>   testsuite_libsframe_find_plt_findfre_1_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +	$(testsuite_LDADD)
>   am_testsuite_libsframe_find_plt_findfre_2_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_plt_findfre_2-plt-findfre-2.$(OBJEXT)
>   testsuite_libsframe_find_plt_findfre_2_OBJECTS =  \
>   	$(am_testsuite_libsframe_find_plt_findfre_2_OBJECTS)
>   testsuite_libsframe_find_plt_findfre_2_DEPENDENCIES =  \
> -	${top_builddir}/libsframe.la
> +	$(testsuite_LDADD)
>   AM_V_P = $(am__v_P_@AM_V@)
>   am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
>   am__v_P_0 = false
> @@ -535,7 +530,7 @@ DISTCLEANFILES = $(am__append_2)
>   MAINTAINERCLEANFILES = $(am__append_3)
>   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`
>   @HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@libsframe_version_script = -Wl,--version-script=$(srcdir)/libsframe.ver
> @@ -557,30 +552,32 @@ EXTRA_DIST = libtool-version libsframe.v
>   EXPECT = expect
>   RUNTEST = runtest
>   RUNTESTFLAGS =
> +testsuite_LDADD = $(top_builddir)/libsframe.la
> +testsuite_CPPFLAGS = -I$(srcdir)/testsuite -I$(srcdir)/../include
>   testsuite_libsframe_decode_be_flipping_SOURCES = testsuite/libsframe.decode/be-flipping.c
> -testsuite_libsframe_decode_be_flipping_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_decode_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_decode_be_flipping_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_decode_be_flipping_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_decode_frecnt_1_SOURCES = testsuite/libsframe.decode/frecnt-1.c
> -testsuite_libsframe_decode_frecnt_1_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_decode_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_decode_frecnt_1_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_decode_frecnt_1_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_decode_frecnt_2_SOURCES = testsuite/libsframe.decode/frecnt-2.c
> -testsuite_libsframe_decode_frecnt_2_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_decode_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_decode_frecnt_2_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_decode_frecnt_2_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_encode_encode_1_SOURCES = testsuite/libsframe.encode/encode-1.c
> -testsuite_libsframe_encode_encode_1_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_encode_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_encode_encode_1_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_encode_encode_1_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_find_findfre_1_SOURCES = testsuite/libsframe.find/findfre-1.c
> -testsuite_libsframe_find_findfre_1_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_find_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_find_findfre_1_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_find_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_find_findfunc_1_SOURCES = testsuite/libsframe.find/findfunc-1.c
> -testsuite_libsframe_find_findfunc_1_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_find_findfunc_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_find_findfunc_1_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_find_findfunc_1_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_find_plt_findfre_1_SOURCES = testsuite/libsframe.find/plt-findfre-1.c
> -testsuite_libsframe_find_plt_findfre_1_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_find_plt_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_find_plt_findfre_1_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_find_plt_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
>   testsuite_libsframe_find_plt_findfre_2_SOURCES = testsuite/libsframe.find/plt-findfre-2.c
> -testsuite_libsframe_find_plt_findfre_2_LDADD = ${top_builddir}/libsframe.la
> -testsuite_libsframe_find_plt_findfre_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
> +testsuite_libsframe_find_plt_findfre_2_LDADD = $(testsuite_LDADD)
> +testsuite_libsframe_find_plt_findfre_2_CPPFLAGS = $(testsuite_CPPFLAGS)
>   all: config.h
>   	$(MAKE) $(AM_MAKEFLAGS) all-am
>   
> diff --git a/libsframe/testsuite/libsframe.decode/be-flipping.c b/libsframe/testsuite/libsframe.decode/be-flipping.c
> --- a/libsframe/testsuite/libsframe.decode/be-flipping.c
> +++ b/libsframe/testsuite/libsframe.decode/be-flipping.c
> @@ -15,17 +15,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   /* SFrame info from the following source (1 fde 5 fres):
>      static int cnt;
> diff --git a/libsframe/testsuite/libsframe.decode/frecnt-1.c b/libsframe/testsuite/libsframe.decode/frecnt-1.c
> --- a/libsframe/testsuite/libsframe.decode/frecnt-1.c
> +++ b/libsframe/testsuite/libsframe.decode/frecnt-1.c
> @@ -15,17 +15,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   /*
>    * SFrame info from the following source (1 fde 4 fres):
> diff --git a/libsframe/testsuite/libsframe.decode/frecnt-2.c b/libsframe/testsuite/libsframe.decode/frecnt-2.c
> --- a/libsframe/testsuite/libsframe.decode/frecnt-2.c
> +++ b/libsframe/testsuite/libsframe.decode/frecnt-2.c
> @@ -15,17 +15,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   /*
>    * SFrame info from the following source (2 fde 8 fres):
> diff --git a/libsframe/testsuite/libsframe.decode/local.mk b/libsframe/testsuite/libsframe.decode/local.mk
> --- 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/encode-1.c b/libsframe/testsuite/libsframe.encode/encode-1.c
> --- a/libsframe/testsuite/libsframe.encode/encode-1.c
> +++ b/libsframe/testsuite/libsframe.encode/encode-1.c
> @@ -15,17 +15,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   static int
>   add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
> diff --git a/libsframe/testsuite/libsframe.encode/local.mk b/libsframe/testsuite/libsframe.encode/local.mk
> --- 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/findfre-1.c b/libsframe/testsuite/libsframe.find/findfre-1.c
> --- a/libsframe/testsuite/libsframe.find/findfre-1.c
> +++ b/libsframe/testsuite/libsframe.find/findfre-1.c
> @@ -15,17 +15,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   static int
>   add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
> diff --git a/libsframe/testsuite/libsframe.find/findfunc-1.c b/libsframe/testsuite/libsframe.find/findfunc-1.c
> --- a/libsframe/testsuite/libsframe.find/findfunc-1.c
> +++ b/libsframe/testsuite/libsframe.find/findfunc-1.c
> @@ -22,17 +22,7 @@
>      The tests in here stress the sframe_get_funcdesc_with_addr API via calls to
>      the sframe_find_fre ().  */
>   
> -#include "config.h"
> -
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   static int
>   add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
> diff --git a/libsframe/testsuite/libsframe.find/local.mk b/libsframe/testsuite/libsframe.find/local.mk
> --- 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)
> diff --git a/libsframe/testsuite/libsframe.find/plt-findfre-1.c b/libsframe/testsuite/libsframe.find/plt-findfre-1.c
> --- a/libsframe/testsuite/libsframe.find/plt-findfre-1.c
> +++ b/libsframe/testsuite/libsframe.find/plt-findfre-1.c
> @@ -15,17 +15,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   static int
>   add_plt_fde1 (sframe_encoder_ctx *ectx, uint32_t plt_vaddr,
> diff --git a/libsframe/testsuite/libsframe.find/plt-findfre-2.c b/libsframe/testsuite/libsframe.find/plt-findfre-2.c
> --- a/libsframe/testsuite/libsframe.find/plt-findfre-2.c
> +++ b/libsframe/testsuite/libsframe.find/plt-findfre-2.c
> @@ -16,17 +16,7 @@
>      You should have received a copy of the GNU General Public License
>      along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
>   
> -#include "config.h"
> -
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/stat.h>
> -
> -#include "sframe-api.h"
> -
> -/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> -#undef vsnprintf
> -#include <dejagnu.h>
> +#include "sframe-test.h"
>   
>   /* s390x-specific size in bytes of plt0 and pltN.  */
>   #define PLT_SIZE 32
> diff --git a/libsframe/testsuite/local.mk b/libsframe/testsuite/local.mk
> --- 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/sframe-test.h b/libsframe/testsuite/sframe-test.h
> new file mode 100644
> --- /dev/null
> +++ b/libsframe/testsuite/sframe-test.h
> @@ -0,0 +1,40 @@
> +/* sframe-test.h -- Common libsframe testsuite header.
> +
> +   Copyright (C) 2022-2025 Free Software Foundation, Inc.
> +

Typo: 2022-2025 --> 2025

> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see<http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _SFRAME_TEST_H
> +#define _SFRAME_TEST_H
> +
> +#include "config.h"
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <sys/stat.h>
> +
> +#include "sframe-api.h"
> +
> +/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
> +#undef vsnprintf
> +
> +/* PR 33168: Solaris <sys/wait.h> with __EXTENSIONS__ defined gets a
> +   declaration of wait().  This conflicts with <dejagnu.h>'s wait
> +   definition that is only removed after DejaGnu 1.6.3.  */
> +#define wait dg_wait
> +#include <dejagnu.h>
> +#undef wait
> +
> +#endif /* _SFRAME_TEST_H */
> 

Although the -Wall for testsuite was redundant, just wanted to point out 
that removing it is not enough to address the current warnings seen:

In file included from 
<src-path>/libsframe/testsuite/libsframe.decode/frecnt-1.c:18:
<src-path>/libsframe/testsuite/sframe-test.h:36:14: warning: no previous 
prototype for ‘dg_wait’ [-Wmissing-prototypes]
    36 | #define wait dg_wait
       |              ^~~~~~~

Personally, I find the warning distracting in the logs. The buildbot 
does seem to track warnings for testsuite too, so it might complain 
about the new warnings in the testsuite.

If adding a prototype "void wait (void);" is not preferable, we can add 
-Wno-missing-prototypes for the testsuite ?

Thanks
Indu
  
Rainer Orth Sept. 10, 2025, 7:32 a.m. UTC | #3
Hi Indu,

>> Tested on {i386,amd64}-pc-solaris2.11, {sparc,sparcv9}-sun-solaris2.11,
>> {x86_64,i686}-pc-linux-gnu, and amd64-pc-freebsd14.0.
>> Coauthored-By: Alan Modra<amodra@gmail.com>
>> Ok for trunk?
>
> Patch looks good to me.  Two comments inlined below.

thanks.

> Thanks for doing this.  This being your work/fix, I've reassigned the PR
> 33168 to you.  It will be good to add a "PR libsframe/33168" to the commit
> log for marking the fix.

That's one thing I wondered about: libsframe currently doesn't have no
ChangeLog file.  Unlike over in gcc, that's not generated from the
commit messages.  So far I missed that the libsfram commit message *do*
include ChangeLog snippets.  I'll add one to the commit, together with
the PR reference.

Maybe it would be best to follow the rest of binutils and start manually
adding the entries to an actual ChangeLog file?  That would be less
confusing and make the project consistent in this regard.  However, I'd
actually prefer if binutils could just follow gcc's lead and extract the
info from the commit messages: it avoids the cumbersome and easily
forgotten step of manually adding them at commit time.

>> diff --git a/libsframe/testsuite/sframe-test.h b/libsframe/testsuite/sframe-test.h
>> new file mode 100644
>> --- /dev/null
>> +++ b/libsframe/testsuite/sframe-test.h
>> @@ -0,0 +1,40 @@
>> +/* sframe-test.h -- Common libsframe testsuite header.
>> +
>> +   Copyright (C) 2022-2025 Free Software Foundation, Inc.
>> +
>
> Typo: 2022-2025 --> 2025

Really?  The bulk of the file is just copied from existing code.
Shouldn't it retain that code's date range?

>> +/* PR 33168: Solaris <sys/wait.h> with __EXTENSIONS__ defined gets a
>> +   declaration of wait().  This conflicts with <dejagnu.h>'s wait
>> +   definition that is only removed after DejaGnu 1.6.3.  */
>> +#define wait dg_wait
>> +#include <dejagnu.h>
>> +#undef wait
>> +
>> +#endif /* _SFRAME_TEST_H */
>> 
>
> Although the -Wall for testsuite was redundant, just wanted to point out
> that removing it is not enough to address the current warnings seen:
>
> In file included from
> <src-path>/libsframe/testsuite/libsframe.decode/frecnt-1.c:18:
> <src-path>/libsframe/testsuite/sframe-test.h:36:14: warning: no previous
> prototype for ‘dg_wait’ [-Wmissing-prototypes]
>    36 | #define wait dg_wait
>       |              ^~~~~~~

Sorry I missed that: the make check is usually too verbose to check on
anything but complete failures.

> Personally, I find the warning distracting in the logs. The buildbot does
> seem to track warnings for testsuite too, so it might complain about the
> new warnings in the testsuite.

Agreed.

> If adding a prototype "void wait (void);" is not preferable, we can add
> -Wno-missing-prototypes for the testsuite ?

I prefer the prototype route over the warning myself if it works.

Should I just commit the final patch with those updates or post a v4?

Thanks.

	Rainer
  
Indu Bhagat Sept. 10, 2025, 8:09 a.m. UTC | #4
On 9/10/25 12:32 AM, Rainer Orth wrote:
> Hi Indu,
> 
>>> Tested on {i386,amd64}-pc-solaris2.11, {sparc,sparcv9}-sun-solaris2.11,
>>> {x86_64,i686}-pc-linux-gnu, and amd64-pc-freebsd14.0.
>>> Coauthored-By: Alan Modra<amodra@gmail.com>
>>> Ok for trunk?
>>
>> Patch looks good to me.  Two comments inlined below.
> 
> thanks.
> 
>> Thanks for doing this.  This being your work/fix, I've reassigned the PR
>> 33168 to you.  It will be good to add a "PR libsframe/33168" to the commit
>> log for marking the fix.
> 
> That's one thing I wondered about: libsframe currently doesn't have no
> ChangeLog file.  Unlike over in gcc, that's not generated from the
> commit messages.  So far I missed that the libsfram commit message *do*
> include ChangeLog snippets.  I'll add one to the commit, together with
> the PR reference.
> 

Thanks.

BTW, Yes, I tend to include ChangeLog snippets in my own commits, as I 
find them helpful.  This is _not_ mandatory wrt Binutils commit log 
guidelines.

> Maybe it would be best to follow the rest of binutils and start manually
> adding the entries to an actual ChangeLog file?  

It is my understanding that in Binutils, it is not required to add 
entries to a ChangeLog file anymore.

But that said, adding a ChangeLog snippet in commit log is orthogonal to 
adding a "PR libsframe/33168" to commit log.  The post commit hooks will 
DTRT with just that string in the commit log.

That would be less
> confusing and make the project consistent in this regard.  However, I'd
> actually prefer if binutils could just follow gcc's lead and extract the
> info from the commit messages: it avoids the cumbersome and easily
> forgotten step of manually adding them at commit time.
> >>> diff --git a/libsframe/testsuite/sframe-test.h 
b/libsframe/testsuite/sframe-test.h
>>> new file mode 100644
>>> --- /dev/null
>>> +++ b/libsframe/testsuite/sframe-test.h
>>> @@ -0,0 +1,40 @@
>>> +/* sframe-test.h -- Common libsframe testsuite header.
>>> +
>>> +   Copyright (C) 2022-2025 Free Software Foundation, Inc.
>>> +
>>
>> Typo: 2022-2025 --> 2025
> 
> Really?  The bulk of the file is just copied from existing code.
> Shouldn't it retain that code's date range?
> 

I usually follow the rule of keeping the current year for a new file, 
since the file did not exist prior to date.  May be someone else can 
confirm whats more appropriate here.

>>> +/* PR 33168: Solaris <sys/wait.h> with __EXTENSIONS__ defined gets a
>>> +   declaration of wait().  This conflicts with <dejagnu.h>'s wait
>>> +   definition that is only removed after DejaGnu 1.6.3.  */
>>> +#define wait dg_wait
>>> +#include <dejagnu.h>
>>> +#undef wait
>>> +
>>> +#endif /* _SFRAME_TEST_H */
>>>
>>
>> Although the -Wall for testsuite was redundant, just wanted to point out
>> that removing it is not enough to address the current warnings seen:
>>
>> In file included from
>> <src-path>/libsframe/testsuite/libsframe.decode/frecnt-1.c:18:
>> <src-path>/libsframe/testsuite/sframe-test.h:36:14: warning: no previous
>> prototype for ‘dg_wait’ [-Wmissing-prototypes]
>>     36 | #define wait dg_wait
>>        |              ^~~~~~~
> 
> Sorry I missed that: the make check is usually too verbose to check on
> anything but complete failures.
> 
>> Personally, I find the warning distracting in the logs. The buildbot does
>> seem to track warnings for testsuite too, so it might complain about the
>> new warnings in the testsuite.
> 
> Agreed.
> 
>> If adding a prototype "void wait (void);" is not preferable, we can add
>> -Wno-missing-prototypes for the testsuite ?
> 
> I prefer the prototype route over the warning myself if it works.
> 
> Should I just commit the final patch with those updates or post a v4?
> 

Please go ahead and commit.  Thanks.
  
Rainer Orth Sept. 12, 2025, 7:56 a.m. UTC | #5
Hi Indu,

>>> Thanks for doing this.  This being your work/fix, I've reassigned the PR
>>> 33168 to you.  It will be good to add a "PR libsframe/33168" to the commit
>>> log for marking the fix.
>> That's one thing I wondered about: libsframe currently doesn't have no
>> ChangeLog file.  Unlike over in gcc, that's not generated from the
>> commit messages.  So far I missed that the libsfram commit message *do*
>> include ChangeLog snippets.  I'll add one to the commit, together with
>> the PR reference.
>> 
>
> Thanks.
>
> BTW, Yes, I tend to include ChangeLog snippets in my own commits, as I find
> them helpful.  This is _not_ mandatory wrt Binutils commit log guidelines.

You're right: I missed that part of

https://sourceware.org/binutils/wiki/HowToContribute

Changed files should be named in the accompanying email, and if
ChangeLog files are being updated, then there too.

Since there's no libsframe/ChangeLog, need to update it.  I agree,
though, that they are helpful: that's another chance to review your own
changes.

> But that said, adding a ChangeLog snippet in commit log is orthogonal to
> adding a "PR libsframe/33168" to commit log.  The post commit hooks will
> DTRT with just that string in the commit log.

I've done that now, together with a complete ChangeLog entry.

>> >>> diff --git a/libsframe/testsuite/sframe-test.h 
> b/libsframe/testsuite/sframe-test.h
>>>> new file mode 100644
>>>> --- /dev/null
>>>> +++ b/libsframe/testsuite/sframe-test.h
>>>> @@ -0,0 +1,40 @@
>>>> +/* sframe-test.h -- Common libsframe testsuite header.
>>>> +
>>>> +   Copyright (C) 2022-2025 Free Software Foundation, Inc.
>>>> +
>>>
>>> Typo: 2022-2025 --> 2025
>> Really?  The bulk of the file is just copied from existing code.
>> Shouldn't it retain that code's date range?
>> 
>
> I usually follow the rule of keeping the current year for a new file, since
> the file did not exist prior to date.  May be someone else can confirm
> whats more appropriate here.

Since there wasn't a response to this so far, I've kept the range from
the source files as is.  If that's deemed inappropriate, it can easily
be fixed later.

>>> If adding a prototype "void wait (void);" is not preferable, we can add
>>> -Wno-missing-prototypes for the testsuite ?
>> I prefer the prototype route over the warning myself if it works.
>> Should I just commit the final patch with those updates or post a v4?
>
> Please go ahead and commit.  Thanks.

I've done that now.  Thanks for your patience.

	Rainer
  

Patch

# HG changeset patch
# Parent  09bfbccd94ccc0b3e0efcd20831e30014192dafc
libsframe: testsuite: Fix testsuite build on Solaris [PR33168]

diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am
--- 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/Makefile.in b/libsframe/Makefile.in
--- a/libsframe/Makefile.in
+++ b/libsframe/Makefile.in
@@ -201,42 +201,37 @@  am_testsuite_libsframe_decode_be_flippin
 testsuite_libsframe_decode_be_flipping_OBJECTS =  \
 	$(am_testsuite_libsframe_decode_be_flipping_OBJECTS)
 testsuite_libsframe_decode_be_flipping_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+	$(testsuite_LDADD)
 am_testsuite_libsframe_decode_frecnt_1_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.$(OBJEXT)
 testsuite_libsframe_decode_frecnt_1_OBJECTS =  \
 	$(am_testsuite_libsframe_decode_frecnt_1_OBJECTS)
-testsuite_libsframe_decode_frecnt_1_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+testsuite_libsframe_decode_frecnt_1_DEPENDENCIES = $(testsuite_LDADD)
 am_testsuite_libsframe_decode_frecnt_2_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.$(OBJEXT)
 testsuite_libsframe_decode_frecnt_2_OBJECTS =  \
 	$(am_testsuite_libsframe_decode_frecnt_2_OBJECTS)
-testsuite_libsframe_decode_frecnt_2_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+testsuite_libsframe_decode_frecnt_2_DEPENDENCIES = $(testsuite_LDADD)
 am_testsuite_libsframe_encode_encode_1_OBJECTS = testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.$(OBJEXT)
 testsuite_libsframe_encode_encode_1_OBJECTS =  \
 	$(am_testsuite_libsframe_encode_encode_1_OBJECTS)
-testsuite_libsframe_encode_encode_1_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+testsuite_libsframe_encode_encode_1_DEPENDENCIES = $(testsuite_LDADD)
 am_testsuite_libsframe_find_findfre_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_findfre_1-findfre-1.$(OBJEXT)
 testsuite_libsframe_find_findfre_1_OBJECTS =  \
 	$(am_testsuite_libsframe_find_findfre_1_OBJECTS)
-testsuite_libsframe_find_findfre_1_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+testsuite_libsframe_find_findfre_1_DEPENDENCIES = $(testsuite_LDADD)
 am_testsuite_libsframe_find_findfunc_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_findfunc_1-findfunc-1.$(OBJEXT)
 testsuite_libsframe_find_findfunc_1_OBJECTS =  \
 	$(am_testsuite_libsframe_find_findfunc_1_OBJECTS)
-testsuite_libsframe_find_findfunc_1_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+testsuite_libsframe_find_findfunc_1_DEPENDENCIES = $(testsuite_LDADD)
 am_testsuite_libsframe_find_plt_findfre_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_plt_findfre_1-plt-findfre-1.$(OBJEXT)
 testsuite_libsframe_find_plt_findfre_1_OBJECTS =  \
 	$(am_testsuite_libsframe_find_plt_findfre_1_OBJECTS)
 testsuite_libsframe_find_plt_findfre_1_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+	$(testsuite_LDADD)
 am_testsuite_libsframe_find_plt_findfre_2_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_plt_findfre_2-plt-findfre-2.$(OBJEXT)
 testsuite_libsframe_find_plt_findfre_2_OBJECTS =  \
 	$(am_testsuite_libsframe_find_plt_findfre_2_OBJECTS)
 testsuite_libsframe_find_plt_findfre_2_DEPENDENCIES =  \
-	${top_builddir}/libsframe.la
+	$(testsuite_LDADD)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -535,7 +530,7 @@  DISTCLEANFILES = $(am__append_2)
 MAINTAINERCLEANFILES = $(am__append_3)
 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`
 @HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@libsframe_version_script = -Wl,--version-script=$(srcdir)/libsframe.ver
@@ -557,30 +552,32 @@  EXTRA_DIST = libtool-version libsframe.v
 EXPECT = expect
 RUNTEST = runtest
 RUNTESTFLAGS = 
+testsuite_LDADD = $(top_builddir)/libsframe.la
+testsuite_CPPFLAGS = -I$(srcdir)/testsuite -I$(srcdir)/../include
 testsuite_libsframe_decode_be_flipping_SOURCES = testsuite/libsframe.decode/be-flipping.c
-testsuite_libsframe_decode_be_flipping_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_decode_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_decode_be_flipping_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_decode_be_flipping_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_decode_frecnt_1_SOURCES = testsuite/libsframe.decode/frecnt-1.c
-testsuite_libsframe_decode_frecnt_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_decode_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_decode_frecnt_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_decode_frecnt_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_decode_frecnt_2_SOURCES = testsuite/libsframe.decode/frecnt-2.c
-testsuite_libsframe_decode_frecnt_2_LDADD = ${top_builddir}/libsframe.la 
-testsuite_libsframe_decode_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_decode_frecnt_2_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_decode_frecnt_2_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_encode_encode_1_SOURCES = testsuite/libsframe.encode/encode-1.c
-testsuite_libsframe_encode_encode_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_encode_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_encode_encode_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_encode_encode_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_find_findfre_1_SOURCES = testsuite/libsframe.find/findfre-1.c
-testsuite_libsframe_find_findfre_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_findfre_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_find_findfunc_1_SOURCES = testsuite/libsframe.find/findfunc-1.c
-testsuite_libsframe_find_findfunc_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_findfunc_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_findfunc_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_findfunc_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_find_plt_findfre_1_SOURCES = testsuite/libsframe.find/plt-findfre-1.c
-testsuite_libsframe_find_plt_findfre_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_plt_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_plt_findfre_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_plt_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
 testsuite_libsframe_find_plt_findfre_2_SOURCES = testsuite/libsframe.find/plt-findfre-2.c
-testsuite_libsframe_find_plt_findfre_2_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_plt_findfre_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_plt_findfre_2_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_plt_findfre_2_CPPFLAGS = $(testsuite_CPPFLAGS)
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
diff --git a/libsframe/testsuite/libsframe.decode/be-flipping.c b/libsframe/testsuite/libsframe.decode/be-flipping.c
--- a/libsframe/testsuite/libsframe.decode/be-flipping.c
+++ b/libsframe/testsuite/libsframe.decode/be-flipping.c
@@ -15,17 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 /* SFrame info from the following source (1 fde 5 fres):
    static int cnt;
diff --git a/libsframe/testsuite/libsframe.decode/frecnt-1.c b/libsframe/testsuite/libsframe.decode/frecnt-1.c
--- a/libsframe/testsuite/libsframe.decode/frecnt-1.c
+++ b/libsframe/testsuite/libsframe.decode/frecnt-1.c
@@ -15,17 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 /*
  * SFrame info from the following source (1 fde 4 fres):
diff --git a/libsframe/testsuite/libsframe.decode/frecnt-2.c b/libsframe/testsuite/libsframe.decode/frecnt-2.c
--- a/libsframe/testsuite/libsframe.decode/frecnt-2.c
+++ b/libsframe/testsuite/libsframe.decode/frecnt-2.c
@@ -15,17 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 /*
  * SFrame info from the following source (2 fde 8 fres):
diff --git a/libsframe/testsuite/libsframe.decode/local.mk b/libsframe/testsuite/libsframe.decode/local.mk
--- 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/encode-1.c b/libsframe/testsuite/libsframe.encode/encode-1.c
--- a/libsframe/testsuite/libsframe.encode/encode-1.c
+++ b/libsframe/testsuite/libsframe.encode/encode-1.c
@@ -15,17 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 static int
 add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
diff --git a/libsframe/testsuite/libsframe.encode/local.mk b/libsframe/testsuite/libsframe.encode/local.mk
--- 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/findfre-1.c b/libsframe/testsuite/libsframe.find/findfre-1.c
--- a/libsframe/testsuite/libsframe.find/findfre-1.c
+++ b/libsframe/testsuite/libsframe.find/findfre-1.c
@@ -15,17 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 static int
 add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
diff --git a/libsframe/testsuite/libsframe.find/findfunc-1.c b/libsframe/testsuite/libsframe.find/findfunc-1.c
--- a/libsframe/testsuite/libsframe.find/findfunc-1.c
+++ b/libsframe/testsuite/libsframe.find/findfunc-1.c
@@ -22,17 +22,7 @@ 
    The tests in here stress the sframe_get_funcdesc_with_addr API via calls to
    the sframe_find_fre ().  */
 
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 static int
 add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
diff --git a/libsframe/testsuite/libsframe.find/local.mk b/libsframe/testsuite/libsframe.find/local.mk
--- 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)
diff --git a/libsframe/testsuite/libsframe.find/plt-findfre-1.c b/libsframe/testsuite/libsframe.find/plt-findfre-1.c
--- a/libsframe/testsuite/libsframe.find/plt-findfre-1.c
+++ b/libsframe/testsuite/libsframe.find/plt-findfre-1.c
@@ -15,17 +15,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 static int
 add_plt_fde1 (sframe_encoder_ctx *ectx, uint32_t plt_vaddr,
diff --git a/libsframe/testsuite/libsframe.find/plt-findfre-2.c b/libsframe/testsuite/libsframe.find/plt-findfre-2.c
--- a/libsframe/testsuite/libsframe.find/plt-findfre-2.c
+++ b/libsframe/testsuite/libsframe.find/plt-findfre-2.c
@@ -16,17 +16,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
 
 /* s390x-specific size in bytes of plt0 and pltN.  */
 #define PLT_SIZE 32
diff --git a/libsframe/testsuite/local.mk b/libsframe/testsuite/local.mk
--- 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/sframe-test.h b/libsframe/testsuite/sframe-test.h
new file mode 100644
--- /dev/null
+++ b/libsframe/testsuite/sframe-test.h
@@ -0,0 +1,40 @@ 
+/* sframe-test.h -- Common libsframe testsuite header.
+
+   Copyright (C) 2022-2025 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SFRAME_TEST_H
+#define _SFRAME_TEST_H
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "sframe-api.h"
+
+/* DejaGnu should not use gnulib's vsnprintf replacement here.  */
+#undef vsnprintf
+
+/* PR 33168: Solaris <sys/wait.h> with __EXTENSIONS__ defined gets a
+   declaration of wait().  This conflicts with <dejagnu.h>'s wait
+   definition that is only removed after DejaGnu 1.6.3.  */
+#define wait dg_wait
+#include <dejagnu.h>
+#undef wait
+
+#endif /* _SFRAME_TEST_H */