public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] memcg/functional: check several times if the process is killed
@ 2016-05-19 14:55 Stanislav Kholmanskikh
  2016-05-23 16:02 ` Cyril Hrubis
  0 siblings, 1 reply; 14+ messages in thread
From: Stanislav Kholmanskikh @ 2016-05-19 14:55 UTC (permalink / raw)
  To: ltp

On some systems it may take slightly more than one second
to kill the memcg_process. So let's check several times if the
process is alive.

Also removed sleep() before moving the process to the memory cgroup,
since this looks reduntant.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 .../controllers/memcg/functional/memcg_lib.sh      |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index 9b9b0fd..93c61a1 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -220,14 +220,20 @@ test_proc_kill()
 
 	$TEST_PATH/memcg_process $2 -s $3 &
 	pid=$!
-	sleep 1
 	echo $pid > tasks
 
 	kill -s USR1 $pid 2> /dev/null
-	sleep 1
 
-	ps -p $pid > /dev/null 2> /dev/null
-	if [ $? -ne 0 ]; then
+	pid_exists=1
+	for tpk_iter in $(seq 5); do
+	    if ! kill $pid 2> /dev/null; then
+		pid_exists=0
+		break
+	    fi
+	    sleep 1
+	done
+
+	if [ $pid_exists -eq 0 ]; then
 		wait $pid
 		if [ $? -eq 1 ]; then
 			result $FAIL "process $pid is killed by error"
-- 
1.7.1


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

end of thread, other threads:[~2016-05-30 14:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-19 14:55 [LTP] [PATCH] memcg/functional: check several times if the process is killed Stanislav Kholmanskikh
2016-05-23 16:02 ` Cyril Hrubis
2016-05-23 16:25   ` Stanislav Kholmanskikh
2016-05-23 16:39     ` Cyril Hrubis
2016-05-23 17:43       ` Stanislav Kholmanskikh
2016-05-24  8:52         ` [LTP] [PATCH V2] " Stanislav Kholmanskikh
2016-05-24 12:26           ` Cyril Hrubis
2016-05-24  9:02   ` [LTP] [PATCH] " Jan Stancek
2016-05-24  9:18     ` Cyril Hrubis
2016-05-24 10:04       ` Stanislav Kholmanskikh
2016-05-24 10:15         ` Cyril Hrubis
2016-05-24 10:32           ` Jan Stancek
2016-05-24 10:48             ` Cyril Hrubis
2016-05-30 14:50               ` Stanislav Kholmanskikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox