|
From: | Jason Wang |
Subject: | Re: [Qemu-devel] [PATCH for 3.1 3/4] virtio-net-test: accept variable length argument in pci_test_start() |
Date: | Mon, 3 Dec 2018 18:08:28 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
On 2018/11/30 下午11:02, Eric Blake wrote:
On 11/28/18 9:12 PM, Jason Wang wrote:This allows flexibility to be reused for all kinds of command line used by other tests. Signed-off-by: Jason Wang <address@hidden> --- tests/virtio-net-test.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 231e7c767e..33d26ab079 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c@@ -51,17 +51,20 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)return dev; } -static QOSState *pci_test_start(int socket) +static QOSState *pci_test_start(const char *cmd, ...)This should probably be tagged with GCC_FMT_ATTR(1, 2).
Ok.
@@ -218,11 +221,13 @@ static void pci_basic(gconstpointer data) QVirtQueue *tvq, int socket) = data; int sv[2], ret; + const char *cmd = "-netdev socket,fd=%d,id=hs0 -device " + "virtio-net-pci,netdev=hs0"; ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sv); g_assert_cmpint(ret, !=, -1); - qs = pci_test_start(sv[1]); + qs = pci_test_start(cmd, sv[1]);Do you really need an intermediate 'cmd' variable, or can you just inline the string constant command at the point of the call? -Wformat=non-literal may warn if you don't inline.
Fixed and post V4. Thanks
[Prev in Thread] | Current Thread | [Next in Thread] |