From patchwork Thu Mar 9 01:23:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Ling X-Patchwork-Id: 124867 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41EAE41E34; Thu, 9 Mar 2023 02:24:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B5EA410EE; Thu, 9 Mar 2023 02:24:09 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 8DBAF40A7E for ; Thu, 9 Mar 2023 02:24:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678325047; x=1709861047; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2jdJl7Kk4B5x3V7Flc2xGX9Y0yHCYhJzrfieAeUCQ58=; b=e9bZsLwuWOHhxl3e10RVUYAmc2Mw5jcOd/VXrmbCm0wcZ/l3qkZb40M7 QneiWzXIAGfit59K2OoLQ4MWGZ0FI0NMVbd36iACprd1UK18rYQrqmXAV brXc//u8AzDwHwXYGL4EEtZPsCCFG9QH8WM0YIuf8tFAutsOV9RN+IHTZ qXKkr6XVQAT22Gr23J/bCyEIqK2+/xbrzII5uPkinHKlwXlDBLIPX/yQy k5+pInP/YUTwqTT/IDq1M8OzK07haR11er8lo14c8uJbRxl9aTlTSYU1e vblM12W+Yv3wQ3NFvB90TXuqsJlSns7i6+ODjsRN2MIvhrRa1cMLjNnDR w==; X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="422595456" X-IronPort-AV: E=Sophos;i="5.98,244,1673942400"; d="scan'208";a="422595456" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2023 17:24:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10643"; a="787361663" X-IronPort-AV: E=Sophos;i="5.98,244,1673942400"; d="scan'208";a="787361663" Received: from dpdk-lingjin.sh.intel.com ([10.67.114.166]) by fmsmga002.fm.intel.com with ESMTP; 08 Mar 2023 17:24:05 -0800 From: Jin Ling To: dts@dpdk.org Cc: yuan.peng@intel.com, lijuan.tu@intel.com, Jin Ling Subject: [DTS][PATCH V2 1/1] tests/uni_pkt: optimize code for check result Date: Thu, 9 Mar 2023 09:23:41 +0800 Message-Id: <20230309012341.752557-2-jin.ling@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230309012341.752557-1-jin.ling@intel.com> References: <20230309012341.752557-1-jin.ling@intel.com> MIME-Version: 1.0 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 The script only checks if there are flags in the output, but both hw and sw parts have flags, which may lead to incorrect test results, so modified the code in this part to check the hw flag only. Signed-off-by: Jin Ling --- tests/TestSuite_uni_pkt.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py index e883b84d..abeb3c35 100644 --- a/tests/TestSuite_uni_pkt.py +++ b/tests/TestSuite_uni_pkt.py @@ -16,6 +16,7 @@ translate the offloaded packet types into these 7 fields of information, for user applications """ +import re import time import framework.utils as utils @@ -59,10 +60,13 @@ class TestUniPacket(TestCase): pkt = Packet(pkt_type=pkt_type) pkt.send_pkt(self.tester, tx_port=self.tester_iface, count=4) out = self.dut.get_session_output(timeout=2) + pattern = re.compile(r"hw ptype: (.*?)sw") + hw_ptype = re.findall(pattern, out) for pkt_layer_name in pkt_names: - if pkt_layer_name not in out: - print((utils.RED("Fail to detect %s" % pkt_layer_name))) - raise VerifyFailure("Failed to detect %s" % pkt_layer_name) + for tag in hw_ptype: + if pkt_layer_name.strip() not in tag: + print((utils.RED("Fail to detect %s" % pkt_layer_name))) + raise VerifyFailure("Failed to detect %s" % pkt_layer_name) print((utils.GREEN("Detected %s successfully" % pkt_type))) def test_l2pkt_detect(self):