From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 9417B4C96 for ; Wed, 6 Mar 2019 08:22:30 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 23:22:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,446,1544515200"; d="scan'208";a="149026265" Received: from nfvihost.sh.intel.com ([10.239.183.73]) by fmsmga002.fm.intel.com with ESMTP; 05 Mar 2019 23:22:28 -0800 From: michael.luo@intel.com To: dts@dpdk.org Date: Wed, 6 Mar 2019 15:19:12 +0800 Message-Id: <1551856752-16081-1-git-send-email-michael.luo@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats 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: Wed, 06 Mar 2019 07:22:31 -0000 From: Luo Gaoliang Detecting the categories of packet size from xstats to test the case test_based_size instead of using the hardcoded sizes. Because different NICs may categorize the big packets differently. For example, a 1024Byte packet, Niantic counts it into rx_size_1024_to_max_packets, but Fortville puts it into tx_size_1024_to_1522_packets. Signed-off-by: Luo Gaoliang --- tests/TestSuite_vhost_pmd_xstats.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/tests/TestSuite_vhost_pmd_xstats.py b/tests/TestSuite_vhost_pmd_xstats.py index e33b342..db59f48 100755 --- a/tests/TestSuite_vhost_pmd_xstats.py +++ b/tests/TestSuite_vhost_pmd_xstats.py @@ -158,21 +158,14 @@ class TestVhostPmdXstats(TestCase): Verify receiving and transmitting packets correctly in the Vhost PMD xstats """ self.prepare_start() - sizes = [64, 65, 128, 256, 513, 1025] - scope = '' - for pktsize in sizes: - if pktsize == 64: - scope = 'size_64' - elif 65 <= pktsize <= 127: - scope = 'size_65_to_127' - elif 128 <= pktsize <= 255: - scope = 'size_128_to_255' - elif 256 <= pktsize <= 511: - scope = 'size_256_to_511' - elif 512 <= pktsize <= 1023: - scope = 'size_512_to_1023' - elif 1024 <= pktsize: - scope = 'size_1024_to_max' + out = self.dut.send_expect( + "show port xstats %s" % self.dut_ports[0], "testpmd>", 60) + p = re.compile(r'rx_size_[0-9]+_[to_\w+]*packets') + categories = p.findall(out) + self.verify(len(categories) > 0, 'Unable to find the categories of RX packet size!') + for cat in categories: + scope = re.search(r'(?<=rx_)\w+(?=_packets)', cat).group(0) + pktsize = int(re.search(r'(?<=rx_size_)\d+', cat).group(0)) self.scapy_send_packet(pktsize, self.dmac, 10000) self.send_verify(scope, 10000) -- 2.7.4