The obsolete_target test spawns three 'sh' processes as monitoring targets. The processes inherit stdin from the test. When the test is run via 'make run_tests' from an interactive terminal, the kselftest runner executes it under 'timeout', which puts it in a background process group. The 'sh' processes then try to read the terminal, so the kernel sends SIGTTIN to the whole process group. This stops the 'sh' processes, and also the child the test has just forked to spawn the next 'sh', before it can run 'sh'. The test then waits on that child forever, until the kselftest runner kills it after 45 seconds. The test passes when run directly.
Fix this by passing stdin=subprocess.PIPE when spawning the processes. The processes then read from a pipe that never receives input, so they stay alive and idle as the test expects. Assisted-by: LLM Signed-off-by: Jaeyeon Lee <[email protected]> --- tools/testing/selftests/damon/sysfs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py index 66c826189320..ce54fa21c09f 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -390,12 +390,12 @@ def main(): kdamonds.stop() # test obsolete_target. - proc1 = subprocess.Popen(['sh'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - proc2 = subprocess.Popen(['sh'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - proc3 = subprocess.Popen(['sh'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + proc1 = subprocess.Popen(['sh'], stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc2 = subprocess.Popen(['sh'], stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc3 = subprocess.Popen(['sh'], stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) kdamonds = _damon_sysfs.Kdamonds( [_damon_sysfs.Kdamond( contexts=[_damon_sysfs.DamonCtx( -- 2.43.0

