[libvirt] [PATCH] commandtest: avoid printing loader-control variables from commandhelper

This avoids throwing the tests off if LD_LIBRARY_PATH or LD_PRELOAD or other variables are set. Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com> --- tests/commandhelper.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index f400e8d..398f002 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -81,7 +81,10 @@ int main(int argc, char **argv) { qsort(newenv, n, sizeof(newenv[0]), envsort); for (i = 0 ; i < n ; i++) { - fprintf(log, "ENV:%s\n", newenv[i]); + /* Ignore the variables used to instruct the loader into + * behaving differently, as they could throw the tests off. */ + if ( strncmp(newenv[i], "LD_", 3) != 0 ) + fprintf(log, "ENV:%s\n", newenv[i]); } for (i = 0 ; i < sysconf(_SC_OPEN_MAX) ; i++) { -- 1.7.4.rc1

On 01/06/2011 01:23 PM, Diego Elio Pettenò wrote:
This avoids throwing the tests off if LD_LIBRARY_PATH or LD_PRELOAD or other variables are set.
Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com> --- tests/commandhelper.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tests/commandhelper.c b/tests/commandhelper.c index f400e8d..398f002 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -81,7 +81,10 @@ int main(int argc, char **argv) { qsort(newenv, n, sizeof(newenv[0]), envsort);
for (i = 0 ; i < n ; i++) { - fprintf(log, "ENV:%s\n", newenv[i]); + /* Ignore the variables used to instruct the loader into + * behaving differently, as they could throw the tests off. */ + if ( strncmp(newenv[i], "LD_", 3) != 0 )
This will fail 'make syntax-check'; you should use STRPREFIX from "internal.h" instead. But other than that, ACK, so I'll push the amended patch shortly. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 01/06/2011 02:14 PM, Eric Blake wrote:
On 01/06/2011 01:23 PM, Diego Elio Pettenò wrote:
This avoids throwing the tests off if LD_LIBRARY_PATH or LD_PRELOAD or other variables are set.
Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com> --- tests/commandhelper.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tests/commandhelper.c b/tests/commandhelper.c index f400e8d..398f002 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -81,7 +81,10 @@ int main(int argc, char **argv) { qsort(newenv, n, sizeof(newenv[0]), envsort);
for (i = 0 ; i < n ; i++) { - fprintf(log, "ENV:%s\n", newenv[i]); + /* Ignore the variables used to instruct the loader into + * behaving differently, as they could throw the tests off. */ + if ( strncmp(newenv[i], "LD_", 3) != 0 )
This will fail 'make syntax-check'; you should use STRPREFIX from "internal.h" instead. But other than that, ACK, so I'll push the amended patch shortly.
Actually, it _didn't_ fail 'make syntax-check', due to a bug in cfg.mk (which in turn was copied from a bug in maint.mk) - our regex was too tight. I'll fix that separately (we were using a regex that looked only for "== *0", rather than for the regex "[!=]= *0"). -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Diego Elio Pettenò
-
Eric Blake