Hi Alexander,
On Sun, 2021-02-07 at 16:48 +0100, Alexander Miller via Elfutils-devel
wrote:
> 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.
Thanks, that works except for the valgrind_cmd (used when configuring
with --enable-valgrind), because that was already quoted. I removed the
quotes in the original variable assignment and pushed the patch as
attached.
Thanks,
Mark
From 7a5ea4591df5246124ac870c865939ea8f36ac4d Mon Sep 17 00:00:00 2001
From: Alexander Miller via Elfutils-devel <[email protected]>
Date: Sun, 7 Feb 2021 16:48:17 +0100
Subject: [PATCH] tests: Quote make variables in TESTS_ENVIRONMENT
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 <[email protected]>
---
tests/ChangeLog | 5 +++++
tests/Makefile.am | 29 +++++++++++++++--------------
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index e22fa455..bc94512e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-07 Alexander Miller <[email protected]>
+
+ * Makefile.am (TESTS_ENVIRONMENT): Quote variables.
+ (valgrind_cmd): Unquote variable.
+
2021-02-08 Érico Nogueira <[email protected]>
* run-debuginfod-find.sh: Check for cpio availability.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c145720c..852269a3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -511,36 +511,37 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
if USE_VALGRIND
-valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1'
+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.18.4