[CRIU] [PATCH 1/3] tests: replace cat in Makefiles with awk
Pavel Emelyanov
xemul at virtuozzo.com
Fri Nov 25 06:59:10 PST 2016
On 11/25/2016 05:19 PM, Cyrill Gorcunov wrote:
> From: Vitaly Ostrosablin <vostrosablin at virtuozzo.com>
>
> cat outputs pidfiles with newlines at end,
> while we need them to be unsplitted for kill
> command to work.
What's the environment in which kill doesn't work with \n-s?
> Signed-off-by: Vitaly Ostrosablin <vostrosablin at virtuozzo.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> 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 6d8cd755fe22..4bafc10e373a 100644
> --- a/test/zdtm/static/Makefile
> +++ b/test/zdtm/static/Makefile
> @@ -342,7 +342,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 %
> @@ -360,7 +360,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 8e82070f81e5..a5ca99fa215f 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
>
>
More information about the CRIU
mailing list