test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2 0/3] framework: check the python version
@ 2020-10-14  7:14 yufengmx
  2020-10-14  7:14 ` [dts] [PATCH V2 1/3] " yufengmx
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: yufengmx @ 2020-10-14  7:14 UTC (permalink / raw)
  To: dts, lihongx.ma; +Cc: yufengmx


v2: 
 -  add python version check at the beginning of run_all and tester crb init stage. 

v1: 
 - implement a method to check the python version of tester and the server that run dts. 
 - If the version is python2, print a warning message. 

yufengmx (3):
  framework: check the python version
  framework: check the python version
  framework: check the python version

 framework/dts.py    |  6 +++++-
 framework/tester.py |  5 ++++-
 framework/utils.py  | 23 +++++++++++++++++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dts] [PATCH V2 1/3] framework: check the python version
  2020-10-14  7:14 [dts] [PATCH V2 0/3] framework: check the python version yufengmx
@ 2020-10-14  7:14 ` yufengmx
  2020-10-22  1:18   ` Tu, Lijuan
  2020-10-14  7:14 ` [dts] [PATCH V2 2/3] " yufengmx
  2020-10-14  7:14 ` [dts] [PATCH V2 3/3] " yufengmx
  2 siblings, 1 reply; 9+ messages in thread
From: yufengmx @ 2020-10-14  7:14 UTC (permalink / raw)
  To: dts, lihongx.ma; +Cc: yufengmx


implement a method to check the python version of tester and the server that run dts.
If the version is python2, print a warning message.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 framework/utils.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/framework/utils.py b/framework/utils.py
index e74e6c5..371fe52 100644
--- a/framework/utils.py
+++ b/framework/utils.py
@@ -32,6 +32,7 @@
 import json         # json format
 import re
 import os
+import sys
 import inspect
 import socket
 import struct
@@ -280,3 +281,25 @@ def get_backtrace_object(file_name, obj_name):
         obj = getattr(frame.f_locals['self'], obj_name, None)
 
     return obj
+
+
+def check_crb_python_version(crb):
+    cmd = 'python3 -V'
+    out = crb.send_expect(cmd, '#', 5)
+    pat = "Python (\d+).(\d+).(\d+)"
+    result = re.findall(pat, out)
+    if not result or int(result[0][0]) < 3:
+        crb.logger.warning(
+            ("WARNING: Tester node python version is lower than python 3, "
+             "it is deprecated for use in DTS, "
+             "and will not work in future releases."))
+        crb.logger.warning("Please use Python 3 instead")
+
+
+def check_dts_python_version():
+    if sys.version_info.major < 3:
+        print(RED(
+            ("WARNING: Dts running node python version is lower than python 3, "
+             "it is deprecated for use in DTS, "
+             "and will not work in future releases.")), file=sys.stderr)
+        print(RED("Please use Python 3 instead"), file=sys.stderr)
-- 
2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dts] [PATCH V2 2/3] framework: check the python version
  2020-10-14  7:14 [dts] [PATCH V2 0/3] framework: check the python version yufengmx
  2020-10-14  7:14 ` [dts] [PATCH V2 1/3] " yufengmx
@ 2020-10-14  7:14 ` yufengmx
  2020-10-14  7:14 ` [dts] [PATCH V2 3/3] " yufengmx
  2 siblings, 0 replies; 9+ messages in thread
From: yufengmx @ 2020-10-14  7:14 UTC (permalink / raw)
  To: dts, lihongx.ma; +Cc: yufengmx


check the python version of the server that run dts. If the version is python2, print a warning message.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 framework/dts.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/framework/dts.py b/framework/dts.py
index 4fcec3a..697602d 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -58,7 +58,8 @@ import logger
 import debugger
 from config import CrbsConf
 from checkCase import CheckCase
-from utils import get_subclasses, copy_instance_attr, create_parallel_locks
+from utils import (get_subclasses, copy_instance_attr, create_parallel_locks,
+                   check_dts_python_version)
 import sys
 import imp
 imp.reload(sys)
@@ -505,6 +506,9 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
     global log_handler
     global check_case_inst
 
+    # check the python version of the server that run dts 
+    check_dts_python_version()
+
     # save global variable
     serializer = Serializer()
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dts] [PATCH V2 3/3] framework: check the python version
  2020-10-14  7:14 [dts] [PATCH V2 0/3] framework: check the python version yufengmx
  2020-10-14  7:14 ` [dts] [PATCH V2 1/3] " yufengmx
  2020-10-14  7:14 ` [dts] [PATCH V2 2/3] " yufengmx
@ 2020-10-14  7:14 ` yufengmx
  2020-10-14  7:25   ` Ma, LihongX
  2 siblings, 1 reply; 9+ messages in thread
From: yufengmx @ 2020-10-14  7:14 UTC (permalink / raw)
  To: dts, lihongx.ma; +Cc: yufengmx


check the python version of tester. If the version is python2, print a warning message.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 framework/tester.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/framework/tester.py b/framework/tester.py
index ca179b2..482b0e4 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -43,7 +43,8 @@ from crb import Crb
 from net_device import GetNicObj
 from etgen import IxiaPacketGenerator, SoftwarePacketGenerator
 import random
-from utils import GREEN, convert_int2ip, convert_ip2int
+from utils import (GREEN, convert_int2ip, convert_ip2int,
+                   check_crb_python_version)
 from exception import ParameterInvalidException
 from multiprocessing import Process
 from pktgen import getPacketGenerator
@@ -66,6 +67,8 @@ class Tester(Crb):
         self.NAME = 'tester'
         self.scapy_session = None
         super(Tester, self).__init__(crb, serializer, self.NAME)
+        # check the python version of tester
+        check_crb_python_version(self)
 
         self.bgProcIsRunning = False
         self.duts = None
-- 
2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dts] [PATCH V2 3/3] framework: check the python version
  2020-10-14  7:14 ` [dts] [PATCH V2 3/3] " yufengmx
@ 2020-10-14  7:25   ` Ma, LihongX
  0 siblings, 0 replies; 9+ messages in thread
From: Ma, LihongX @ 2020-10-14  7:25 UTC (permalink / raw)
  To: Mo, YufengX, dts


> -----Original Message-----
> From: Mo, YufengX <yufengx.mo@intel.com>
> Sent: Wednesday, October 14, 2020 3:15 PM
> To: dts@dpdk.org; Ma, LihongX <lihongx.ma@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 3/3] framework: check the python version
> 
> 
> check the python version of tester. If the version is python2, print a
> warning message.
> 
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---

Acked-by: Lihongx Ma<lihongx.ma@intel.com>


Regards,
Ma,lihong

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dts] [PATCH V2 1/3] framework: check the python version
  2020-10-14  7:14 ` [dts] [PATCH V2 1/3] " yufengmx
@ 2020-10-22  1:18   ` Tu, Lijuan
  2020-10-22  2:30     ` Mo, YufengX
  0 siblings, 1 reply; 9+ messages in thread
From: Tu, Lijuan @ 2020-10-22  1:18 UTC (permalink / raw)
  To: Mo, YufengX, dts, Ma,  LihongX; +Cc: Mo, YufengX

DTS only support Python3 now, it doesn't support Python2. But it requires Python minus version. E.g. Python3.4 is not supported, it  requires version larger than 3.6x.

> +def check_crb_python_version(crb):
> +    cmd = 'python3 -V'

It seems you are telling python version for python 3. If you are using python3, how can it tell you python2.

> +    out = crb.send_expect(cmd, '#', 5)
> +    pat = "Python (\d+).(\d+).(\d+)"
> +    result = re.findall(pat, out)
> +    if not result or int(result[0][0]) < 3:
> +        crb.logger.warning(
> +            ("WARNING: Tester node python version is lower than python 3, "
> +             "it is deprecated for use in DTS, "
Python2 have been replaced by Python2 in DTS, so the message is not reasonable.

> +             "and will not work in future releases."))
> +        crb.logger.warning("Please use Python 3 instead")
> +
> +
> +def check_dts_python_version():
> +    if sys.version_info.major < 3:
> +        print(RED(
> +            ("WARNING: Dts running node python version is lower than python 3, "
> +             "it is deprecated for use in DTS, "
> +             "and will not work in future releases.")), file=sys.stderr)
> +        print(RED("Please use Python 3 instead"), file=sys.stderr)
> --
> 2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dts] [PATCH V2 1/3] framework: check the python version
  2020-10-22  1:18   ` Tu, Lijuan
@ 2020-10-22  2:30     ` Mo, YufengX
  2020-10-22  2:53       ` Tu, Lijuan
  0 siblings, 1 reply; 9+ messages in thread
From: Mo, YufengX @ 2020-10-22  2:30 UTC (permalink / raw)
  To: Tu, Lijuan, dts, Ma, LihongX

So, checking python version > 3.6.0  is what you want to do?


> -----Original Message-----
> From: Tu, Lijuan
> Sent: Thursday, October 22, 2020 9:18 AM
> To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX <lihongx.ma@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version
> 
> DTS only support Python3 now, it doesn't support Python2. But it requires Python minus version. E.g. Python3.4 is not supported, it
> requires version larger than 3.6x.
> 
> > +def check_crb_python_version(crb):
> > +    cmd = 'python3 -V'
> 
> It seems you are telling python version for python 3. If you are using python3, how can it tell you python2.
> 
> > +    out = crb.send_expect(cmd, '#', 5)
> > +    pat = "Python (\d+).(\d+).(\d+)"
> > +    result = re.findall(pat, out)
> > +    if not result or int(result[0][0]) < 3:
> > +        crb.logger.warning(
> > +            ("WARNING: Tester node python version is lower than python 3, "
> > +             "it is deprecated for use in DTS, "
> Python2 have been replaced by Python2 in DTS, so the message is not reasonable.
> 
> > +             "and will not work in future releases."))
> > +        crb.logger.warning("Please use Python 3 instead")
> > +
> > +
> > +def check_dts_python_version():
> > +    if sys.version_info.major < 3:
> > +        print(RED(
> > +            ("WARNING: Dts running node python version is lower than python 3, "
> > +             "it is deprecated for use in DTS, "
> > +             "and will not work in future releases.")), file=sys.stderr)
> > +        print(RED("Please use Python 3 instead"), file=sys.stderr)
> > --
> > 2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dts] [PATCH V2 1/3] framework: check the python version
  2020-10-22  2:30     ` Mo, YufengX
@ 2020-10-22  2:53       ` Tu, Lijuan
  2020-10-22  6:36         ` Ma, LihongX
  0 siblings, 1 reply; 9+ messages in thread
From: Tu, Lijuan @ 2020-10-22  2:53 UTC (permalink / raw)
  To: Mo, YufengX, dts, Ma,  LihongX

Hi Lihong,
Investigation of  what's python version DTS support need to be completed first.

> -----Original Message-----
> From: Mo, YufengX <yufengx.mo@intel.com>
> Sent: 2020年10月22日 10:30
> To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org; Ma, LihongX
> <lihongx.ma@intel.com>
> Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version
> 
> So, checking python version > 3.6.0  is what you want to do?
> 
> 
> > -----Original Message-----
> > From: Tu, Lijuan
> > Sent: Thursday, October 22, 2020 9:18 AM
> > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX
> > <lihongx.ma@intel.com>
> > Cc: Mo, YufengX <yufengx.mo@intel.com>
> > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version
> >
> > DTS only support Python3 now, it doesn't support Python2. But it
> > requires Python minus version. E.g. Python3.4 is not supported, it requires
> version larger than 3.6x.
> >
> > > +def check_crb_python_version(crb):
> > > +    cmd = 'python3 -V'
> >
> > It seems you are telling python version for python 3. If you are using python3,
> how can it tell you python2.
> >
> > > +    out = crb.send_expect(cmd, '#', 5)
> > > +    pat = "Python (\d+).(\d+).(\d+)"
> > > +    result = re.findall(pat, out)
> > > +    if not result or int(result[0][0]) < 3:
> > > +        crb.logger.warning(
> > > +            ("WARNING: Tester node python version is lower than python 3, "
> > > +             "it is deprecated for use in DTS, "
> > Python2 have been replaced by Python2 in DTS, so the message is not
> reasonable.
> >
> > > +             "and will not work in future releases."))
> > > +        crb.logger.warning("Please use Python 3 instead")
> > > +
> > > +
> > > +def check_dts_python_version():
> > > +    if sys.version_info.major < 3:
> > > +        print(RED(
> > > +            ("WARNING: Dts running node python version is lower than python 3,
> "
> > > +             "it is deprecated for use in DTS, "
> > > +             "and will not work in future releases.")), file=sys.stderr)
> > > +        print(RED("Please use Python 3 instead"), file=sys.stderr)
> > > --
> > > 2.21.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dts] [PATCH V2 1/3] framework: check the python version
  2020-10-22  2:53       ` Tu, Lijuan
@ 2020-10-22  6:36         ` Ma, LihongX
  0 siblings, 0 replies; 9+ messages in thread
From: Ma, LihongX @ 2020-10-22  6:36 UTC (permalink / raw)
  To: Tu, Lijuan, Mo, YufengX, dts

Lijuan and yufen
The python3 version should >= 3.6.9

Regards,
Ma,lihong

> -----Original Message-----
> From: Tu, Lijuan <lijuan.tu@intel.com>
> Sent: Thursday, October 22, 2020 10:54 AM
> To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX
> <lihongx.ma@intel.com>
> Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version
> 
> Hi Lihong,
> Investigation of  what's python version DTS support need to be completed
> first.
> 
> > -----Original Message-----
> > From: Mo, YufengX <yufengx.mo@intel.com>
> > Sent: 2020年10月22日 10:30
> > To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org; Ma, LihongX
> > <lihongx.ma@intel.com>
> > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python version
> >
> > So, checking python version > 3.6.0  is what you want to do?
> >
> >
> > > -----Original Message-----
> > > From: Tu, Lijuan
> > > Sent: Thursday, October 22, 2020 9:18 AM
> > > To: Mo, YufengX <yufengx.mo@intel.com>; dts@dpdk.org; Ma, LihongX
> > > <lihongx.ma@intel.com>
> > > Cc: Mo, YufengX <yufengx.mo@intel.com>
> > > Subject: RE: [dts] [PATCH V2 1/3] framework: check the python
> > > version
> > >
> > > DTS only support Python3 now, it doesn't support Python2. But it
> > > requires Python minus version. E.g. Python3.4 is not supported, it
> > > requires
> > version larger than 3.6x.
> > >
> > > > +def check_crb_python_version(crb):
> > > > +    cmd = 'python3 -V'
> > >
> > > It seems you are telling python version for python 3. If you are
> > > using python3,
> > how can it tell you python2.
> > >
> > > > +    out = crb.send_expect(cmd, '#', 5)
> > > > +    pat = "Python (\d+).(\d+).(\d+)"
> > > > +    result = re.findall(pat, out)
> > > > +    if not result or int(result[0][0]) < 3:
> > > > +        crb.logger.warning(
> > > > +            ("WARNING: Tester node python version is lower than
> python 3, "
> > > > +             "it is deprecated for use in DTS, "
> > > Python2 have been replaced by Python2 in DTS, so the message is not
> > reasonable.
> > >
> > > > +             "and will not work in future releases."))
> > > > +        crb.logger.warning("Please use Python 3 instead")
> > > > +
> > > > +
> > > > +def check_dts_python_version():
> > > > +    if sys.version_info.major < 3:
> > > > +        print(RED(
> > > > +            ("WARNING: Dts running node python version is lower
> > > > +than python 3,
> > "
> > > > +             "it is deprecated for use in DTS, "
> > > > +             "and will not work in future releases.")),
> file=sys.stderr)
> > > > +        print(RED("Please use Python 3 instead"),
> > > > + file=sys.stderr)
> > > > --
> > > > 2.21.0
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-10-22  6:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  7:14 [dts] [PATCH V2 0/3] framework: check the python version yufengmx
2020-10-14  7:14 ` [dts] [PATCH V2 1/3] " yufengmx
2020-10-22  1:18   ` Tu, Lijuan
2020-10-22  2:30     ` Mo, YufengX
2020-10-22  2:53       ` Tu, Lijuan
2020-10-22  6:36         ` Ma, LihongX
2020-10-14  7:14 ` [dts] [PATCH V2 2/3] " yufengmx
2020-10-14  7:14 ` [dts] [PATCH V2 3/3] " yufengmx
2020-10-14  7:25   ` Ma, LihongX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).