From patchwork Mon Nov 30 16:44:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 550246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 204651401F6 for ; Tue, 1 Dec 2015 03:47:06 +1100 (AEDT) Received: from localhost ([::1]:42051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3RbU-0002Zg-4h for incoming@patchwork.ozlabs.org; Mon, 30 Nov 2015 11:47:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3RZW-0007Zn-Id for qemu-devel@nongnu.org; Mon, 30 Nov 2015 11:45:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3RZV-0007fE-MM for qemu-devel@nongnu.org; Mon, 30 Nov 2015 11:45:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3RZV-0007f5-BA for qemu-devel@nongnu.org; Mon, 30 Nov 2015 11:45:01 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 0F075257 for ; Mon, 30 Nov 2015 16:45:01 +0000 (UTC) Received: from localhost (ovpn-113-65.phx2.redhat.com [10.3.113.65]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAUGixPS013906; Mon, 30 Nov 2015 11:45:00 -0500 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Mon, 30 Nov 2015 17:44:48 +0100 Message-Id: <1448901890-17012-3-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1448901890-17012-1-git-send-email-marcandre.lureau@redhat.com> References: <1448901890-17012-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mst@redhat.com Subject: [Qemu-devel] [PATCH for-2.5 v4 2/4] vhost-user-test: use unix port for migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau TCP port 1234 may be used by another process concurrently. Instead use a temporary unix socket. Signed-off-by: Marc-André Lureau Reviewed-by: Alex Bennée --- tests/vhost-user-test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 261f4b7..29205ed 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -123,6 +123,7 @@ static VhostUserMsg m __attribute__ ((unused)); typedef struct TestServer { gchar *socket_path; + gchar *mig_path; gchar *chr_name; CharDriverState *chr; int fds_num; @@ -364,6 +365,7 @@ static TestServer *test_server_new(const gchar *name) gchar *chr_path; server->socket_path = g_strdup_printf("%s/%s.sock", tmpfs, name); + server->mig_path = g_strdup_printf("%s/%s.mig", tmpfs, name); chr_path = g_strdup_printf("unix:%s,server,nowait", server->socket_path); server->chr_name = g_strdup_printf("chr-%s", name); @@ -405,6 +407,9 @@ static gboolean _test_server_free(TestServer *server) unlink(server->socket_path); g_free(server->socket_path); + unlink(server->mig_path); + g_free(server->mig_path); + g_free(server->chr_name); g_free(server); @@ -512,7 +517,7 @@ static void test_migrate(void) { TestServer *s = test_server_new("src"); TestServer *dest = test_server_new("dest"); - const char *uri = "tcp:127.0.0.1:1234"; + char *uri = g_strdup_printf("%s%s", "unix:", dest->mig_path); QTestState *global = global_qtest, *from, *to; GSource *source; gchar *cmd; @@ -583,6 +588,7 @@ static void test_migrate(void) test_server_free(dest); qtest_quit(from); test_server_free(s); + g_free(uri); global_qtest = global; }