* [dts] [V1] framework/*: Fixed some issues of new create eal parameter API
@ 2022-03-15 4:16 Jun Dong
2022-03-15 11:37 ` Tu, Lijuan
0 siblings, 1 reply; 2+ messages in thread
From: Jun Dong @ 2022-03-15 4:16 UTC (permalink / raw)
To: dts; +Cc: lijuan.tu, qingx.sun, junx.dong
- Remove blank from cores list
- Change validate rule of port to compatible with FreeBSD
- Modify file prefix generate rule to compatible with FreeBSD
- Restore ParameterInvalidException's define since some API have used it
Signed-off-by: Jun Dong <junx.dong@intel.com>
---
framework/dut.py | 22 ++++++++++++++++------
framework/exception.py | 7 +------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/framework/dut.py b/framework/dut.py
index 7b3535c7..dfd85c81 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -1364,6 +1364,10 @@ class _EalParameter(object):
self.vdevs = vdevs
self.other_eal_param = other_eal_param
+ _param_validate_exception_info_template = (
+ 'Invalid parameter of %s about value of %s, Please reference API doc.'
+ )
+
@staticmethod
def _validate_cores(cores: Union[str, List[int], List[str]]):
core_string_match = r"default|all|\d+S/\d+C/\d+T|$"
@@ -1386,18 +1390,22 @@ class _EalParameter(object):
or all(map(lambda _port: type(_port) == str, ports))
and all(
map(
- lambda _port: re.match(r"^([\d\w]+:){2}[\d\w]+\.[\d\w]+$", _port),
+ lambda _port: re.match(r"^([\d\w]+:){1,2}[\d\w]+\.[\d\w]+$", _port),
ports,
)
)
):
- raise ParameterInvalidException("ports", ports)
+ raise ParameterInvalidException(
+ _EalParameter._param_validate_exception_info_template % ('ports', ports)
+ )
return ports
@staticmethod
def _validate_port_options(port_options: Dict[Union[str, int], str]):
if not isinstance(port_options, Dict):
- raise ParameterInvalidException("port_options", port_options)
+ raise ParameterInvalidException(
+ _EalParameter._param_validate_exception_info_template % ('port_options', port_options)
+ )
port_list = port_options.keys()
_EalParameter._validate_ports(list(port_list))
return port_options
@@ -1405,7 +1413,9 @@ class _EalParameter(object):
@staticmethod
def _validate_vdev(vdev: List[str]):
if not isinstance(vdev, list):
- raise ParameterInvalidException("vdev", vdev)
+ raise ParameterInvalidException(
+ _EalParameter._param_validate_exception_info_template % ('vdev', vdev)
+ )
def _make_cores_param(self) -> str:
is_use_default_cores = (
@@ -1446,7 +1456,7 @@ class _EalParameter(object):
)
return _formated_core_list
- return f'-l {", ".join(_get_consecutive_cores_range(core_list))}'
+ return f'-l {",".join(_get_consecutive_cores_range(core_list))}'
def _make_memory_channels(self) -> str:
param_template = "-n {}"
@@ -1499,7 +1509,6 @@ class _EalParameter(object):
if not self.fixed_prefix:
fixed_file_prefix = fixed_file_prefix + "_" + self.dut.prefix_subfix
fixed_file_prefix = self._do_os_handle_with_prefix_param(fixed_file_prefix)
- fixed_file_prefix = "--file-prefix=" + fixed_file_prefix
return fixed_file_prefix
def _make_vdevs_param(self) -> str:
@@ -1570,6 +1579,7 @@ class _EalParameter(object):
file_prefix = ""
else:
self.dut.prefix_list.append(file_prefix)
+ file_prefix = "--file-prefix=" + file_prefix
return file_prefix
def make_eal_param(self) -> str:
diff --git a/framework/exception.py b/framework/exception.py
index 2554c1d8..c3900cb6 100644
--- a/framework/exception.py
+++ b/framework/exception.py
@@ -77,12 +77,7 @@ class SSHSessionDeadException(Exception):
class ParameterInvalidException(Exception):
- def __init__(self, param_name: str, param_value: Any):
- self.param_name = param_name
- self.param_value = param_value
-
- def __str__(self) -> str:
- return f'Invalid parameter of {self.param_name} about value of {self.param_value}, Please reference API doc.'
+ pass
class StartVMFailedException(Exception):
--
2.33.1.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [dts] [V1] framework/*: Fixed some issues of new create eal parameter API
2022-03-15 4:16 [dts] [V1] framework/*: Fixed some issues of new create eal parameter API Jun Dong
@ 2022-03-15 11:37 ` Tu, Lijuan
0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2022-03-15 11:37 UTC (permalink / raw)
To: Dong, JunX, dts; +Cc: Sun, QingX
> -----Original Message-----
> From: Dong, JunX <junx.dong@intel.com>
> Sent: 2022年3月15日 12:16
> To: dts@dpdk.org
> Cc: Tu, Lijuan <lijuan.tu@intel.com>; Sun, QingX <qingx.sun@intel.com>; Dong,
> JunX <junx.dong@intel.com>
> Subject: [dts] [V1] framework/*: Fixed some issues of new create eal parameter
> API
>
> - Remove blank from cores list
> - Change validate rule of port to compatible with FreeBSD
> - Modify file prefix generate rule to compatible with FreeBSD
> - Restore ParameterInvalidException's define since some API have used it
>
> Signed-off-by: Jun Dong <junx.dong@intel.com>
Reviewed-by: Lijuan Tu <lijuan.tu@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-15 11:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 4:16 [dts] [V1] framework/*: Fixed some issues of new create eal parameter API Jun Dong
2022-03-15 11:37 ` Tu, Lijuan
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).