From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1affRt-0001tT-Su for qemu-devel@nongnu.org; Mon, 14 Mar 2016 23:15:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1affRp-0001lf-SY for qemu-devel@nongnu.org; Mon, 14 Mar 2016 23:15:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1affRp-0001lC-Nr for qemu-devel@nongnu.org; Mon, 14 Mar 2016 23:15:05 -0400 References: <1457320380-5111-1-git-send-email-jasowang@redhat.com> <56DE802F.2060502@redhat.com> <56DE8436.60304@cn.fujitsu.com> <56DE859B.8020404@redhat.com> <56DE9630.5020109@cn.fujitsu.com> <56DF7E07.60803@cn.fujitsu.com> <56DFA5FE.8030503@cn.fujitsu.com> From: Jason Wang Message-ID: <56E77E35.7010805@redhat.com> Date: Tue, 15 Mar 2016 11:15:01 +0800 MIME-Version: 1.0 In-Reply-To: <56DFA5FE.8030503@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 00/14] Net patches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Li Zhijian , Wen Congyang , Peter Maydell , Zhang Chen Cc: QEMU Developers On 03/09/2016 12:26 PM, Li Zhijian wrote: > > > On 03/09/2016 09:36 AM, Wen Congyang wrote: >> On 03/08/2016 05:54 PM, Peter Maydell wrote: >>> On 8 March 2016 at 16:06, Zhang Chen >>> wrote: >>>> I found the reason for this problem is that >>>> unix_connect() have not connect to sock_path before iov_send(). >>>> It need time to establish connection. so can we fix it with usleep() >>>> like this: >>>> >>>> recv_sock = unix_connect(sock_path, NULL); >>>> g_assert_cmpint(recv_sock, !=, -1); >>>> + usleep(1000); >>>> >>>> ret = iov_send(send_sock[0], iov, 2, 0, sizeof(size) + >>>> sizeof(send_buf)); >>>> g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size)); >>>> close(send_sock[0]); >>>> >>>> ret = qemu_recv(recv_sock, &len, sizeof(len), 0); >>> >>> I would prefer it if we could find a way to fix this race >>> reliably rather than just inserting a delay and hoping it >>> is sufficient. Otherwise the test is likely to be unreliable >>> if run on a heavily loaded or slow machine. >> >> Yes, but there is no way to know when tcp_chr_accept() is called. Add >> a event >> to notify it? >> >> Thanks >> Wen Congyang >> > > Hi, Jason, PMM > As Congyang said that this is a bug of testcase instead of filter-mirror. > Maybe we should re-wrok the testcase, for example > - using -chardev pipe instead of -chardev socket, because we are > intend to test the packet mirror fuction instead of -chardev socket > > How about that ? I still prefer to use socket since it will be more similar to its real usage (e.g COLO). Btw, I haven't investigated deeply, but at least qmp command trick should work. But what's better is to passing the pre-connected fd (e.g the socket created by socketpair()) to chardev, not sure we can do this.