qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/9] qtest: add C version of test infrastructure


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 3/9] qtest: add C version of test infrastructure
Date: Thu, 15 Mar 2012 10:03:03 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 03/15/2012 09:42 AM, Stefan Hajnoczi wrote:
On Thu, Mar 15, 2012 at 1:37 PM, Anthony Liguori<address@hidden>  wrote:
+    sock = socket(PF_UNIX, SOCK_STREAM, 0);
+    g_assert_no_errno(sock);
+
+    addr.sun_family = AF_UNIX;
+    snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path);
+
+    pid = fork();
+    if (pid == 0) {
+        command = g_strdup_printf("%s "
+                                  "-qtest unix:%s,server,nowait "
+                                  "-qtest-log /dev/null "
+                                  "-pidfile %s "
+                                  "-machine accel=qtest "
+                                  "%s", qemu_binary, socket_path,
+                                  pid_file,
+                                  extra_args ?: "");
+
+        ret = system(command);
+        exit(ret);
+        g_free(command);
+    }
+
+    do {
+        sleep(1);
+        ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
+    } while (ret == -1);

I believe Kevin suggested using -qtest unix:%s and creating the listen
socket in the test program rather than inside QEMU.  The advantage is
that we never sleep(3), instead we accept(2) the connection from QEMU
and get going right away.

Yeah, I missed that, it's an easy change to make.  I'll update.

Regards,

Anthony Liguori


This can be added as a patch later.

Kevin: Do you already have a patch or does someone need to write it?

Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]