From patchwork Tue May 30 13:57:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 9754641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D57A602BF for ; Tue, 30 May 2017 14:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EB2327EE2 for ; Tue, 30 May 2017 14:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 635EE2846B; Tue, 30 May 2017 14:03:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E69D27EE2 for ; Tue, 30 May 2017 14:03:42 +0000 (UTC) Received: from localhost ([::1]:53993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFhkL-0008HZ-Dj for patchwork-qemu-devel@patchwork.kernel.org; Tue, 30 May 2017 10:03:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFhfZ-0005DJ-Hr for qemu-devel@nongnu.org; Tue, 30 May 2017 09:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFhfV-0007G7-0j for qemu-devel@nongnu.org; Tue, 30 May 2017 09:58:45 -0400 Received: from mail-he1eur01on0131.outbound.protection.outlook.com ([104.47.0.131]:9825 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFhfU-0007Fk-LC for qemu-devel@nongnu.org; Tue, 30 May 2017 09:58:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7Nh/N7yKoHYdOgoTlCfM2I745lNVTwu2i1oMu8HFWr0=; b=AVMH17qTSLWai3fFViVmzfJUTXKQCsVxDSQ4RHshUc/cPGo8l4rhheoTFPyqWSXytYwUwHCKg69i0GcRUsUuQUFKDZQfLfQwmiQ+sLokLSj1fzQoxIgY6slA9vkMsHfT+7NfLmA+SlSo8RpuAKJa1LCnsV/2C5pXnc+Pp3hNW/o= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Tue, 30 May 2017 13:58:31 +0000 From: Anton Nefedov To: Date: Tue, 30 May 2017 16:57:57 +0300 Message-ID: <1496152683-102751-8-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496152683-102751-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1496152683-102751-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR02CA0033.eurprd02.prod.outlook.com (2603:10a6:6:15::46) To HE1PR0801MB1993.eurprd08.prod.outlook.com (2603:10a6:3:4f::23) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1993: X-MS-Office365-Filtering-Correlation-Id: 84664dd8-9825-4deb-3b41-08d4a763f4ee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 3:MR4jnFHea+KWyGwJr5t8JrHLKKrTi4oIsdZYafFiahacJ3nhw7Peu7Tz/4iAOr3Uivy+2rZOS5aYsDFBn2ilGYYWsbKoSIlKJvajsIAcpfryTU2n+o36lnFzew1X3Cpd7kAR29LiGijkd+moZdg6VvZURstRw2sWNoLOLNPQ7RykwrOzLTshrD0Jw5SXmIObSW2mDe1pwrPFPWwVj6/X9/HiJL/ZxdG1uSlNSR4S/pl1TaCFYCzQ1RjTy2R70OxZ3tNlyt0my5g7JECYIovtFq3P3wEkFDe+yEUk4Ur0Qkht1wYCW2F6PxA3F7H50WlbT9ZyX6wUuMz48x02nBLzLA==; 25:Irz8dRncabixijZ93KcNeusQ/J1Smb51KfQLuWyJtJRKTGbWGe6dtRmVDzxhHBd8dTjtKedFstIZpZhS3O9nSc8A7Rmsbx6/uPCN1XDwe3VpSwEmdYNnP1qTsznTXA7JpHxGnVZZ6IncDSq23ogP9cBUR1elY2oOWXXoRsd4iwpAKM9lvAPcKPcp10Wz0hbUpYlocXUd1tR4eCvZkKmxkobw1QYPtGYlImAVmXWJzdx0VJ3A2SDASey/tFk0P6BKD7Yc2k3avFD7NecwvGfuoQWcup87PkN0zpfpAuIr5DpoMFI1qpYJMOPgGS9OQQlkL9lYV4PJZYWjsCB0VZZ7uG1SgPwKxXOokeuiAhySpH6CWVXMNsz1Mb5s5rtk1VoccOlrYQLeWh9cVD80eLD5HYIxJ6iC/g/h3R/+fCHPFnLWBdd6Q0ksgCfYf+EQsTmmEV9NG9cFo4TVEK92BJpIlp4wGRKxby2I+VAabVJs+MI= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 31:5EcLYqrxhIp2PZIRbClRZVsviVdrMPHJY6Qzbix+LPm/2iaCvAw1NAKgJIQ5IktJhkOSPGgfiNK3iux8XrO95eE0udLGTQHGN3dxal5eAw+PdJs9igg/ryXm13U6kCSK/ZGb2lT/WugFYN5Vx0EvaMK0rzla/BDfa9acVcbwSEV7ggx35lu2ENqOalEWD9sOcSLGw6uqQtV2U51Kl1RJnSj2MKT6bIkmE59pEQVIQ3Q=; 20:oDMKccTWSCsGOyZ91Z4YrlA0oUYwtntG7Rp2talUGT6Vt6YV9j9qcRO7LU4WYhCthhgEjWDbprYPzzQG+UZuCLWMrDPIKrl82pWg9hmC5+6Fng3H+7t+peq9y0YxdSDFaWGWI3tjOAxhRDi8JaNzbFks854JxxgBDKoJH5nOY0oBg3PxaOo84Rz/JsXJkTq2ua2YjmStlxPvC3rYSNgbcFR9l+21p+2yEyPiBJQ7lu4mD+D/4y1CsdyvkxRhPBS3kW1FV+JHyJaAmZc+QkgPLAW7AGUWFBDspHvTvGmwKQidfOclMSoiTCkbcMHQSRfue1JnAckn1E9seUCztIg3yBSfILSPVAcDACZNua8X8TSESi9fmGZ5T4XqMN5fUyGJdjMCbG/aCmIHlX01DMhMhVU/kMflsPkxDvAjguKoHu4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700073)(100105000095)(100000701073)(100105300095)(100000702073)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703073)(100105400095)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123558100)(20161123555025)(6072148)(100000704073)(100105200095)(100000705073)(100105500095); SRVR:HE1PR0801MB1993; BCL:0; PCL:0; RULEID:(100000800073)(100110000095)(100000801073)(100110300095)(100000802073)(100110100095)(100000803073)(100110400095)(100000804073)(100110200095)(100000805073)(100110500095); SRVR:HE1PR0801MB1993; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB1993; 4:H/XjoVXVMD6KeCKnnNJ5bA9qx3H2U0uQIkO6rCSL?= =?us-ascii?Q?rGJwhsx+UzvrIRXgAg80W1KAD5CVytpXZXJUlhuk/OH1jkd2FNgHBxW257QC?= =?us-ascii?Q?UqwydLtJ9wCa826pG7WO5gezZo0Ai8fE/AZPdUoa5SqKdkFLiBF0E+mHrlLx?= =?us-ascii?Q?JjuwDE6r2EmRsrRvAbB6d+ulY5W/2AhGxfz6xMm4r6BVPOIEGgmzxB5YIlkT?= =?us-ascii?Q?uutP01Jvsns19mB2S2ZQJ1gf/Bgnr5AYPgWSE8DTQLV8g1zHwoRkX6+xuiTj?= =?us-ascii?Q?AzeO5T6qDlQYr4aSKR+KoMapnMh1j5bcQddH/kfE4XU9JlyNyWVHSt2bbcKX?= =?us-ascii?Q?rZG92Saot0mfGq1yFLqCOKy9Bbzl3c6K7g7Wi0CZzVcJI/ZcFdIMUY634qaw?= =?us-ascii?Q?9OXPHwRIHuxzGu4+RzEkbWcI/GpAReTgv6TM+Z1SxQ+tNj+NaOo2bw2fJqcf?= =?us-ascii?Q?gtWnycJvzFHgAEfYTsC53Wal7P1uKkVUWskhPWCevmpVYFJLoT1z8rO8DWeX?= =?us-ascii?Q?7zRty9Lgd4ENFqAgbSoL3zFvgqgizUFiLJdyO4ZiNCAioKYy0b+TIPwu1cGX?= =?us-ascii?Q?QH94cS3yBwuhLxMYK61DmJn+X4+vp8G0hwOSbvpjsd+qTIHx0MvVGeqzT2pN?= =?us-ascii?Q?meXLNiCY+92vPpcClDBmHuNLInGjCrZkAw89eOxV77k2dRpRXmzRF9uE6WxE?= =?us-ascii?Q?YBFzHZdck0VQEk1rWfVhpvPEYpg8ATwKLluBVtH8qxC8VbupYYhkweZoTlwV?= =?us-ascii?Q?pPQ/afDSxPLA7corDqMLduWJYZ6IwKO9oQr33JglvNrBbx4hLs7Br8BHqIb7?= =?us-ascii?Q?3Cq7H2vFoux6QbqIW0JojGDePqYCteCkvx/X9ReDpNJaENQk5AJSmzUT8iTD?= =?us-ascii?Q?LRic6bVEC5mEoCxoSO3wbCXq8G5BcA2JD8SRGSRYikaTGYjn4H2mAMPU8+O4?= =?us-ascii?Q?QdMeYKkcViwRYFrsMELgzZehkWJGFTTc3/irYfb2wdxLRC2zXEpZswrHpBdE?= =?us-ascii?Q?8MA1m+XnNpaTPQFAlcvCaJAOqTiqk3pbaIV2g54Ez4OVL/29Ubz/RixbagwU?= =?us-ascii?Q?3tEOG3EzF8an3+2rH5yv52+pbqK5OoloRKlsK7qfdxtFdde787JDFBurBODS?= =?us-ascii?Q?N2QOI2oVlE7eZYqEfJT32L60DtEXncQj?= X-Forefront-PRVS: 032334F434 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39830400002)(39450400003)(39410400002)(39400400002)(6506006)(6486002)(86362001)(6916009)(2950100002)(6666003)(54906002)(38730400002)(53936002)(6512007)(25786009)(478600001)(5660300001)(47776003)(305945005)(7736002)(66066001)(107886003)(5003940100001)(110136004)(189998001)(2906002)(4326008)(50226002)(3846002)(8676002)(81166006)(6116002)(53416004)(50466002)(2351001)(48376002)(76176999)(42186005)(50986999)(33646002)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1993; H:xantnef-ws.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB1993; 23:oUnFFNUbvML0CwnhYGw6/vK1/NB36TeP1a6zGp0?= =?us-ascii?Q?/JG0azb8z9du+rIFukBn3skfkTRGac62EioaX9Il3Fgw64b35y+nklEP2jS/?= =?us-ascii?Q?8UC0d6eh+Hxx5pqng+kOUf5Pk2NezEYZXsjqhQu7VFX1ideloQRitPqk64vT?= =?us-ascii?Q?GGr7Vn8FqrsiJ34hrZwyXUkWF7wrAUL7tL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oLR5f0dQOmFRWn9zFjHehAHoc8I2TrjCXP/9Ejb6UD/e5V+vpWuJBj+0DHwDRln3J6Xo/6sc+; 24:3DyzgAgoKgxnQgT8chJdJAFcTwt5Q1yXua0uOXN68jV2bf4Gbixeqfn7QEnRfC9SAIqeMz6jm2E5vIfggYSHpQuVDsiaLVQfF+gBNdtlc3g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1993; 7:a6skoXx9QSpGJy/YED/MvHI9ovp47y4o/FE+Dn5JA8oEM/RtBdR/eVcqwlyxwE9ron7mv12wQvpdJVVym6R522VQ65j424NcTd57FGMp1coJLzZlzSlN2rxgyxnBNdKNF1poHe3v9u33Zw+wT051WgFsdkI75tsEUzKgOfcJNfTr9NjPaqq8iHRp3jp6m9MSyIfsz8aZjvcfy3TWxxfU+Q2QnLoLyayhqa5XSzrg/iSrM4/ZKodJA4moRpiA0aLDkQzpXaRli5rRFyjMGUJbGunsTDeZfGCcpEkc2DU7OvCPfQEEA0SqrB9Cnl3bjQx/vc6psePovVSCGigRQ2bufw==; 20:3/DoiStFjvXvVH60MUTQC6/MBuedXAv061x56mEz38081Sdd6fA1q5XVv68pnrBgiSZK+62e07FYPkwb77f6wn/o1pG9dk4K0HTWGMIoWgbILxJjz7zrr5VFrSCYpA+ZBfYqiqhabaX0D9ewsaXYcGHQWsfWpHq42EkarhmRC2A= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2017 13:58:31.1120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1993 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.0.131 Subject: [Qemu-devel] [PATCH v3 07/13] test-char: split char_udp_test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Anton Nefedov , den@virtuozzo.com, marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP makes it possible to test the existing chardev-udp Signed-off-by: Anton Nefedov Reviewed-by: Marc-André Lureau --- tests/test-char.c | 58 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/tests/test-char.c b/tests/test-char.c index d63d3d2..ad0752a 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -413,16 +413,11 @@ static void char_pipe_test(void) } #endif -static void char_udp_test(void) +static int make_udp_socket(int *port) { - struct sockaddr_in addr = { 0, }, other; - SocketIdleData d = { 0, }; - Chardev *chr; - CharBackend be; + struct sockaddr_in addr = { 0, }; socklen_t alen = sizeof(addr); int ret, sock = qemu_socket(PF_INET, SOCK_DGRAM, 0); - char buf[10]; - char *tmp; g_assert_cmpint(sock, >, 0); addr.sin_family = AF_INET ; @@ -433,19 +428,41 @@ static void char_udp_test(void) ret = getsockname(sock, (struct sockaddr *)&addr, &alen); g_assert_cmpint(ret, ==, 0); - tmp = g_strdup_printf("udp:127.0.0.1:%d", - ntohs(addr.sin_port)); - chr = qemu_chr_new("client", tmp); - g_assert_nonnull(chr); + *port = ntohs(addr.sin_port); + return sock; +} + +static void char_udp_test_internal(Chardev *reuse_chr, int sock) +{ + struct sockaddr_in other; + SocketIdleData d = { 0, }; + Chardev *chr; + CharBackend *be; + socklen_t alen = sizeof(other); + int ret; + char buf[10]; + char *tmp = NULL; + + if (reuse_chr) { + chr = reuse_chr; + be = chr->be; + } else { + int port; + sock = make_udp_socket(&port); + tmp = g_strdup_printf("udp:127.0.0.1:%d", port); + chr = qemu_chr_new("client", tmp); + g_assert_nonnull(chr); + + be = g_alloca(sizeof(CharBackend)); + qemu_chr_fe_init(be, chr, &error_abort); + } d.chr = chr; - qemu_chr_fe_init(&be, chr, &error_abort); - qemu_chr_fe_set_handlers(&be, socket_can_read_hello, socket_read_hello, + qemu_chr_fe_set_handlers(be, socket_can_read_hello, socket_read_hello, NULL, NULL, &d, NULL, true); ret = qemu_chr_write_all(chr, (uint8_t *)"hello", 5); g_assert_cmpint(ret, ==, 5); - alen = sizeof(addr); ret = recvfrom(sock, buf, sizeof(buf), 0, (struct sockaddr *)&other, &alen); g_assert_cmpint(ret, ==, 5); @@ -454,10 +471,17 @@ static void char_udp_test(void) main_loop(); - close(sock); + if (!reuse_chr) { + close(sock); + qemu_chr_fe_deinit(be); + object_unparent(OBJECT(chr)); + } g_free(tmp); - qemu_chr_fe_deinit(&be); - object_unparent(OBJECT(chr)); +} + +static void char_udp_test(void) +{ + char_udp_test_internal(NULL, 0); } static void char_file_test(void)