[Qemu-devel] [PATCH] iotests: Print full path of bad output if mismatch

Fam Zheng posted 1 patch 6 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170915054526.20588-1-famz@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
tests/qemu-iotests/check | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] iotests: Print full path of bad output if mismatch
Posted by Fam Zheng 6 years, 6 months ago
So it is easier to copy paste the path.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index d504b6e455..4583a0c269 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -353,7 +353,7 @@ do
                 else
                     echo " - output mismatch (see $seq.out.bad)"
                     mv $tmp.out $seq.out.bad
-                    $diff -w "$reference" $seq.out.bad
+                    $diff -w "$reference" $(realpath $seq.out.bad)
                     err=true
                 fi
             fi
-- 
2.13.5


Re: [Qemu-devel] [PATCH] iotests: Print full path of bad output if mismatch
Posted by Kevin Wolf 6 years, 6 months ago
Am 15.09.2017 um 07:45 hat Fam Zheng geschrieben:
> So it is easier to copy paste the path.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

I don't think I ever tried to do anything with the diff that would have
required the full path, but if you say so... :-)

Thanks, applied to the block branch.

Kevin

Re: [Qemu-devel] [PATCH] iotests: Print full path of bad output if mismatch
Posted by Fam Zheng 6 years, 6 months ago
On Fri, 09/15 14:16, Kevin Wolf wrote:
> Am 15.09.2017 um 07:45 hat Fam Zheng geschrieben:
> > So it is easier to copy paste the path.
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> I don't think I ever tried to do anything with the diff that would have
> required the full path, but if you say so... :-)
> 
> Thanks, applied to the block branch.

Thanks.

I often create a new reference output or fix an old one by

    cp /x/y/z.out.bad tests/qemu-iotests/???.out

and either the /x/y/z or the path to QEMU repo is some typing if from
out-of-tree build, so getting it from the output of check is handy..

Fam

Re: [Qemu-devel] [PATCH] iotests: Print full path of bad output if mismatch
Posted by Eric Blake 6 years, 6 months ago
On 09/15/2017 12:45 AM, Fam Zheng wrote:
> So it is easier to copy paste the path.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  tests/qemu-iotests/check | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index d504b6e455..4583a0c269 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -353,7 +353,7 @@ do
>                  else
>                      echo " - output mismatch (see $seq.out.bad)"
>                      mv $tmp.out $seq.out.bad
> -                    $diff -w "$reference" $seq.out.bad
> +                    $diff -w "$reference" $(realpath $seq.out.bad)

Realpath collapses symlinks, and $() costs a process.  Also, your patch
fails miserably if the current working directory contains spaces; you
forgot to quote $().  It would be simpler, and more correct, to do:

$diff -w "$reference" "$PWD/$seq.out.bad"

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