[PATCH] rteval: Updated parameter names

Sana Sharma <[email protected]>
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
Updated ModuleParameters, init and WorkloadPrepare with new parameter names.
- option is now named stressor, and
- arg is now named workers
to promote clarity.

Unit tests have also been changed to reflect this parameter renaming

Signed-off-by: Sana Sharma <[email protected]>
---
 rteval/modules/loads/stressng.py | 25 +++++++++++++------------
 tests/e2e/loads.t                |  6 +++---
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py
index 03fe842..32e2dbd 100644
--- a/rteval/modules/loads/stressng.py
+++ b/rteval/modules/loads/stressng.py
@@ -23,8 +23,8 @@ class Stressng(CommandLineLoad):
         self.__err = None
         self.__nullfp = None
         self.args = None
-        " Only run this module if the user specifies an option "
-        if self.cfg.option is not None:
+        " Only run this module if the user specifies an stressor "
+        if self.cfg.stressor is not None:
             self._donotrun = False
         else:
             self._donotrun = True
@@ -49,11 +49,11 @@ class Stressng(CommandLineLoad):
         else:
             self.__out = self.__err = self.__nullfp
 
-        # stress-ng is only run if the user specifies an option
+        # stress-ng is only run if the user specifies an stressor
         self.args = ['stress-ng']
-        self.args.append(f'--{str(self.cfg.option)}')
-        if self.cfg.arg is not None:
-            self.args.append(self.cfg.arg)
+        self.args.append(f'--{str(self.cfg.stressor)}')
+        if self.cfg.workers is not None:
+            self.args.append(self.cfg.workers) #default is 0
         if self.cfg.timeout is not None:
             self.args.append('--timeout')
             self.args.append(self.cfg.timeout)
@@ -135,13 +135,14 @@ def create(config, logger):
 def ModuleParameters():
     """ Commandline options for Stress-ng """
     return {
-        "option": {
-            "descr": "stressor specific option",
-            "metavar": "OPTION"
+        "stressor": {
+            "descr": "stressor name (eg. vm, cpu)",
+            "metavar": "STRESSOR"
         },
-        "arg": {
-            "descr": "stressor specific arg",
-            "metavar" : "ARG"
+        "workers": {
+            "descr": "number of workers(default: 0 = one per CPU)",
+            "default": "0",
+            "metavar" : "N"
         },
         "timeout": {
             "descr": "timeout after T seconds",
diff --git a/tests/e2e/loads.t b/tests/e2e/loads.t
index c367c46..b49002c 100644
--- a/tests/e2e/loads.t
+++ b/tests/e2e/loads.t
@@ -20,15 +20,15 @@ check "stress-ng debug" \
     "--onlyload -D -d 1" 0 '\[DEBUG\]'
 
 check "stress-ng command" \
-    "--onlyload -D -d 1 --stressng-option procfs --stressng-arg 1" 0 \
+    "--onlyload -D -d 1 --stressng-stressor procfs --stressng-workers 1" 0 \
     'starting with stress-ng --procfs 1 --taskset'
 
 check "stress-ng command, with --loads-cpulist" \
-    "--onlyload -D -d 1 --loads-cpulist=0-2 --stressng-option procfs --stressng-arg 1" 0 \
+    "--onlyload -D -d 1 --loads-cpulist=0-2 --stressng-stressor procfs --stressng-workers 1" 0 \
     'starting with stress-ng --procfs 1 --taskset 0,1,2'
 
 check "stress-ng command, with --stressng-timeout" \
-    "--onlyload -D -d 1 --stressng-option procfs --stressng-arg 1 --stressng-timeout 2" 0 \
+    "--onlyload -D -d 1 --stressng-stressor procfs --stressng-workers 1 --stressng-timeout 2" 0 \
     'starting with stress-ng --procfs 1 --timeout 2'
 
 # hackbench checks
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.