qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for 2.12] iotests: Avoid realpath
@ 2018-03-14 14:38 Eric Blake
  2018-03-14 14:47 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2018-03-14 14:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, Kevin Wolf, Max Reitz

CentOS 6 lacks a realpath binary on the base install, which makes
all iotests runs fail:

001         - output mismatch (see 001.out.bad)
./check: line 815: realpath: command not found
diff: missing operand after `/home/dummy/qemu/tests/qemu-iotests/001.out'
diff: Try `diff --help' for more information.

Many of the uses of 'realpath' in the check script were being
used on the output of 'type -p' - but that is already an
absolute file name.  We don't care if the name is canonical,
merely that it was an executable file with an absolute path.

The remaining use was using realpath to convert a possibly
relative filename into an absolute one before calling diff,
but diff works just fine on the relative name.

Signed-off-by: Eric Blake <eblake@redhat.com>
---

This doesn't magically fix all iotests on CentOS 6, but lets
it get a lot further.  Bug fix, so safe after freeze.

 tests/qemu-iotests/check | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 469142cd586..b719e9eee0c 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -92,7 +92,7 @@ set_prog_path()
 {
     p=`command -v $1 2> /dev/null`
     if [ -n "$p" -a -x "$p" ]; then
-        realpath -- "$(type -p "$p")"
+        type -p "$p"
     else
         return 1
     fi
@@ -554,7 +554,7 @@ then
         [ "$QEMU_PROG" = "" ] && _init_error "qemu not found"
     fi
 fi
-export QEMU_PROG=$(realpath -- "$(type -p "$QEMU_PROG")")
+export QEMU_PROG="$(type -p "$QEMU_PROG")"

 if [ -z "$QEMU_IMG_PROG" ]; then
     if [ -x "$build_iotests/qemu-img" ]; then
@@ -565,7 +565,7 @@ if [ -z "$QEMU_IMG_PROG" ]; then
         _init_error "qemu-img not found"
     fi
 fi
-export QEMU_IMG_PROG=$(realpath -- "$(type -p "$QEMU_IMG_PROG")")
+export QEMU_IMG_PROG="$(type -p "$QEMU_IMG_PROG")"

 if [ -z "$QEMU_IO_PROG" ]; then
     if [ -x "$build_iotests/qemu-io" ]; then
@@ -576,7 +576,7 @@ if [ -z "$QEMU_IO_PROG" ]; then
         _init_error "qemu-io not found"
     fi
 fi
-export QEMU_IO_PROG=$(realpath -- "$(type -p "$QEMU_IO_PROG")")
+export QEMU_IO_PROG="$(type -p "$QEMU_IO_PROG")"

 if [ -z $QEMU_NBD_PROG ]; then
     if [ -x "$build_iotests/qemu-nbd" ]; then
@@ -587,7 +587,7 @@ if [ -z $QEMU_NBD_PROG ]; then
         _init_error "qemu-nbd not found"
     fi
 fi
-export QEMU_NBD_PROG=$(realpath -- "$(type -p "$QEMU_NBD_PROG")")
+export QEMU_NBD_PROG="$(type -p "$QEMU_NBD_PROG")"

 if [ -z "$QEMU_VXHS_PROG" ]; then
   export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
@@ -811,7 +811,7 @@ do
                 else
                     echo " - output mismatch (see $seq.out.bad)"
                     mv $tmp.out $seq.out.bad
-                    $diff -w "$reference" $(realpath $seq.out.bad)
+                    $diff -w "$reference" $seq.out.bad
                     err=true
                 fi
             fi
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.12] iotests: Avoid realpath
  2018-03-14 14:38 [Qemu-devel] [PATCH for 2.12] iotests: Avoid realpath Eric Blake
@ 2018-03-14 14:47 ` Eric Blake
  2018-03-15  7:08   ` Fam Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2018-03-14 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz, Paolo Bonzini, Fam Zheng

On 03/14/2018 09:38 AM, Eric Blake wrote:
> CentOS 6 lacks a realpath binary on the base install, which makes
> all iotests runs fail:
> 
> 001         - output mismatch (see 001.out.bad)
> ./check: line 815: realpath: command not found
> diff: missing operand after `/home/dummy/qemu/tests/qemu-iotests/001.out'
> diff: Try `diff --help' for more information.
> 
> Many of the uses of 'realpath' in the check script were being
> used on the output of 'type -p' - but that is already an
> absolute file name.  We don't care if the name is canonical,
> merely that it was an executable file with an absolute path.

Appears to have been broken in cceaf1db.

> 
> The remaining use was using realpath to convert a possibly
> relative filename into an absolute one before calling diff,
> but diff works just fine on the relative name.

Hmm, this last change reverts commit 93e53fb6 that added realpath on 
purpose for ease of diagnosing failed tests.  Maybe it's worth a v2 that 
tests whether realpath exists, and if so uses it, but does a safe 
fallback to just using the filename as-is.

> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> 
> This doesn't magically fix all iotests on CentOS 6, but lets
> it get a lot further.  Bug fix, so safe after freeze.
> 
>   tests/qemu-iotests/check | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index 469142cd586..b719e9eee0c 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -92,7 +92,7 @@ set_prog_path()
>   {
>       p=`command -v $1 2> /dev/null`
>       if [ -n "$p" -a -x "$p" ]; then
> -        realpath -- "$(type -p "$p")"
> +        type -p "$p"
>       else
>           return 1
>       fi
> @@ -554,7 +554,7 @@ then
>           [ "$QEMU_PROG" = "" ] && _init_error "qemu not found"
>       fi
>   fi
> -export QEMU_PROG=$(realpath -- "$(type -p "$QEMU_PROG")")
> +export QEMU_PROG="$(type -p "$QEMU_PROG")"
> 
>   if [ -z "$QEMU_IMG_PROG" ]; then
>       if [ -x "$build_iotests/qemu-img" ]; then
> @@ -565,7 +565,7 @@ if [ -z "$QEMU_IMG_PROG" ]; then
>           _init_error "qemu-img not found"
>       fi
>   fi
> -export QEMU_IMG_PROG=$(realpath -- "$(type -p "$QEMU_IMG_PROG")")
> +export QEMU_IMG_PROG="$(type -p "$QEMU_IMG_PROG")"
> 
>   if [ -z "$QEMU_IO_PROG" ]; then
>       if [ -x "$build_iotests/qemu-io" ]; then
> @@ -576,7 +576,7 @@ if [ -z "$QEMU_IO_PROG" ]; then
>           _init_error "qemu-io not found"
>       fi
>   fi
> -export QEMU_IO_PROG=$(realpath -- "$(type -p "$QEMU_IO_PROG")")
> +export QEMU_IO_PROG="$(type -p "$QEMU_IO_PROG")"
> 
>   if [ -z $QEMU_NBD_PROG ]; then
>       if [ -x "$build_iotests/qemu-nbd" ]; then
> @@ -587,7 +587,7 @@ if [ -z $QEMU_NBD_PROG ]; then
>           _init_error "qemu-nbd not found"
>       fi
>   fi
> -export QEMU_NBD_PROG=$(realpath -- "$(type -p "$QEMU_NBD_PROG")")
> +export QEMU_NBD_PROG="$(type -p "$QEMU_NBD_PROG")"
> 
>   if [ -z "$QEMU_VXHS_PROG" ]; then
>     export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
> @@ -811,7 +811,7 @@ do
>                   else
>                       echo " - output mismatch (see $seq.out.bad)"
>                       mv $tmp.out $seq.out.bad
> -                    $diff -w "$reference" $(realpath $seq.out.bad)
> +                    $diff -w "$reference" $seq.out.bad
>                       err=true
>                   fi
>               fi
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for 2.12] iotests: Avoid realpath
  2018-03-14 14:47 ` Eric Blake
@ 2018-03-15  7:08   ` Fam Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2018-03-15  7:08 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, Kevin Wolf, qemu-block, Max Reitz, Paolo Bonzini

On Wed, 03/14 09:47, Eric Blake wrote:
> > The remaining use was using realpath to convert a possibly
> > relative filename into an absolute one before calling diff,
> > but diff works just fine on the relative name.
> 
> Hmm, this last change reverts commit 93e53fb6 that added realpath on purpose
> for ease of diagnosing failed tests.  Maybe it's worth a v2 that tests
> whether realpath exists, and if so uses it, but does a safe fallback to just
> using the filename as-is.

Yes, thanks for spotting that. I am used to do out-of-tree builds/tests and
modifying XXX.out files by copying from .out.bad. Having realpath saves some
typing so..

Your fallback idea sounds good to me.

Fam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-15  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-14 14:38 [Qemu-devel] [PATCH for 2.12] iotests: Avoid realpath Eric Blake
2018-03-14 14:47 ` Eric Blake
2018-03-15  7:08   ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).