Bug 27890 - tests using CFLAGS/LDFLAGS causes testsuite failures
Summary: tests using CFLAGS/LDFLAGS causes testsuite failures
Status: RESOLVED FIXED
Alias: None
Product: debugedit
Classification: Unclassified
Component: debugedit (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-20 12:10 UTC by Mark Wielaard
Modified: 2021-07-12 20:21 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2021-05-20 12:10:53 UTC
Package builds pass their own build flags which breaks the tests that rely on specific flags themselves.

Fedora has the following in the .spec file:

# The testsuite should be zero fail.
# It uses its own CFLAGS and LDFLAGS settings.
sed -i 's/^\(C\|LD\)FLAGS=.*/\1FLAGS=""/' tests/atlocal

The Debian build sees a lot of testsuite failures when passing lto flags:

<doko> 4. debugedit.at:90: testing debugedit .debug_str objects DWARF4 ...
<doko> `.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccAYhu9F.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.0.81fbea40ac96d056116360667986e330]' of /tmp/ccAYhu9F.debug.temp.o
<doko> `.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccAYhu9F.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.stdcpredef.h.19.8dc41bed5d9037ff9622e015fb5f0ce3]' of /tmp/ccAYhu9F.debug.temp.o
<doko> `.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccb77ltm.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.0.81fbea40ac96d056116360667986e330]' of /tmp/ccb77ltm.debug.temp.o
<doko> `.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccb77ltm.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.stdcpredef.h.19.8dc41bed5d9037ff9622e015fb5f0ce3]' of /tmp/ccb77ltm.debug.temp.o
Comment 1 Matthias Klose 2021-05-20 13:34:46 UTC
The package build induces some flags, and Mark confirmed that these are also cleared for the rpm build, when running the tests:

sed -i 's/^\(C\|LD\)FLAGS=.*/\1FLAGS=""/' tests/atlocal
Comment 2 Dmitry V. Levin 2021-05-20 13:47:04 UTC
By the way, this issue was predicted not so long ago, see
https://sourceware.org/pipermail/debugedit/2021-March/000023.html
Comment 3 Mark Wielaard 2021-07-05 15:11:34 UTC
To fix this I intend to push something like the following:

diff --git a/tests/atlocal.in b/tests/atlocal.in
index a45edac..0eec351 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -3,10 +3,12 @@
 
 PATH=@abs_builddir@:@abs_top_builddir@:$top_srcdir:$srcdir:$PATH
 
+# We do use the CC and LD found by configure, but explicitly keep
+# CFLAGS and LDFLAGS empty because the tests use specific flags.
 CC="@CC@"
-CFLAGS="@CFLAGS@"
+CFLAGS=""
 LD="@LD@"
-LDFLAGS="@LDFLAGS@"
+LDFLAGS=""
 
 GDWARF_5_FLAG=@GDWARF_5_FLAG@
 GZ_NONE_FLAG=@GZ_NONE_FLAG@

It would still allow using different compilers/linkers, but not to override the CFLAGS/LDFLAGS for the tests themselves (unless you edit atlocal by hand.

Does the above seem reasonable?
Comment 4 Mark Wielaard 2021-07-12 20:21:23 UTC
Since nobody complained I pushed this as

commit 9210e0a9e910f64541025314dd03892374207492
Author: Mark Wielaard <mark@klomp.org>
Date:   Mon Jul 12 22:19:02 2021 +0200

    tests: Disable CFLAGS and LDFLAGS overrides
    
    We do use the CC and LD found by configure, but explicitly keep
    CFLAGS and LDFLAGS empty because the tests use specific flags.
    
    https://sourceware.org/bugzilla/show_bug.cgi?id=27890
    
    Signed-off-by: Mark Wielaard <mark@klomp.org>