[PATCH 24/36] qemuxml2argvtest: Add support for populating 'fds' in private data

Pavel Hrdina phrdina at redhat.com
Fri Jan 6 13:35:58 UTC 2023


On Fri, Jan 06, 2023 at 02:28:39PM +0100, Peter Krempa wrote:
> On Fri, Jan 06, 2023 at 14:06:50 +0100, Pavel Hrdina wrote:
> > On Thu, Jan 05, 2023 at 05:30:13PM +0100, Peter Krempa wrote:
> > > Introduce a new argument type for testQemuInfoSetArgs named ARG_FD_GROUP
> > > which allows users to instantiate tests with populated FD passing hash
> > > table.
> > 
> > I don't like when we need to alter the code in order to be able to test
> > it. There should be another better way of ensuring we have stable FDs
> > for tests. Not sure how difficult it would be to change it so we need
> > to go with this approach for now but would be nice to rework this by
> > follow up patches.
> 
> All the other code uses invalid FD numbers. That doesn't work very well
> when you need to duplicate them though.
> 
> When we'd mock 'dup' then it becomes order dependant which is very hard
> to debug especially when combined with LD_PRELOAD-ed libraries we use
> for mocking.
> 
> The advantage here is that we don't have fake FDs, thus dup works and
> it's the output doesn't change based on the system.
> 
> Obviously for real usage we don't care about the specific numbers.

Yeah I figured there might be some catch that I did not realize.

Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230106/51ca9310/attachment-0001.sig>


More information about the libvir-list mailing list