[LTP] [PATCH V2] memcg/functional: check several times if the process is killed

Cyril Hrubis chrubis@suse.cz
Tue May 24 14:26:55 CEST 2016


Hi!
> +	tpk_pid_exists=1
> +	for tpk_iter in $(seq 5); do
> +		tpk_state=$(ps -o state= -p $pid)
> +		if [ -z "$tpk_state" ] || echo "$tpk_state" | grep -q Z; then
> +			tpk_pid_exists=0
> +			break
> +		fi


We may also poke directly the /proc/$PID/ and /proc/$PID/status
something as (beware untested):

	if [ ! -d /proc/$PID/ ] || grep -q "Z (zombie)" /proc/$PID/status; then
		...
	fi

> +		sleep 1

And I would change this sleep to at least 1/4s so that we do not waste
too much time here.

> +	done
> +
> +	if [ $tpk_pid_exists -eq 0 ]; then
>  		wait $pid
>  		if [ $? -eq 1 ]; then
>  			result $FAIL "process $pid is killed by error"
> -- 
> 1.7.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list