From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abj4p-0003jH-NM for qemu-devel@nongnu.org; Fri, 04 Mar 2016 01:19:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abj4m-0006xK-Em for qemu-devel@nongnu.org; Fri, 04 Mar 2016 01:19:03 -0500 Received: from [59.151.112.132] (port=11911 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abj4l-0006sJ-1o for qemu-devel@nongnu.org; Fri, 04 Mar 2016 01:19:00 -0500 References: <1456748635-1912-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <1456748635-1912-4-git-send-email-zhangchen.fnst@cn.fujitsu.com> <56D68C6D.30800@redhat.com> From: Li Zhijian Message-ID: <56D928B6.1030101@cn.fujitsu.com> Date: Fri, 4 Mar 2016 14:18:30 +0800 MIME-Version: 1.0 In-Reply-To: <56D68C6D.30800@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2 3/3] tests/test-filter-redirector: Add unit test for filter-redirector List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang , Zhang Chen , qemu devel Cc: Gui jianfeng , Yang Hongyang , "eddie.dong" , zhanghailiang , "Dr. David Alan Gilbert" On 03/02/2016 02:47 PM, Jason Wang wrote: > > > On 02/29/2016 08:23 PM, Zhang Chen wrote: >> In this unit test,we will test the filter redirector function. >> >> Start qemu with: >> >> "-netdev tap,id=qtest-bn0 " > > Please don't use tap since it needs > > - CAP_NET_ADMIN > - if-up script > > Neither of above could not be true for a qtest environment. > >> "-device rtl8139,netdev=qtest-bn0,id=qtest-e0 " >> "-chardev socket,id=redirector0,path=%s,server,nowait " >> "-chardev socket,id=redirector1,path=%s,server,nowait " >> "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0," >> "queue=tx,indev=redirector1 " >> "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0," >> "queue=tx,outdev=redirector0 " >> >> We inject packet to -chardev redirector1,then filter-redirector >> will pass it to filter, another filter-redirector get it and >> redirect it to redirector0,we read packet from redirector0 >> and compare to what we inject. > > Looks correct but I think queue='rx' should also be tested here. How about: > > - using backend > - redirect tx traffic to a chardev, then inject packet from socket and > read it from chardev > - redirect from another chardev to rx traffic, then inject packet from > chardev and read if from socket? > hi, Jason IIUC, a full UT for redirector should include following cases. How about they: rd[n]: redirctor n Case 1, tx traffic flow: qemu side | test side | +---------+ | +-------+ | backend <---------------+ sock0 | +----+----+ | +-------+ | | +----v----+ +-------+ | | rd0 +->+chardev| | +---------+ +---+---+ | | | +---------+ | | | rd1 <------+ | +----+----+ | | | +----v----+ | +-------+ | rd2 +--------------->sock1 | +---------+ | +-------+ + -------------------------------------- Case 2, rx traffic flow qemu side | test side | +---------+ | +-------+ | backend +---------------> sock1 | +----^----+ | +-------+ | | +----+----+ +-------+ | | rd0 +->+chardev| | +---------+ +---+---+ | ^ | +---------+ | | | rd1 +------+ | +----^----+ | | | +----+----+ | +-------+ | rd2 <---------------+sock0 | +---------+ | +-------+ + Thanks Li Zhijian