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 <jasow...@redhat.com>
---
  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


Reply via email to