Skip to contentSkip to conversation

pids.sh: Fix spurious failures in test3 cleanup.

PATCH New Cyril Hrubis 1 participant 1 message Feb 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pids.sh: Fix spurious failures in test3 cleanup.

Sometimes the possitive testcases were failing in cleanup:

kill: (17773): No such process
1 TBROK: kill -9 17773 failed

The reason is that when we fork pids_task1 the child is running in the particual subgroup and hence it's pid is in the task file. And since the child process did only exit(0) there was a race between the process exit and the stop_pids_task function that read the tasks file.

The fix is obvious, we suspend the pids_task1 child to wait patiently for it's execution.

---
 testcases/kernel/controllers/pids/pids_task1.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/controllers/pids/pids_task1.c +2 -0
index 7feae1e07..a7e5d92d3 100644
@@ -56,5 +56,7 @@ int main(int argc, char **argv)
 		perror("fork() failed");
 		return 1;
 	}
+	if (newpid == 0)
+		pause();
 	return 0;
 }
Signature · 1 line
2.13.6