linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rteval: Allow configuration from stdin
@ 2025-01-13 12:18 Gabriele Monaco
  2025-01-13 12:30 ` Tomas Glozar
  2025-01-13 21:34 ` John Kacur
  0 siblings, 2 replies; 9+ messages in thread
From: Gabriele Monaco @ 2025-01-13 12:18 UTC (permalink / raw)
  To: John Kacur, Clark Williams, linux-rt-users; +Cc: Gabriele Monaco

Modules can currently be set only via configuration file, if rteval is
called from a script run on different systems, the only way to make sure
the loaded modules are known is to provide (or generate) a configuration
file and pass it via -f/--infile .

Add the possibility to use - as input file to read the configuration via
standard input.

This allows something like:

 # rteval -f - << EOF
[measurement]
timerlat: module

[loads]
stressng:  module
EOF

Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
 rteval/rtevalConfig.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
index 0c2fc6b..4c41ed7 100644
--- a/rteval/rtevalConfig.py
+++ b/rteval/rtevalConfig.py
@@ -238,10 +238,14 @@ class rtevalConfig:
             # Don't try to reread this file if it's already been parsed
             return
 
-        self.__info(f"reading config file {cfgfile}")
         ini = configparser.ConfigParser()
         ini.optionxform = str
-        ini.read(cfgfile)
+        if cfgfile == "-":
+            self.__info("reading config file stdin")
+            ini.read_file(sys.stdin)
+        else:
+            self.__info(f"reading config file {cfgfile}")
+            ini.read(cfgfile)
 
         # wipe any previously read config info
         if not append:

base-commit: 5edb31a58bea3c2433e817439e053b79221a06df
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-01-16 20:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-13 12:18 [PATCH] rteval: Allow configuration from stdin Gabriele Monaco
2025-01-13 12:30 ` Tomas Glozar
2025-01-13 21:34 ` John Kacur
2025-01-14  6:40   ` Gabriele Monaco
2025-01-14 19:50     ` Crystal Wood
2025-01-14 23:07       ` John Kacur
2025-01-16  1:14         ` Crystal Wood
2025-01-16  6:45           ` Gabriele Monaco
2025-01-16 20:56             ` Crystal Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).