diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2017-12-11 13:37:40 +0000 |
---|---|---|
committer | Martin Klozik <martinx.klozik@intel.com> | 2017-12-12 14:50:23 +0000 |
commit | b830a59fc8c05a92b874252cb8f6cb96ded46bb5 (patch) | |
tree | 80f2e45bd6cdb3818c29efff097381d78dc25359 /tools/functions.py | |
parent | caabba96ca0efb5e0d21ce5122da4e5fc873f4fe (diff) |
teststeps: Improvements of step driven TC
This patch adds support of access to VMs deployed automatically
by deployment scenario (e.g. pvp, pvvp4, etc.). It also modifies
filter for checking output of executed commands to correctly
handle different end of line encodings (i.e. \n vs. \n\r).
JIRA: VSPERF-539
Change-Id: Ifc796d992b90e316bad5853aaefce79e439e294d
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
Diffstat (limited to 'tools/functions.py')
-rw-r--r-- | tools/functions.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/functions.py b/tools/functions.py index c0d1e5f7..d35f1f84 100644 --- a/tools/functions.py +++ b/tools/functions.py @@ -190,17 +190,15 @@ def filter_output(output, regex): """ result = [] if isinstance(output, str): - for line in output.split('\n'): + for line in output.splitlines(): result += re.findall(regex, line) - return result - elif isinstance(output, list) or isinstance(output, tuple): - tmp_res = [] + elif isinstance(output, (list, tuple)): for item in output: - tmp_res.append(filter_output(item, regex)) - return tmp_res + result.append(filter_output(item, regex)) else: raise RuntimeError('Only strings and lists are supported by filter_output(), ' 'but output has type {}'.format(type(output))) + return result def format_description(desc, length): """ Split description into multiple lines based on given line length. |