From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id A1D0C1B016 for ; Tue, 9 Jan 2018 07:14:58 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DEFA81529; Mon, 8 Jan 2018 22:14:57 -0800 (PST) Received: from phil-VirtualBox.shanghai.arm.com (phil-virtualbox.shanghai.arm.com [10.169.38.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 290A73F487; Mon, 8 Jan 2018 22:14:57 -0800 (PST) From: Phil Yang To: dts@dpdk.org Cc: nd@arm.com, yong.liu@intel.com, phil.yang@arm.com Date: Tue, 9 Jan 2018 14:14:47 +0800 Message-Id: <1515478487-5446-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515148140-28422-1-git-send-email-phil.yang@arm.com> References: <1515148140-28422-1-git-send-email-phil.yang@arm.com> Subject: [dts] [PATCH v2] tests/vhost_user_live_migration: Optimize for multi-platform. X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 06:14:58 -0000 1. Optimize for multi platform; 2. Setting a longer timeout for vm communication to avoid unexpected error. 3. Support multi version of tcpdump direction parameter(-Q or -P). Signed-off-by: Phil Yang --- tests/TestSuite_vhost_user_live_migration.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/TestSuite_vhost_user_live_migration.py b/tests/TestSuite_vhost_user_live_migration.py index 3f64244..9bd3237 100644 --- a/tests/TestSuite_vhost_user_live_migration.py +++ b/tests/TestSuite_vhost_user_live_migration.py @@ -32,11 +32,10 @@ class TestVhostUserLiveMigration(TestCase): self.backup_tport = self.tester.get_local_port_bydut(self.backup_port, self.backup_dutip) self.backup_tintf = self.tester.get_interface(self.backup_tport) - # Use testpmd as vhost-user application on host/backup server - self.vhost = "./x86_64-native-linuxapp-gcc/app/testpmd" + # Use testpmd as vhost-user application on host/backup server + self.vhost = "./%s/app/testpmd" % self.target self.vm_testpmd = "./%s/app/testpmd -c 0x3 -n 4 -- -i" % self.target self.virio_mac = "52:54:00:00:00:01" - # flag for environment self.env_done = False @@ -222,7 +221,17 @@ class TestVhostUserLiveMigration(TestCase): vm_intf = vm_dut.ports_info[0]['port'].get_interface_name() # start tcpdump the interface vm_dut.send_expect("ifconfig %s up" % vm_intf, "# ") - vm_dut.send_expect("tcpdump -i %s -P in -v" % vm_intf, "listening on") + + direct_pat = re.compile(r"(\s+)\[ (\S+) in\|out\|inout \]") + vm_dut.send_expect("tcpdump -h", "# ") + out = vm_dut.get_session_output(timeout=1) + m = direct_pat.search(out) + if m: + direct_param = "-" + m.group(2)[1] + " in" + else: + direct_param = "" + + vm_dut.send_expect("tcpdump -i %s %s -v" % (vm_intf, direct_param), "listening on", 120) # wait for promisc on time.sleep(3) # send packets from tester @@ -277,17 +286,17 @@ class TestVhostUserLiveMigration(TestCase): # start testpmd on host vm base_dir = self.vm_host.base_dir.replace('~', '/root') self.host_serial.send_expect('cd %s' % base_dir, "# ") - self.host_serial.send_expect(self.vm_testpmd, "testpmd> ") + self.host_serial.send_expect(self.vm_testpmd, "testpmd> ", 120) # verify testpmd receive packets self.verify_dpdk(self.host_tport, self.host_serial) self.logger.info("Migrate host VM to backup host") # start live migration - + ret = self.host_vm.start_migration(self.backup_dutip, self.backup_vm.migrate_port) self.verify(ret, "Failed to migration, please check VM and qemu version") - + # make sure still can receive packets in migration process self.verify_dpdk(self.host_tport, self.host_serial) -- 2.7.4