Re: [PATCH 4/8] tests: don't alter state in $HOME

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

 



On 03/27/2011 02:59 AM, Laine Stump wrote:
> On 03/26/2011 08:12 AM, Eric Blake wrote:
>> Diego reported a bug where virsh tries to initialize a readline
>> history directory during 'make check' run as root, but fails
>> because /root was read-only.
>>
>> It turns out that I could reproduce this as non-root, by using:
>>
>> mv ~/.virsh{,.bak}
>> chmod a-w ~
>> make check -C tests TESTS=int-overflow
>> chmod u+w ~
>> mv ~/.virsh{.bak,}
>>
>> * tests/int-overflow: Don't trigger interactive mode.
>> Reported by Diego Elio PettenÃ.
>> ---
>>
>>
>>   echo "error: failed to get domain '4294967298'">  exp || fail=1
>> -echo domname 4294967298 | $abs_top_builddir/tools/virsh --quiet \
>> +$abs_top_builddir/tools/virsh --quiet \
>>       --connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \
>> ->  /dev/null 2>  err || fail=1
>> +    'domname 4294967298; quit'>  /dev/null 2>  err || fail=1
>>   diff -u err exp || fail=1
> 
> Why the "; quit" in the command? a quit is implicit anyway.

A quit may be implicit, but the problem at hand is what $? gets set to
in the shell after virsh is done.  In batch mode, virsh exits with the
status of the last command executed, and we expect the domname command
to fail (invalid argument), whereas quit (trivially) succeeds.  That is,
since the shell script expects $? to be zero, the quit command is
necessary to avoid polluting the exit status with the failure from
domname while still proving that virsh didn't abort command processing
merely because one command failed.  We didn't need the quit in
interactive mode, because EOF is treated the same as an implicit quit
command.

> 
> ACK, with or without the quit - it works either way.

Pushed with the quit.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
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]