Re: [PATCH 5/7] Add virCommandSetMockOutputFile

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

 



On Wed, Mar 12, 2014 at 04:33:22PM +0100, Ján Tomko wrote:
> On 03/12/2014 03:26 PM, Daniel P. Berrange wrote:
> > On Wed, Mar 12, 2014 at 02:08:15PM +0100, Ján Tomko wrote:
> >> > After this file is set, all commands executed will be replaced by
> >> > cat <file>.
> > I think this is a bit too special case and unecessarily forces
> > use of an external cat command. I think your test would be
> > easier if using this callback approach I've just proposed
> > 
> > https://www.redhat.com/archives/libvir-list/2014-March/msg00733.html
> 
> Definitely nicer, but it doesn't work with asynchronous commands.

Looking at the code it seems that the places which us virCommandRunAsync
will create a FILE * from the output file descriptor, and then read
full lines of output processing each in turn.

What do you think about re-writing that so that it uses virCommandRun,
and provides a  char **output buffer, which we then just call
virStringSplit(output, "\n") instead to get the list of lines to
process.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]