From 686ab7788728264ff245020a63e168bced1d6161 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 26 Mar 2021 00:00:42 +0100 Subject: [PATCH] tests: Use CC, CFLAGS, LD and LDFLAGS to create testcases Currently gcc is hardcoded in the tests. Use the configured tools to make testing for a specfic target or alternative build tools easier. * configure.ac: Add AC_CHECK_TOOL for LD. * tests/atlocal.in: Set CC, CFLAGS, LD and LDFLAGS. * tests/debugedit.at (RPM_DEBUGEDIT_SETUP): Use CC, CFLAGS, LD and LDFLAGS. Signed-off-by: Mark Wielaard --- configure.ac | 1 + tests/atlocal.in | 6 ++++++ tests/debugedit.at | 10 +++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 1669b5d..c5adadf 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,7 @@ AC_USE_SYSTEM_EXTENSIONS AC_PROG_AWK AC_PROG_CC_C99 AC_PROG_LN_S +AC_CHECK_TOOL([LD], [ld]) # Only really an issue on 32bit platforms. Makes sure we'll get large off_t. AC_SYS_LARGEFILE diff --git a/tests/atlocal.in b/tests/atlocal.in index 8ca240d..a45edac 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -2,5 +2,11 @@ # Configurable variable values for test suite. PATH=@abs_builddir@:@abs_top_builddir@:$top_srcdir:$srcdir:$PATH + +CC="@CC@" +CFLAGS="@CFLAGS@" +LD="@LD@" +LDFLAGS="@LDFLAGS@" + GDWARF_5_FLAG=@GDWARF_5_FLAG@ GZ_NONE_FLAG=@GZ_NONE_FLAG@ diff --git a/tests/debugedit.at b/tests/debugedit.at index 27d3e21..38b3aa4 100644 --- a/tests/debugedit.at +++ b/tests/debugedit.at @@ -37,19 +37,19 @@ cp "${abs_srcdir}"/data/SOURCES/foobar.h subdir_headers cp "${abs_srcdir}"/data/SOURCES/baz.c . # First three object files (foo.o subdir_bar/bar.o and baz.o) -gcc -g3 $GZ_NONE_FLAG -Isubdir_headers $1 -c subdir_foo/foo.c +$CC $CFLAGS -g3 $GZ_NONE_FLAG -Isubdir_headers $1 -c subdir_foo/foo.c cd subdir_bar -gcc -g3 $GZ_NONE_FLAG -I../subdir_headers $1 -c bar.c +$CC $CFLAGS -g3 $GZ_NONE_FLAG -I../subdir_headers $1 -c bar.c cd .. -gcc -g3 $GZ_NONE_FLAG -I$(pwd)/subdir_headers $1 -c $(pwd)/baz.c +$CC $CFLAGS -g3 $GZ_NONE_FLAG -I$(pwd)/subdir_headers $1 -c $(pwd)/baz.c # Then a partially linked object file (somewhat like a kernel module). # This will still have relocations between the debug sections. -ld -r -o foobarbaz.part.o foo.o subdir_bar/bar.o baz.o +$LD $LDFLAGS -r -o foobarbaz.part.o foo.o subdir_bar/bar.o baz.o # Create an executable. Relocations between debug sections will # have been resolved. -gcc -g3 $GZ_NONE_FLAG -o foobarbaz.exe foo.o subdir_bar/bar.o baz.o +$CC $CFLAGS -g3 $GZ_NONE_FLAG -o foobarbaz.exe foo.o subdir_bar/bar.o baz.o ]]) # === -- 2.20.1