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

Submitted by Vitaly Ostrosablin on Jan. 10, 2017, 12:17 p.m.

Details

Message ID 20170110121701.5208-1-vostrosablin@virtuozzo.com
State Superseded
Series "Series without cover letter"
Headers show

Commit Message

Vitaly Ostrosablin Jan. 10, 2017, 12:17 p.m.
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(-)

Patch hide | download patch | download mbox

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`
 
 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
 

Comments

Cyrill Gorcunov Jan. 10, 2017, 12:43 p.m.
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.

SOB missed too. Still iirc there were no objectios for such approach.
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Andrey Vagin Jan. 11, 2017, 12:04 a.m.
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@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu