[PATCH 2/3] testutilsqemu: Mock virTPMSwtpmSetupCapsGet()

Andrea Bolognani abologna at redhat.com
Mon Aug 1 16:06:52 UTC 2022


On Fri, Jul 29, 2022 at 09:42:12AM +0200, Michal Privoznik wrote:
> In a recent commit of v8.5.0-85-g430ab88ab1 I've made domaincaps
> XML report supported TPM versions. This was done by calling
> virTPMSwtpmSetupCapsGet(). But this function isn't mocked and
> thus domaincapstest calls the real implementation, which tries to
> execute swtpm_setup binary. This fails, because
> virFindFileInPath() is mocked in such way that it returns NULL
> for anything else than qemu-*.
>
> Anyway, while the real binary is not executed after all, we
> should mock the function which tries to execute it so that
> predictable result is returned.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tests/testutilsqemu.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Reviewed-by: Andrea Bolognani <abologna at redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization



More information about the libvir-list mailing list