Skip to contentSkip to conversation

rtla/tests: Fix pgrep filter in get_workload_pids.sh

PATCH In review Tomas Glozar 2 participants 2 messages Jun 4 – Jun 10

Subsystems (2)
lore
Share & tools
lore

Tomas Glozar

author maintainer
#0 lore raw

PATCH 1/1 rtla/tests: Fix pgrep filter in get_workload_pids.sh

Multiple runtime tests in RTLA rely on the get_workload_pids() shell helper function to get the PIDs of both kernel and user workloads.

On some systems (e.g. Fedora 43), pgrep matches kernel thread names including square brackets: "[osnoise/0]"; on other systems (e.g. RHEL 9.8), brackets are not included: "osnoise/0".

Accept both as valid workload PIDs rather that just the non-bracket form to make the tests work on all systems.

Fixes a98dad63cda3 ("rtla/tests: Add runtime test for -k and -u options")

---

Note: the file touched by this commit is included by .gitignore, that is an error that will be fixed by [1].

[1] https://lore.kernel.org/linux-trace-kernel/[email protected]/

 tools/tracing/rtla/tests/scripts/lib/get_workload_pids.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/tests/scripts/lib/get_workload_pids.sh +1 -1
index 8aff98cd2c1f..d10a4e3b321d 100644
@@ -5,7 +5,7 @@ get_workload_pids() {
     local rtla_pid=$(ps -o ppid= $shell_pid)
 
     # kernel threads
-    pgrep -P $(pgrep ^kthreadd$) -f '^(osnoise|timerlat)/[0-9]+$'
+    pgrep -P $(pgrep ^kthreadd$) -f '^\[?(osnoise|timerlat)/[0-9]+\]?$'
     # user threads
     pgrep -P $rtla_pid | grep -v "^$shell_pid$"
 }
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Tomas Glozar

Multiple runtime tests in RTLA rely on the get_workload_pids() shell helper function to get the PIDs of both kernel and user workloads.

On some systems (e.g. Fedora 43), pgrep matches kernel thread names including square brackets: "[osnoise/0]"; on other systems (e.g. RHEL 9.8), brackets are not included: "osnoise/0".

Accept both as valid workload PIDs rather that just the non-bracket form to make the tests work on all systems.

Fixes a98dad63cda3 ("rtla/tests: Add runtime test for -k and -u options")
Quoted 7 lines

---

Note: the file touched by this commit is included by .gitignore, that is an error that will be fixed by [1].

[1] https://lore.kernel.org/linux-trace-kernel/[email protected]/