Re: [PATCH] qemuxml2argvtest: Add /usr/bin to PATH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/17/2012 11:31 AM, Michal Privoznik wrote:
> On some systems, notably Fedora 16, dirname is located under /usr/bin
> making our qemuxml2argvtest fail as we default to /bin;
> ---
>  tests/qemuxml2argvtest.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index d1834f5..96f538d 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -338,7 +338,7 @@ mymain(void)
>      /* Unset or set all envvars here that are copied in qemudBuildCommandLine
>       * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
>       * values for these envvars */
> -    setenv("PATH", "/bin", 1);
> +    setenv("PATH", "/bin:/usr/bin", 1);

NACK.  Applying this patch as-is triggers a different set of test
failures, because of the change in PATH not matching expected output;
for example:

194) QEMU XML-2-ARGV pseries-vio-user-assigned                         ...
Offset 18
Expect [ ]
Actual [:/usr/bin ]

But it is indeed a build-breaker.  I could either tweak all the expected
outputs (tedious), or go for a different 2-liner fix (faster), so here's
what I'm pushing instead:

From dccf45f376a11ae175267e4f68924ce713b639d8 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@xxxxxxxxxx>
Date: Tue, 17 Jan 2012 12:09:51 -0700
Subject: [PATCH] tests: avoid dirname in tests

qemuxml2argvtest sanitizes PATH to just /bin, but on at least
Fedora 16, dirname lives in /usr/bin instead.  Regression
introduced in commit e7201afd.

* tests/qemuxml2argvdata/qemu.sh: Avoid forking a dirname call,
since dirname might not be in PATH after test sanitization.
* tests/qemuxml2argvdata/qemu-supported-cpus.sh: Likewise.
Diagnosed by Michal Privoznik.
---
 tests/qemuxml2argvdata/qemu-supported-cpus.sh |    2 +-
 tests/qemuxml2argvdata/qemu.sh                |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvdata/qemu-supported-cpus.sh
b/tests/qemuxml2argvdata/qemu-supported-cpus.sh
index ed3ae94..0204f51 100755
--- a/tests/qemuxml2argvdata/qemu-supported-cpus.sh
+++ b/tests/qemuxml2argvdata/qemu-supported-cpus.sh
@@ -1,6 +1,6 @@
 #! /bin/sh

-. $(dirname $0)/qemu-lib.sh
+. ${0%/*}/qemu-lib.sh

 case $* in
 "-M ?")
diff --git a/tests/qemuxml2argvdata/qemu.sh b/tests/qemuxml2argvdata/qemu.sh
index 38da0b3..5928c1b 100755
--- a/tests/qemuxml2argvdata/qemu.sh
+++ b/tests/qemuxml2argvdata/qemu.sh
@@ -1,6 +1,6 @@
 #! /bin/sh

-. $(dirname $0)/qemu-lib.sh
+. ${0%/*}/qemu-lib.sh

 case $* in
 "-M ?")
-- 
1.7.7.5

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]