Re: [PATCH] rtla/tests: Get rtla PID correctly when system shell is not bash
From: Wander Lairson Costa
Date: Mon Nov 23 2026 - 10:33:54 EST
On Fri, Oct 30, 2026 at 03:51:11PM +0100, Tomas Glozar wrote:
> There are several places where rtla runtime tests call a script with
> "--on-threshold shell" to verify the trace configuration in the middle
> of tracing. Some of these checks require the rtla pid.
>
> Currently, the tests assume that rtla is the parent process of the
> utility script. That is, however, only the case when the system shell is
> bash, which optimizes the invokation of "sh -c script.sh" used by the
> system() function into just one process executing script.sh. On systems
> where the system shell is not bash (including all Debian-based systems),
> the system shell is the parent of the script, not rtla, and the checks
> fail.
>
> Pass $PPID resolved in the system shell to rtla's --on-threshold option
> and use it as the PID for rtla to make the tests pass on all
> distributions.
>
> Note that some of the tests (the cgroup test, for example) were
> intending to use rtla's PID, but work with the system shell's PID as
> well. For consistency, all scripts are updated to use $PPID.
>
> Fixes: d18fd5a34ff3 ("rtla/tests: Add get_workload_pids() helper")
> Fixes: 7f7ad23bced9 ("rtla/tests: Check -c/--cpus thread affinity")
> Reported-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Closes: https://lore.kernel.org/linux-trace-kernel/20260810210425.61435b0b@robin/
> Signed-off-by: Tomas Glozar <tglozar@xxxxxxxxxx>
Reviewed-by: Wander Lairson Costa <wander@xxxxxxxxxx>
[...]