From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4A559A0524; Tue, 1 Jun 2021 18:58:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1554A40689; Tue, 1 Jun 2021 18:58:55 +0200 (CEST) Received: from mail-vs1-f99.google.com (mail-vs1-f99.google.com [209.85.217.99]) by mails.dpdk.org (Postfix) with ESMTP id 3C0CA40041 for ; Tue, 1 Jun 2021 18:58:54 +0200 (CEST) Received: by mail-vs1-f99.google.com with SMTP id z15so3101958vsn.13 for ; Tue, 01 Jun 2021 09:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+XfytmxwGyTH5mMkUiKc0DaP1aWFngorYqTVSHbtXBM=; b=FyDxvvF6vEB5QDVtgeW4floWXEhLPYrtaIzUPglFgH4rrNl5t1dzAnZKZ7sU1gMu7J l0w73jm8m/9kYecgBKALJ5+wrTp78zppF5zREk3H/4Lu2LZUOWTRhpgCfjpLfbkwtBSU xsejvgArZv7f659zSAlBtdzu0wFQbvULbzSSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+XfytmxwGyTH5mMkUiKc0DaP1aWFngorYqTVSHbtXBM=; b=FPe0b8RTDmroKpbLjnyI1xc7S4btu3zdxwLfsgw+Ft13FNiu4U69SHHk10JDXwiWmI sOTLMSVkRYnvhj30iA0VKBsaL/OC+cbkUasu0RVZm77ZRpu0qsNJRTDYrFv/wueN5rpu n7IHW/qGB76gHQeEw3ECA+Py1bZ5XDjqAbvnTr5EwgmO4cM9zbBmEEQFSjTRETw1kTY9 aM/+W5xjKIqwDYmMSIXxE220AtSFIjM3VwUkfw1nTYDK6G5sTc6Cz8yT2VPDn9Hf7/4A AcnmRFReOHyc7LdxIEkt4zTj4szEDmULxCCB3ty5DoYXTzMEyDnqEatbt7axoVetlAp0 PygQ== X-Gm-Message-State: AOAM533AEuyXS8mBMFd7BB+tRJmBGezBMY+4dGQNpuDYdXRtBwHd/mnn npuTIt1+sdDPAmTy3HpmueyA4doJfgYlMhFOQ0ZnPfUIP0xvPOUWykrlZoeXB3NoC7u2fByT5ej iFTk+imdnGibDm+Ofek5bkNK2Dq6lBp94kjQkMtLKGf5q//cpa7n9jpVgw0i2ozgVe8hB/bxmAA == X-Google-Smtp-Source: ABdhPJyGOFhFthlG4ExBe1qdlhrm3/EQ/FZzZNZXkoYmha55BciKbjyAYiMfXGoWXLFgTcqBPC1BPApBYqQT X-Received: by 2002:a67:f854:: with SMTP id b20mr273375vsp.14.1622566733548; Tue, 01 Jun 2021 09:58:53 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id d14sm34367vkq.13.2021.06.01.09.58.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jun 2021 09:58:53 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::105d]) by postal.iol.unh.edu (Postfix) with ESMTP id D5822605246B; Tue, 1 Jun 2021 12:58:52 -0400 (EDT) From: ohilyard@iol.unh.edu To: dts@dpdk.org Cc: ohilyard@iol.unh.edu, lijuan.tu@intel.com, dpdklab@iol.unh.edu Date: Tue, 1 Jun 2021 12:58:49 -0400 Message-Id: <20210601165849.21995-1-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH] tests/stats_checks: clear xstats before starting testing X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" From: Owen Hilyard Port xstats would have non-zero values when the entire test suite was run. Clearing those stats before starting the tests prevents a failure where it appears that more packets were sent than were sent during the test, causing a failure. Signed-off-by: Owen Hilyard --- tests/TestSuite_stats_checks.py | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/TestSuite_stats_checks.py b/tests/TestSuite_stats_checks.py index 74de4eee..5dc21b6d 100644 --- a/tests/TestSuite_stats_checks.py +++ b/tests/TestSuite_stats_checks.py @@ -130,8 +130,8 @@ class TestStatsChecks(TestCase): src_ip = self.get_random_ip() pkt.config_layers([('ether', {'dst': mac}), ('ipv4', {'src': src_ip})]) - pkt.send_pkt(crb=self.tester, tx_port=self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))) - + pkt.send_pkt(crb=self.tester, + tx_port=self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))) def send_packet_of_size_to_tx_port(self, pktsize, received=True): """ @@ -180,7 +180,7 @@ class TestStatsChecks(TestCase): out = self.exec('show port xstats %s' % port_id) tmp_data = dict() for prefix in prefix_list: - pattern = re.compile('%s:(\s+)([0-9]+)' % prefix) + pattern = re.compile('%s:(\\s+)([0-9]+)' % prefix) m = pattern.search(out) if not m: tmp_data.setdefault(prefix, 0) @@ -193,40 +193,42 @@ class TestStatsChecks(TestCase): if if_zero: for port in xstats_data.keys(): self.verify(not any(xstats_data[port].values()), 'xstats Initial value error! port {} xstats ' - 'data is {}'.format(port, xstats_data[port])) + 'data is {}'.format(port, xstats_data[port])) else: self.verify(xstats_data[rx_port]['rx_good_packets'] == stats_data[rx_port]['RX-packets'] - == xstats_data[tx_port]['tx_good_packets'] == stats_data[tx_port]['TX-packets'] - == 100, "pkt recieve or transport count error!") + == xstats_data[tx_port]['tx_good_packets'] == stats_data[tx_port]['TX-packets'] + == 100, "pkt recieve or transport count error!") self.verify(xstats_data[rx_port]['rx_good_bytes'] == stats_data[rx_port]['RX-bytes'] == xstats_data[tx_port]['tx_good_bytes'] == stats_data[tx_port]['TX-bytes'], 'pkt recieve or transport bytes error!') def xstats_check(self, rx_port, tx_port, if_vf=False): - self.exec ("port config all rss all") - self.exec ("set fwd mac") + self.exec("port config all rss all") + self.exec("set fwd mac") + self.exec("clear port xstats all") org_xstats = self.get_xstats([rx_port, tx_port]) self.verify_results(org_xstats, rx_port, tx_port, if_zero=True) - self.exec ("start") + self.exec("start") self.send_pkt_with_random_ip(tx_port, count=100, if_vf=if_vf) - self.exec ("stop") + self.exec("stop") if rx_port == tx_port: final_xstats = self.get_xstats([rx_port]) - stats_data = {rx_port: self.pmdout.get_pmd_stats(rx_port)} + stats_data = { + rx_port: self.pmdout.get_pmd_stats(rx_port) + } else: rx_stats_info = self.pmdout.get_pmd_stats(rx_port) tx_stats_info = self.pmdout.get_pmd_stats(tx_port) final_xstats = self.get_xstats([rx_port, tx_port]) - stats_data = {rx_port: rx_stats_info, - tx_port: tx_stats_info - } + stats_data = { + rx_port: rx_stats_info, + tx_port: tx_stats_info + } self.verify_results(final_xstats, rx_port, tx_port, stats_data=stats_data) - self.pmdout.quit() - def set_up_all(self): """ Prerequisite steps for each test suit. -- 2.27.0