]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuTestCapsCacheInsert: Rewrite caps cache insertion
authorPeter Krempa <pkrempa@redhat.com>
Wed, 5 Jan 2022 19:53:18 +0000 (20:53 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 7 Jan 2022 08:25:14 +0000 (09:25 +0100)
commitfd9aa4d17c71188424a7a07d67abc4328d374d19
treebeed64f3c8c91e30e4fc7ba12e6050dd9e1fdd8d
parent33582212cdad117579ff34dd56c61886306ae48a
qemuTestCapsCacheInsert: Rewrite caps cache insertion

Until now we did 2 weird things when inserting the qemuCaps used for
individual test cases into the capability cache:

1) we inserted the same caps for all emulators
2) we always (expensively) copied them

Now when real capabilities are used we don't touch them at all just
simply inser them. This allows us one big optimization, by trading a
copy for just a virObjectRef as we can borrow the caps object to the
cache.

For fake caps we still copy them as we insert the fake machine types
into them, but second big optimization is to insert the capabilities
only for the architecture they belong to.

Additionally this commit also ensures that all other entries in the
cache for the binary are poisoned by empty caps so that it's obvious
that the test is doing the right thing.

Apart from this making actually more sense this shaves off more than 40%
of runtime from qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/testutilsqemu.c