public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: Vitaly Chikunov <vt@altlinux.org>, debugedit@sourceware.org
Subject: Re: [PATCH] tests: fix for toolchains producing compressed debug sections
Date: Fri, 26 Mar 2021 00:12:59 +0100	[thread overview]
Message-ID: <20210325231259.GJ2685@wildebeest.org> (raw)
In-Reply-To: <20210324234548.GA5335@altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

Hi Dmitry,

On Thu, Mar 25, 2021 at 02:45:48AM +0300, Dmitry V. Levin wrote:
> On Tue, Mar 23, 2021 at 04:05:59PM +0100, Mark Wielaard wrote:
> > So we'll need configure checks for that and not use -gz=none and skip
> > the -gdwarf-5 tests when gcc isn't able to use those options.
> > 
> I've prepared the following fix, but it seems to be too late now.
> I'll post it here anyway just in case.

Sorry, I didn't know you were already working on this.  Your version
does everything in debugedit.at which is nicely contained. But I think
doing it as configure checks might help if we need them somewhere
else. But you version tests the actual gcc command used in the
test. We probably need to use CC instead in the tests, so it equals
the build/target compiler.

What do you think of the attached patch?

Thanks,

Mark

[-- Attachment #2: 0001-tests-Use-CC-CFLAGS-LD-and-LDFLAGS-to-create-testcas.patch --]
[-- Type: text/x-diff, Size: 2706 bytes --]

From 686ab7788728264ff245020a63e168bced1d6161 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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 <mark@klomp.org>
---
 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


  reply	other threads:[~2021-03-25 23:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 20:00 Dmitry V. Levin
2021-03-23 14:20 ` Mark Wielaard
2021-03-23 14:28   ` Dmitry V. Levin
2021-03-23 15:05     ` Mark Wielaard
2021-03-24 23:45       ` Dmitry V. Levin
2021-03-25 23:12         ` Mark Wielaard [this message]
2021-03-28  0:46           ` Dmitry V. Levin
2021-03-28 14:01             ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325231259.GJ2685@wildebeest.org \
    --to=mark@klomp.org \
    --cc=debugedit@sourceware.org \
    --cc=ldv@altlinux.org \
    --cc=vt@altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).