On Thursday, 1 December 2016 13:21:03 CET Tomáš Golembiovský wrote:
> > > > > diff --git a/v2v/test-v2v-i-ova-subfolders.sh 
> > > > > b/v2v/test-v2v-i-ova-subfolders.sh
> > > > > index c49f7cb..89a9a3e 100755
> > > > > --- a/v2v/test-v2v-i-ova-subfolders.sh
> > > > > +++ b/v2v/test-v2v-i-ova-subfolders.sh
> > > > > @@ -35,6 +35,7 @@ fi
> > > > >  export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
> > > > >  
> > > > >  . $srcdir/../test-data/guestfs-hashsums.sh
> > > > > +. $srcdir/../test-data/utils.sh
> > > > >  
> > > > >  d=test-v2v-i-ova-subfolders.d
> > > > >  rm -rf $d
> > > > > @@ -56,10 +57,15 @@ popd
> > > > >  # normalize the output.
> > > > >  $VG virt-v2v --debug-gc --quiet \
> > > > >      -i ova $d/test.ova \
> > > > > -    --print-source |
> > > > > -sed 's,[^ \t]*\(subfolder/disk.*\.vmdk\),\1,' > $d/source
> > > > > +    --print-source > $d/source
> > > > >  
> > > > >  # Check the parsed source is what we expect.
> > > > > -diff -u test-v2v-i-ova-subfolders.expected $d/source
> > > > > +if qemu_version 2 8 ; then    
> > > > 
> > > > Here I'd normalize the output, by removing "$d/" (i.e. the path of the
> > > > subdirectory plus the trailing slash):
> > > > 
> > > >   sed -i -e "s,$d/,." $d/source
> > > >   
> > > 
> > > Any specific reason for that? Here $d is specific to the test. It does
> > > not change between single runs of the test.  
> > 
> > Just like we normalize the line in the output containing the vmdk path,
> > IMHO the reference test output should not contain any path to the test
> > itself. Easier to read and maintain IMHO.
> 
> As I see it, the main reason for removing path to vmdk was that the
> output is in temporary directory and the path varies between test runs.
> This is not the case here because $d is fixed in the test-*.sh file.

Right, but renaming the test means also changing the expected output,
while there's nothing in the test result that really needs to know the
location of the input.

> Also, the output almost always depends on the test. I don't see a reason
> why the path should be treated somewhat differently here. If we remove
> the path it still won't allow us to reuse the *.expect file in two tests
> (not in this situation).

We usually leave the path when it matters as test result -- for example,
test-v2v-i-ova-subfolders.expected for test-v2v-i-ova-subfolders.sh,
which needs to check the subdirectory is the expected one.
In the case of your test, the location is where the test file exist,
which is not what needs to be checked.

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to