Commit eb922a1b8f3a ("tests: use ${CC} instead of 'gcc' in tests")
exports ${CC} into the test environment, but doesn't quote the
value for the assignment. That doesn't work properly if the value
contains whitespace. In a multilib/biarch environment however, it's
common to set CC="gcc -m32" or similar. That causes tests to print
error messages: "/bin/sh: line 2: -m32: command not found".

Fix that by adding quotes around all make variables (not just $CC)
used in setting up TESTS_ENVIRONMENT.

Signed-off-by: Alexander Miller <alex.mil...@gmx.de>
---
 tests/ChangeLog   |  4 ++++
 tests/Makefile.am | 27 ++++++++++++++-------------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 907b635..9dc8dfa 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-07  Alexander Miller  <alex.mil...@gmx.de>
+
+       * Makefile.am (TESTS_ENVIRONMENT): Quote variables.
+
 2021-02-04  Frank Ch. Eigler <f...@redhat.com>

        * run-debuginfod-find.sh: Smoke test --fdcache-mintmp option handling.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c145720..d6802d8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -515,32 +515,33 @@ valgrind_cmd='valgrind -q --leak-check=full 
--error-exitcode=1'
 endif


-installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
-                             bindir=$(DESTDIR)$(bindir); \
+installed_TESTS_ENVIRONMENT = libdir='$(DESTDIR)$(libdir)'; \
+                             bindir='$(DESTDIR)$(bindir)'; \
                              LC_ALL=C; LANG=C; \
-                             VALGRIND_CMD=$(valgrind_cmd); \
-                             abs_srcdir=$(abs_srcdir); \
-                             abs_builddir=$(abs_builddir); \
-                             abs_top_builddir=$(abs_top_builddir); \
+                             VALGRIND_CMD='$(valgrind_cmd)'; \
+                             abs_srcdir='$(abs_srcdir)'; \
+                             abs_builddir='$(abs_builddir)'; \
+                             abs_top_builddir='$(abs_top_builddir)'; \
                              export abs_srcdir; export abs_builddir; \
                              export abs_top_builddir; \
                              export libdir; export bindir; \
                              export LC_ALL; export LANG; export VALGRIND_CMD; \
                              unset DEBUGINFOD_URLS; \
-                             NM=$(NM); export NM; \
-                             CC=$(CC); export CC;
+                             NM='$(NM)'; export NM; \
+                             CC='$(CC)'; export CC;
 installed_LOG_COMPILER = $(abs_srcdir)/test-wrapper.sh \
                         installed $(tests_rpath) \
                         '$(program_transform_name)'
-TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD=$(valgrind_cmd); \
-                   abs_srcdir=$(abs_srcdir);  abs_builddir=$(abs_builddir); \
-                   abs_top_builddir=$(abs_top_builddir); \
+TESTS_ENVIRONMENT = LC_ALL=C; LANG=C; VALGRIND_CMD='$(valgrind_cmd)'; \
+                   abs_srcdir='$(abs_srcdir)'; \
+                   abs_builddir='$(abs_builddir)'; \
+                   abs_top_builddir='$(abs_top_builddir)'; \
                    export abs_srcdir; export abs_builddir; \
                    export abs_top_builddir; \
                    export LC_ALL; export LANG; export VALGRIND_CMD; \
                    unset DEBUGINFOD_URLS; \
-                   NM=$(NM); export NM; \
-                   CC=$(CC); export CC;
+                   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

--
2.26.2

Reply via email to