tests: use ${CC} instead of 'gcc' in tests
authorSergei Trofimovich via Elfutils-devel <elfutils-devel@sourceware.org>
Sun, 31 Jan 2021 15:49:13 +0000 (15:49 +0000)
committerMark Wielaard <mark@klomp.org>
Sun, 31 Jan 2021 17:16:45 +0000 (18:16 +0100)
To better support cross-compilation Gentoo provides a way
to configure system without 'gcc' binary and only provide
tool-prefixed tools, like 'x86_64-pc-linux-gnu-gcc'.
The packages are built as ./configure --host=x86_64-pc-linux-gnu.

In https://bugs.gentoo.org/718872 Agostino Sarubbo found
a few test failures that use hardcoded 'gcc' instead of
expected ${CC}. The change propagates detected ${CC} at
configure time to test scripts.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
tests/ChangeLog
tests/Makefile.am
tests/run-disasm-x86-64.sh
tests/run-disasm-x86.sh
tests/run-strip-g.sh
tests/run-strip-nothing.sh
tests/run-test-includes.sh

index 3e5b630..c6e9f61 100644 (file)
@@ -1,3 +1,13 @@
+2021-01-31  Sergei Trofimovich  <slyfox@gentoo.org>
+
+       * Makefile.am (TESTS_ENVIRONMENT): export CC variable
+       to tests for use instead of 'gcc'.
+       * run-disasm-x86-64.sh: use ${CC} instead of 'gcc'.
+       * run-disasm-x86.sh: Likewise.
+       * run-strip-g.sh: Likewise.
+       * run-strip-nothing.sh: Likewise.
+       * run-test-includes.sh: Likewise.
+
 2021-01-06  Timm Bäder  <tbaeder@redhat.com>
 
        * zstrptr.c (main): Lift print_strings function up to ...
index 502becf..c145720 100644 (file)
@@ -527,7 +527,8 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
                              export libdir; export bindir; \
                              export LC_ALL; export LANG; export VALGRIND_CMD; \
                              unset DEBUGINFOD_URLS; \
-                             NM=$(NM); export NM;
+                             NM=$(NM); export NM; \
+                             CC=$(CC); export CC;
 installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
                         installed $(tests_rpath) \
                         '$(program_transform_name)'
@@ -538,7 +539,8 @@ TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \
                    export abs_top_builddir; \
                    export LC_ALL; export LANG; export VALGRIND_CMD; \
                    unset DEBUGINFOD_URLS; \
-                   NM=$(NM); export NM;
+                   NM=$(NM); export NM; \
+                   CC=$(CC); export CC;
 LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
               $(abs_top_builddir)/libdw:$(abs_top_builddir)/backends:$(abs_top_builddir)/libelf:$(abs_top_builddir)/libasm:$(abs_top_builddir)/debuginfod
 
index a6be62b..07b612b 100755 (executable)
@@ -22,7 +22,7 @@ case "`uname -m`" in
   x86_64)
     tempfiles testfile45.o
     testfiles testfile45.S testfile45.expect
-    gcc -m64 -c -o testfile45.o testfile45.S
+    ${CC} -m64 -c -o testfile45.o testfile45.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile45.o < testfile45.expect
     ;;
 esac
index 28a3df7..7ac73ad 100755 (executable)
@@ -22,7 +22,7 @@ case "`uname -m`" in
   x86_64 | i?86 )
     tempfiles testfile44.o
     testfiles testfile44.S testfile44.expect
-    gcc -m32 -c -o testfile44.o testfile44.S
+    ${CC} -m32 -c -o testfile44.o testfile44.S
     testrun_compare ${abs_top_builddir}/src/objdump -d testfile44.o < testfile44.expect
     ;;
 esac
index 1303819..1592121 100755 (executable)
@@ -25,7 +25,7 @@
 tempfiles a.out strip.out debug.out readelf.out
 
 echo Create debug a.out.
-echo "int main() { return 1; }" | gcc -g -xc -
+echo "int main() { return 1; }" | ${CC} -g -xc -
 
 echo strip -g to file with debug file
 testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out ||
index 914fdfb..710c200 100755 (executable)
@@ -23,7 +23,7 @@
 tempfiles a.out strip.out debug.out
 
 # Create no-debug a.out.
-echo "int main() { return 1; }" | gcc -s -xc -
+echo "int main() { return 1; }" | ${CC} -s -xc -
 
 # strip to file
 testrun ${abs_top_builddir}/src/strip -g -o strip.out ||
index b0ccdd9..b107c6b 100755 (executable)
@@ -3,24 +3,24 @@
 . $srcdir/test-subr.sh
 
 echo '#include "libelf.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf -xc -
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf -xc -
 echo '#include "gelf.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf -xc -
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf -xc -
 
 echo '#include "dwarf.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf \
         -I ${abs_srcdir}/../libdw -xc -
 echo '#include "libdw.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf \
         -I ${abs_srcdir}/../libdw -xc -
 
 echo '#include "libdwfl.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf \
     -I ${abs_srcdir}/../libdw -I ${abs_srcdir}/../libdwfl -xc -
 echo '#include "libdwelf.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf \
     -I ${abs_srcdir}/../libdw -I ${abs_srcdir}/../libdwelf -xc -
 
 echo '#include "libasm.h"' \
-  | gcc -c -o /dev/null -I ${abs_srcdir}/../libelf \
+  | ${CC} -c -o /dev/null -I ${abs_srcdir}/../libelf \
     -I ${abs_srcdir}/../libasm -xc -