aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/HoststackUtil.py
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2022-03-22 12:49:39 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-01-24 06:27:30 +0000
commit752538617f43672a0a9eeb93432929032cca05d3 (patch)
tree050312af95eecb468e1e65f9d396dd627f34001b /resources/libraries/python/HoststackUtil.py
parentbf635b8d7cd582f38e1d0faefa246672b71b2567 (diff)
Tune host stack performance tests
* remove evt_qs_memfd_seg and evt_qs_seg_size as they are obsolete * use app socket api instead of vpp's api * apply rx and tx descriptors constraints * increase event queue size for nginx tests Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Ie7ac12b8f587e0b1962884127e8eb68a4e588aee Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'resources/libraries/python/HoststackUtil.py')
-rw-r--r--resources/libraries/python/HoststackUtil.py86
1 files changed, 76 insertions, 10 deletions
diff --git a/resources/libraries/python/HoststackUtil.py b/resources/libraries/python/HoststackUtil.py
index 073d3ec831..2c9c080b69 100644
--- a/resources/libraries/python/HoststackUtil.py
+++ b/resources/libraries/python/HoststackUtil.py
@@ -59,6 +59,8 @@ class HoststackUtil():
vpp_echo_cmd[u"args"] += u" rx-results-diff"
if vpp_echo_attributes[u"tx_results_diff"]:
vpp_echo_cmd[u"args"] += u" tx-results-diff"
+ if vpp_echo_attributes[u"use_app_socket_api"]:
+ vpp_echo_cmd[u"args"] += u" use-app-socket-api"
return vpp_echo_cmd
@staticmethod
@@ -154,15 +156,14 @@ class HoststackUtil():
raise
@staticmethod
- def get_hoststack_test_program_logs(node, program):
+ def _get_hoststack_test_program_logs(node, program_name):
"""Get HostStack test program stdout log.
:param node: DUT node.
- :param program: test program.
+ :param program_name: test program.
:type node: dict
- :type program: dict
+ :type program_name: str
"""
- program_name = program[u"name"]
cmd = f"sh -c \'cat /tmp/{program_name}_stdout.log\'"
stdout_log, _ = exec_cmd_no_error(node, cmd, sudo=True, \
message=f"Get {program_name} stdout log failed!")
@@ -170,9 +171,30 @@ class HoststackUtil():
cmd = f"sh -c \'cat /tmp/{program_name}_stderr.log\'"
stderr_log, _ = exec_cmd_no_error(node, cmd, sudo=True, \
message=f"Get {program_name} stderr log failed!")
+
return stdout_log, stderr_log
@staticmethod
+ def get_hoststack_test_program_logs(node, program):
+ """Get HostStack test program stdout log.
+
+ :param node: DUT node.
+ :param program: test program.
+ :type node: dict
+ :type program: dict
+ """
+ program_name = program[u"name"]
+ program_stdout_log, program_stderr_log = \
+ HoststackUtil._get_hoststack_test_program_logs(node,
+ program_name)
+ if len(program_stdout_log) == 0 and len(program_stderr_log) == 0:
+ logger.trace(f"Retrying {program_name} log retrieval")
+ program_stdout_log, program_stderr_log = \
+ HoststackUtil._get_hoststack_test_program_logs(node,
+ program_name)
+ return program_stdout_log, program_stderr_log
+
+ @staticmethod
def get_nginx_command(nginx_attributes, nginx_version, nginx_ins_dir):
"""Construct the NGINX command using the specified attributes.
@@ -276,20 +298,68 @@ class HoststackUtil():
exec_cmd_no_error(node, cmd, message=errmsg, sudo=True)
@staticmethod
- def hoststack_test_program_finished(node, program_pid):
+ def hoststack_test_program_finished(node, program_pid, program,
+ other_node, other_program):
"""Wait for the specified HostStack test program process to complete.
:param node: DUT node.
:param program_pid: test program pid.
+ :param program: test program
+ :param other_node: DUT node of other hoststack program
+ :param other_program: other test program
:type node: dict
:type program_pid: str
+ :type program: dict
+ :type other_node: dict
+ :type other_program: dict
:raises RuntimeError: If node subtype is not a DUT.
"""
if node[u"type"] != u"DUT":
raise RuntimeError(u"Node type is not a DUT!")
+ if other_node[u"type"] != u"DUT":
+ raise RuntimeError(u"Other node type is not a DUT!")
cmd = f"sh -c 'strace -qqe trace=none -p {program_pid}'"
- exec_cmd(node, cmd, sudo=True)
+ try:
+ exec_cmd(node, cmd, sudo=True)
+ except:
+ sleep(180)
+ if u"client" in program[u"args"]:
+ role = u"client"
+ else:
+ role = u"server"
+ program_stdout, program_stderr = \
+ HoststackUtil.get_hoststack_test_program_logs(node, program)
+ if len(program_stdout) > 0:
+ logger.debug(f"{program[u'name']} {role} stdout log:\n"
+ f"{program_stdout}")
+ else:
+ logger.debug(f"Empty {program[u'name']} {role} stdout log :(")
+ if len(program_stderr) > 0:
+ logger.debug(f"{program[u'name']} stderr log:\n"
+ f"{program_stderr}")
+ else:
+ logger.debug(f"Empty {program[u'name']} stderr log :(")
+ if u"client" in other_program[u"args"]:
+ role = u"client"
+ else:
+ role = u"server"
+ program_stdout, program_stderr = \
+ HoststackUtil.get_hoststack_test_program_logs(other_node,
+ other_program)
+ if len(program_stdout) > 0:
+ logger.debug(f"{other_program[u'name']} {role} stdout log:\n"
+ f"{program_stdout}")
+ else:
+ logger.debug(f"Empty {other_program[u'name']} "
+ f"{role} stdout log :(")
+ if len(program_stderr) > 0:
+ logger.debug(f"{other_program[u'name']} {role} stderr log:\n"
+ f"{program_stderr}")
+ else:
+ logger.debug(f"Empty {other_program[u'name']} "
+ f"{role} stderr log :(")
+ raise
# Wait a bit for stdout/stderr to be flushed to log files
sleep(1)
@@ -324,10 +394,6 @@ class HoststackUtil():
program_name = program[u"name"]
program_stdout, program_stderr = \
HoststackUtil.get_hoststack_test_program_logs(node, program)
- if len(program_stdout) == 0 and len(program_stderr) == 0:
- logger.trace(f"Retrying {program_name} log retrieval")
- program_stdout, program_stderr = \
- HoststackUtil.get_hoststack_test_program_logs(node, program)
env_vars = f"{program[u'env_vars']} " if u"env_vars" in program else u""
program_cmd = f"{env_vars}{program_name} {program[u'args']}"