From b448abd9724232e2a96cd6b2b43dc63b6b62fd4e Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 1 Dec 2023 23:11:11 +0100 Subject: [PATCH] qemuxml2argvmock: Mock qemuInterfaceBridgeConnect Prepare for test cases which would want to call that function. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_interface.h | 2 +- tests/qemuxml2argvmock.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h index 6eed3e6bd7..67cbada36e 100644 --- a/src/qemu/qemu_interface.h +++ b/src/qemu/qemu_interface.h @@ -48,7 +48,7 @@ int qemuInterfaceBridgeConnect(virDomainDef *def, virDomainNetDef *net, int *tapfd, size_t *tapfdSize) - ATTRIBUTE_NONNULL(2); + ATTRIBUTE_NONNULL(2) G_NO_INLINE; int qemuInterfaceOpenVhostNet(virDomainObj *def, virDomainNetDef *net) G_NO_INLINE; diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index 52c44b2ed0..f2696bd4c3 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -113,6 +113,23 @@ virNetDevTapCreate(char **ifname, } } + +int +qemuInterfaceBridgeConnect(virDomainDef *def G_GNUC_UNUSED, + virQEMUDriver *driver G_GNUC_UNUSED, + virDomainNetDef *net G_GNUC_UNUSED, + int *tapfd, + size_t *tapfdSize) +{ + size_t i; + + for (i = 0; i < *tapfdSize; i++) + tapfd[i] = STDERR_FILENO + 100 + i; + + return 0; +} + + int virNetDevSetMAC(const char *ifname G_GNUC_UNUSED, const virMacAddr *macaddr G_GNUC_UNUSED)