aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/DUTSetup.py
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2020-01-21 19:02:14 +0000
committerVratko Polak <vrpolak@cisco.com>2020-01-29 15:48:30 +0000
commit676f4ae7d4df07dc41471e829f9d4c0b7a5bc8ca (patch)
tree3d0dd8bd2870815873297731484ee23ae943f2c0 /resources/libraries/python/DUTSetup.py
parent40bd774810d9e328f96725bcbf5f52ace04ac9a2 (diff)
perf: hoststack iperf3 test tuning
Change-Id: I53425f57fe9ecef9cff2c94642cc7cb24537a961 Signed-off-by: Dave Wallace <dwallacelf@gmail.com> (cherry picked from commit b340b5c9925b43869b91197850504760757a0bfe)
Diffstat (limited to 'resources/libraries/python/DUTSetup.py')
-rw-r--r--resources/libraries/python/DUTSetup.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py
index 49c3d41062..85e72e6463 100644
--- a/resources/libraries/python/DUTSetup.py
+++ b/resources/libraries/python/DUTSetup.py
@@ -175,24 +175,24 @@ class DUTSetup:
else:
shell_cmd = f"ip netns exec {namespace} sh -c"
- pgrep_cmd = f"{shell_cmd} \'pgrep {program}\'"
- ret_code, _, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
- sudo=True)
- if ret_code == 0:
+ pgrep_cmd = f"{shell_cmd} \'pgrep -c {program}\'"
+ _, stdout, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
+ sudo=True)
+ if int(stdout) == 0:
logger.trace(f"{program} is not running on {host}")
return
- ret_code, _, _ = exec_cmd(node, f"{shell_cmd} \'pkill {program}\'",
- timeout=cmd_timeout, sudo=True)
+ exec_cmd(node, f"{shell_cmd} \'pkill {program}\'",
+ timeout=cmd_timeout, sudo=True)
for attempt in range(5):
- ret_code, _, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
- sudo=True)
- if ret_code != 0:
+ _, stdout, _ = exec_cmd(node, pgrep_cmd, timeout=cmd_timeout,
+ sudo=True)
+ if int(stdout) == 0:
logger.trace(f"Attempt {attempt}: {program} is dead on {host}")
return
sleep(1)
logger.trace(f"SIGKILLing {program} on {host}")
- ret_code, _, _ = exec_cmd(node, f"{shell_cmd} \'pkill -9 {program}\'",
- timeout=cmd_timeout, sudo=True)
+ exec_cmd(node, f"{shell_cmd} \'pkill -9 {program}\'",
+ timeout=cmd_timeout, sudo=True)
@staticmethod
def verify_program_installed(node, program):