diff mbox series

iotests: Print full path of bad output if mismatch

Message ID 20170915054526.20588-1-famz@redhat.com
State New
Headers show
Series iotests: Print full path of bad output if mismatch | expand

Commit Message

Fam Zheng Sept. 15, 2017, 5:45 a.m. UTC
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(-)

Comments

Kevin Wolf Sept. 15, 2017, 12:16 p.m. UTC | #1
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
Fam Zheng Sept. 15, 2017, 12:30 p.m. UTC | #2
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
Eric Blake Sept. 15, 2017, 6:13 p.m. UTC | #3
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"
diff mbox series

Patch

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