From patchwork Mon Oct 19 17:34:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, LihongX" X-Patchwork-Id: 81407 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DB2CDA04DC; Tue, 20 Oct 2020 03:09:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A2BBABC50; Tue, 20 Oct 2020 03:09:15 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 8E6F0BC48 for ; Tue, 20 Oct 2020 03:09:13 +0200 (CEST) IronPort-SDR: ggpN/4mxRvi7+k5xU69J3hj/dk08MKA56FgnWgMVWJXyFtkw0dxUjBWn6of4QDFbEa1WtrZhQQ jkblVjo5eqtw== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="146988921" X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="146988921" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2020 18:09:10 -0700 IronPort-SDR: 0NnT1vVP2bIm3rS1J29JEWNk6FWvbIbbJdbsbIoVWnsiJT3Tpuq3P4DcGheVP5fg0Eo9Hhlpdv jKNs6YfOODjw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="347657827" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by fmsmga004.fm.intel.com with ESMTP; 19 Oct 2020 18:09:08 -0700 From: LihongX Ma To: dts@dpdk.org Cc: LihongX Ma Date: Tue, 20 Oct 2020 01:34:34 +0800 Message-Id: <1603128874-18697-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V2] framework: add the check of scapy version 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" v2: modify the comments information - modify the requirement scapy version to 2.4.4 - add the check of the scapy version on tester Signed-off-by: LihongX Ma --- framework/tester.py | 19 +++++++++++++++++++ requirements.txt | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/framework/tester.py b/framework/tester.py index ca179b2..008c10d 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -80,6 +80,7 @@ class Tester(Crb): # prepare for scapy env self.scapy_sessions_li = list() self.scapy_session = self.prepare_scapy_env() + self.check_scapy_version() self.tmp_file = '/tmp/tester/' out = self.send_expect('ls -d %s' % self.tmp_file, '# ', verify=True) if out == 2: @@ -105,6 +106,24 @@ class Tester(Crb): session.logger.warning(f'entering import error: {out}') return session + def check_scapy_version(self): + require_version = '2.4.4' + self.scapy_session.get_session_before(timeout = 1) + self.scapy_session.send_expect('conf.version', '\'') + out = self.scapy_session.get_session_before(timeout = 1) + cur_version = out[:out.find('\'')] + out = self.session.send_expect('grep scapy requirements.txt', '# ') + value = re.search('scapy\s*==\s*(\S*)', out) + if value is not None: + require_version = value.group(1) + cur_version = cur_version.split('.') + require_version = require_version.split('.') + for i in range(len(require_version)): + if int(cur_version[i]) < int(require_version[i]): + self.logger.warning('The scapy vesrion not meet the requirement on tester,' + + 'please update your scapy, otherwise maybe some suite will failed') + break + def init_ext_gen(self): """ Initialize tester packet generator object. diff --git a/requirements.txt b/requirements.txt index cb9f636..fae0ace 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,5 +36,5 @@ numpy==1.18.5 docutils pcapy xlrd -scapy==2.4.3 +scapy==2.4.4 threadpool