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 7E61341DFA; Tue, 7 Mar 2023 05:21:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 795E3410DD; Tue, 7 Mar 2023 05:21:54 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id D93094067E for ; Tue, 7 Mar 2023 05:21:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678162913; x=1709698913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1MiTLmjXc0lDjvIFIjPIH8y0Pjb/oF80T2ryqQ1WoqI=; b=Mu0zlz8KoSssgDKyRmWX2/EA+rtv6rEuYmFlbZ49J0/coshmrI4RFocV xqRnhEP0LMcsGXIo9iSUmO6cZ9hnxvYIIzwTMO2pQjaeDpBHqqYQLcFvi UhMGiDAK0JcMAcLxDtQ7/CzF7V1BJWuQmSHlDlX8LXm9pCg/wqRiMLNIZ I5+0ErfyOnM+LKFgfoczM/JiqvfAculiuNarlTMLieaLQCwUmZQUgAr3X ZOy5m+ElqLJs9Nu+AlX/Cm/Me3JWFLMw0qWcKQHvLD47S3XLAO4P7HSYw MNzKl0vhXG8td87+N+PmORVpDUIG3wB1udCYvHTAearL9c88/MMsc4ApS A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="316159677" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="316159677" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 20:21:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="819579414" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="819579414" Received: from dpdk-lingjin.sh.intel.com ([10.67.114.166]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2023 20:21:51 -0800 From: Jin Ling To: dts@dpdk.org Cc: yuan.peng@intel.com, lijuan.tu@intel.com, Jin Ling Subject: [DTS][PATCH V1 1/1] tests/uni_pkt: optimize code for check result Date: Tue, 7 Mar 2023 12:21:04 +0800 Message-Id: <20230307042104.125247-2-jin.ling@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307042104.125247-1-jin.ling@intel.com> References: <20230307042104.125247-1-jin.ling@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(-) diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py index e883b84d..5eb50ed1 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 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): -- 2.25.1