From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 94A42A04B4; Thu, 27 Aug 2020 06:57:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7CAED1B951; Thu, 27 Aug 2020 06:57:06 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id EE8932B9E for ; Thu, 27 Aug 2020 06:57:04 +0200 (CEST) IronPort-SDR: IvQtkjs6DNzRoK1eobiRKlXfEPQgdFuYxiFiBLFYMjlIB5y8yvMW4XeAdzWQcGPikFk00VM/oe 9IsEJfNZQQwA== X-IronPort-AV: E=McAfee;i="6000,8403,9725"; a="153843010" X-IronPort-AV: E=Sophos;i="5.76,358,1592895600"; d="scan'208";a="153843010" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2020 21:57:04 -0700 IronPort-SDR: SgVHa8OR8EaNN9CJN7aQhSkXuRm+RaoKtgpen7zOJVNNNsB06mkKaNkifcu4zXszDKdl8SGmz5 bfECL+ogYjiQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,358,1592895600"; d="scan'208";a="295600970" Received: from dpdk-lunannan.sh.intel.com ([10.67.111.68]) by orsmga003.jf.intel.com with ESMTP; 26 Aug 2020 21:57:03 -0700 From: Nannan Lu To: dts@dpdk.org Cc: Nannan Lu Date: Thu, 27 Aug 2020 13:47:00 +0000 Message-Id: <1598536021-771221-2-git-send-email-nannan.lu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1598536021-771221-1-git-send-email-nannan.lu@intel.com> References: <1598536021-771221-1-git-send-email-nannan.lu@intel.com> Subject: [dts] [PATCH V2 2/3] tests/rte_flow_common.py: improve the check functions for cvl switch filter 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" tests/rte_flow_common.py: improve the check function for cvl switch filter Signed-off-by: Nannan Lu --- tests/rte_flow_common.py | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py index e80575e..8a4cded 100644 --- a/tests/rte_flow_common.py +++ b/tests/rte_flow_common.py @@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. +# Copyright(c) 2019-2020 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -59,35 +59,28 @@ def get_suite_config(test_case): suite_config["package_file_location"] = package_file_location return suite_config -def get_rx_packet_number(out,match_string): - """ - get the rx packets number. - """ - out_lines=out.splitlines() - pkt_num =0 - for i in range(len(out_lines)): - if match_string in out_lines[i]: - result_scanner = r'RX-packets:\s?(\d+)' - scanner = re.compile(result_scanner, re.DOTALL) - m = scanner.search(out_lines[i+1]) - pkt_num = int(m.group(1)) - break - return pkt_num - def get_port_rx_packets_number(out,port_num): """ get the port rx packets number. """ - match_string="---------------------- Forward statistics for port %d" % port_num - pkt_num = get_rx_packet_number(out,match_string) + p = re.compile( + 'Forward\sstatistics\s+for\s+port\s+%s\s+.*\n.*RX-packets:\s(\d+)\s+' % port_num) + m = p.search(out) + pkt_num = 0 + if m: + pkt_num = int(m.group(1)) return pkt_num def get_queue_rx_packets_number(out, port_num, queue_id): """ get the queue rx packets number. """ - match_string="------- Forward Stats for RX Port= %d/Queue= %d" % (port_num, queue_id) - pkt_num = get_rx_packet_number(out,match_string) + p = re.compile( + 'Forward\sStats\s+for\s+RX\s+Port=\s*%d/Queue=\s*%d\s+.*\n.*RX-packets:\s(\d+)\s+' % (port_num, queue_id)) + m = p.search(out) + pkt_num = 0 + if m: + pkt_num = int(m.group(1)) return pkt_num def check_output_log_in_queue(out, func_param, expect_results): -- 2.7.4