diff options
author | 2022-03-22 12:49:39 +0000 | |
---|---|---|
committer | 2023-01-24 06:27:46 +0000 | |
commit | 38715f99ce92ea56572a5f9de55a6c48df8c97af (patch) | |
tree | 8a6ffc85e2eb52d06478a38f8ab45fa8438cfbcc /resources/libraries/python | |
parent | 5a98bcc81c8696788a199cbe6c9595a14e24583b (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>
(cherry picked from commit 752538617f43672a0a9eeb93432929032cca05d3)
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/HoststackUtil.py | 86 | ||||
-rw-r--r-- | resources/libraries/python/VppConfigGenerator.py | 5 |
2 files changed, 81 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']}" diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index dc1529033b..baa0b734a4 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -560,6 +560,11 @@ class VppConfigGenerator: path = [u"session", u"enable"] self.add_config_item(self._nodeconfig, u"", path) + def add_session_app_socket_api(self): + """Use session app socket api.""" + path = [u"session", u"use-app-socket-api"] + self.add_config_item(self._nodeconfig, u"", path) + def add_session_event_queues_memfd_segment(self): """Add session event queue memfd segment.""" path = [u"session", u"evt_qs_memfd_seg"] |