summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich via Elfutils-devel <elfutils-devel@sourceware.org>2021-01-31 15:49:13 +0000
committerMark Wielaard <mark@klomp.org>2021-01-31 18:16:45 +0100
commiteb922a1b8f3a7b1d9740bc789fdf499637ded111 (patch)
tree4c72b92716a387a72c0b7fdc76c78d69cbdf9206
parent92ed5f32bdffc414b6379022c614accbd0eb8847 (diff)
downloadelfutils-eb922a1b8f3a7b1d9740bc789fdf499637ded111.tar.gz
tests: use ${CC} instead of 'gcc' in tests
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>
-rw-r--r--tests/ChangeLog10
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/run-disasm-x86-64.sh2
-rwxr-xr-xtests/run-disasm-x86.sh2
-rwxr-xr-xtests/run-strip-g.sh2
-rwxr-xr-xtests/run-strip-nothing.sh2
-rwxr-xr-xtests/run-test-includes.sh14
7 files changed, 25 insertions, 13 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3e5b630a..c6e9f618 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -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 ...
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 502becff..c145720c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh
index a6be62bb..07b612b0 100755
--- a/tests/run-disasm-x86-64.sh
+++ b/tests/run-disasm-x86-64.sh
@@ -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
diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh
index 28a3df74..7ac73ad7 100755
--- a/tests/run-disasm-x86.sh
+++ b/tests/run-disasm-x86.sh
@@ -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
diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh
index 13038195..15921215 100755
--- a/tests/run-strip-g.sh
+++ b/tests/run-strip-g.sh
@@ -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 ||
diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh
index 914fdfbf..710c200d 100755
--- a/tests/run-strip-nothing.sh
+++ b/tests/run-strip-nothing.sh
@@ -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 ||
diff --git a/tests/run-test-includes.sh b/tests/run-test-includes.sh
index b0ccdd9b..b107c6b9 100755
--- a/tests/run-test-includes.sh
+++ b/tests/run-test-includes.sh
@@ -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 -