[CRIU] [PATCH 1/2] test: replace cat in Makefiles with awk

Andrei Vagin avagin at virtuozzo.com
Tue Jan 10 16:04:56 PST 2017


On Tue, Jan 10, 2017 at 03:17:00PM +0300, Vitaly Ostrosablin wrote:
> cat outputs pidfiles without newlines at end, while we need them
> splitted for kill command to work.
> ---
>  test/zdtm/static/Makefile     | 4 ++--
>  test/zdtm/transition/Makefile | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
> index af1254f5..8fe9d953 100644
> --- a/test/zdtm/static/Makefile
> +++ b/test/zdtm/static/Makefile
> @@ -338,7 +338,7 @@ start:	$(PID) $(STATE)
>  check_start:	$(PID:%.pid=%.is_running)
>  
>  stop:	$(STATE_OUT)
> -	-kill -TERM `cat *.pid`
> +	-kill -TERM `awk '{print}' *.pid`

it was working for years, what is wrong now?
>  
>  WAIT_TIME=240
>  %.stop:	%.pid %
> @@ -356,7 +356,7 @@ WAIT_TIME=240
>  wait_stop:
>  		i=0; \
>  		while [ $$i -lt $(WAIT_TIME) ] ; do \
> -		kill -0 `cat *.pid 2>/dev/null` 2>/dev/null || break; \
> +		kill -0 `awk '{print}' *.pid 2>/dev/null` 2>/dev/null || break; \
>  		sleep 1; \
>  		i=`expr $$i + 1`; \
>  	done
> diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
> index 7ddb2384..dfc10ef5 100644
> --- a/test/zdtm/transition/Makefile
> +++ b/test/zdtm/transition/Makefile
> @@ -65,12 +65,12 @@ start:	$(PID)
>  check_start:	$(PID:%.pid=%.is_running)
>  
>  stop:
> -	-kill -TERM `cat *.pid`
> +	-kill -TERM `awk '{print}' *.pid`
>  
>  WAIT_TIME=10
>  wait_stop:
>  	-for i in `seq 1 $(WAIT_TIME)`; do \
> -		kill -0 `cat *.pid 2>/dev/null` 2>/dev/null || break; \
> +		kill -0 `awk '{print}' *.pid 2>/dev/null` 2>/dev/null || break; \
>  		sleep 1; \
>  	done
>  
> -- 
> 2.11.0
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list