From patchwork Mon Oct 19 17:30:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, LihongX" X-Patchwork-Id: 81406 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 54BA5A04DC; Tue, 20 Oct 2020 03:05:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 13464BC0A; Tue, 20 Oct 2020 03:05:33 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 19EC6BAEC for ; Tue, 20 Oct 2020 03:05:30 +0200 (CEST) IronPort-SDR: RdRC+HhuOY0ek2kAKZqHtFO9WMfjwF1nR3A0/5hatLtUmHYdyOod3nvUd4VfEzvugoezKlaS/T DFewWleJG3RQ== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="154073067" X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="154073067" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2020 18:05:27 -0700 IronPort-SDR: vN1lQ1fB+34XHArC/7gaaSmgYGMb1+W3eSjnsN7OQM3u2zsRrMS2sMP5Ly4j9koTNEdLDOgidF 3jClsvrGl5RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="523302763" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by fmsmga005.fm.intel.com with ESMTP; 19 Oct 2020 18:05:26 -0700 From: LihongX Ma To: dts@dpdk.org Cc: LihongX Ma Date: Tue, 20 Oct 2020 01:30:51 +0800 Message-Id: <1603128651-18576-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] 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" - modify the requirement scapy version to 2.4.2 - 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