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 C094AA0542; Fri, 11 Nov 2022 04:19:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 942BD40141; Fri, 11 Nov 2022 04:19:50 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 32357400EF for ; Fri, 11 Nov 2022 04:19:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136788; x=1699672788; h=from:to:cc:subject:date:message-id; bh=9HBCE8CUvPRqHGpHIl3amBynpvOs17uLpc8LtktVgr4=; b=KJpVcdh4YL4//4bueUHYyvRz4Si+H7VU8Ygp2kc3cgXIkhOObwLiJo6W otmdr3KKbdQOSEOaRwO3W7U1bowAnQR6j6T9mkhyu8T/g6Y7GTLth+NmH UqOdjKqyqSs47xvvf5hjswiX71rTD+Y4SNPFYsqNDU2tyBnau1pMJKrLE 3CaLaCmCNQz+zNkbuglZb2lDDmAGEWcloKoO2eA7TVaBwKV4b4uW5SAOu 2uP2zMWies43cKswKvEAJKTmULeWdAtg3cKT4FoDiuXdPZYhRj0CKZpG6 u9oCxSfdEZhuVvZywW4YcapmOv7B6wDjrYC2b/7I0BDqkkTBdzMGzmv5v g==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="313294160" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="313294160" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:19:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="615352044" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="615352044" Received: from unknown (HELO localhost.localdomain) ([10.239.252.94]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:19:45 -0800 From: Song Jiale To: dts@dpdk.org Cc: Song Jiale Subject: [dts] [PATCH V2] tests/rte_flow_common: optimize scripts Date: Fri, 11 Nov 2022 11:38:46 +0000 Message-Id: <20221111113846.26996-1-songx.jiale@intel.com> X-Mailer: git-send-email 2.17.1 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 1. some packages that mismatch the rule do not have hash values. add a parameter "check_hash_num" to determine whether to detect the number of hash values. 2. change "log_msg" to a string. Signed-off-by: Song Jiale --- v2: -"log_msg" need to return a string, not an exception. tests/rte_flow_common.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py index 02c85f85..b692ba06 100644 --- a/tests/rte_flow_common.py +++ b/tests/rte_flow_common.py @@ -133,7 +133,7 @@ def check_output_log_queue_region_mismatched(out, func_param, expect_results): try: check_queue(out, expect_pkts, check_param, stats=False) except Exception as ex: - log_msg = ex + log_msg = str(ex) return False, log_msg else: log_msg = "" @@ -156,7 +156,7 @@ def check_output_log_in_queue_mismatched(out, func_param, expect_results): try: check_queue(out, expect_pkts, check_param, stats=False) except Exception as ex: - log_msg = ex + log_msg = str(ex) return False, log_msg else: log_msg = "" @@ -346,7 +346,7 @@ def verify(passed, description): raise AssertionError(description) -def check_rss(out, pkt_num, check_param, stats=True): +def check_rss(out, pkt_num, check_param, stats=True, check_hash_num=True): """ check whether the packet directed by rss or not according to the specified parameters :param out: information received by testpmd after sending packets and port statistics @@ -359,7 +359,8 @@ def check_rss(out, pkt_num, check_param, stats=True): rxq = check_param.get("rxq") p = re.compile("RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)") pkt_info = p.findall(out) - verify(len(pkt_info) == pkt_num, "some packets no hash:{}".format(p.pattern)) + if check_hash_num: + verify(len(pkt_info) == pkt_num, "some packets no hash:{}".format(p.pattern)) pkt_queue = set([int(i[1], 16) for i in pkt_info]) if stats: verify( @@ -400,7 +401,7 @@ def check_queue(out, pkt_num, check_param, stats=True): if not any(q in queue for q in pkt_queue): print((GREEN("pass: queue id %s not matched" % pkt_queue))) else: - check_rss(out, pkt_num, check_param, stats=True) + check_rss(out, pkt_num, check_param, stats=True, check_hash_num=False) return pkt_queue else: raise Exception("got wrong output, not match pattern %s" % p.pattern) -- 2.17.1