summaryrefslogtreecommitdiff
diff options
authorJeff Lane <jeffrey.lane@canonical.com>2022-07-29 13:16:44 -0400
committerJeff Lane <jeffrey.lane@canonical.com>2022-07-29 13:16:44 -0400
commitbd00efd9c35c6582fdf40b0416ddd5962af65117 (patch)
tree89f2e0d0a9e839a435b9229854139bd201198bdf
parent2da795f3a5a890b8f254872883fd1122c655b26a (diff)
FIX: stres_ng_test.py thread_count now accurately set on ALL stressors in the list. This fixes a newly introduced bug as well as an old bug that I stumbled on while fixing this. lp: #1983122
-rwxr-xr-xbin/stress_ng_test.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/stress_ng_test.py b/bin/stress_ng_test.py
index 5f3b9a5..c6a2d13 100755
--- a/bin/stress_ng_test.py
+++ b/bin/stress_ng_test.py
@@ -58,7 +58,7 @@ class StressNg():
stressors,
wrapper_timeout,
sng_timeout,
- thread_count,
+ thread_count=0,
extra_options=""):
self.stressors = stressors
@@ -72,13 +72,15 @@ class StressNg():
def run(self):
"""Run a stress-ng test, storing results in self.results."""
- stressor_list = "--" + " 0 --".join(self.stressors)
+ stressor_list = "--" + " {} --".format(self.thread_count).join(
+ self.stressors)
+ # LP:1983122 ensure the final stressor in the list is properly defined
+ stressor_list = stressor_list + " {}".format(self.thread_count)
- command = "stress-ng --aggressive --verify --timeout {} {} {} {}". \
+ command = "stress-ng --aggressive --verify --timeout {} {} {}". \
format(self.sng_timeout,
self.extra_options,
- stressor_list,
- self.thread_count)
+ stressor_list)
time_str = time.strftime("%d %b %H:%M", time.gmtime())
if len(self.stressors) == 1:
print("{}: Running stress-ng {} stressor for {:.0f} seconds...".