[CRIU] [PATCH] test: add rpc tests
Andrew Vagin
avagin at parallels.com
Sun Sep 15 06:48:32 EDT 2013
> diff --git a/test/rpc/run.sh b/test/rpc/run.sh
> new file mode 100755
> index 0000000..17f0f09
> --- /dev/null
> +++ b/test/rpc/run.sh
> @@ -0,0 +1,72 @@
> +#!/bin/bash
> +
> +source ../env.sh || exit 1
> +
> +function my_print {
> + echo -e "\n**************************************************"
> + echo -e "\t\t"$1
> + echo -e "**************************************************\n"
> +
> +}
> +
> +function my_exit {
> + if [ $1 -ne 0 ]; then
> + echo FAIL
> + fi
> +
> + my_print "Shutdown service server"
> + kill -SIGTERM ${SRV_PID}
> +
> + exit $1
> +}
> +
> +IMGS_DIR_C="imgs_c"
> +IMGS_DIR_PY="imgs_py"
> +SERV_LOG="service.log"
> +REST_C_LOG="restore-c.log"
> +REST_PY_LOG="restore-py.log"
> +
> +my_print "Build services"
> +make clean && make || { echo "Failed to build"; exit 1; }
> +if [ $? -ne 0 ]; then
> + echo FAIL
> + exit 1
> +fi
> +rm -rf ${IMGS_DIR_C} ${IMGS_DIR_PY} ${REST_LOG_C} ${REST_LOG_PY}
> +mkdir ${IMGS_DIR_C} ${IMGS_DIR_PY}
> +
> +my_print "Start service server"
> +setsid ${CRIU} service -v4 -o ${SERV_LOG} --address ./criu_service.socket &
> +SRV_PID=${!}
> +if [ $? -ne 0 ]; then
> + echo FAIL
> + exit 1
> +fi
> +echo PID ${SRV_PID}
> +sleep 1 #server needs some time to initialize
I don't like this sleep. Your service is able to detach
-d|--daemon run in the background after creating socket
so if it will be executed with the -d option, this sleep will be
unnecessary.
> +
> +my_print "Run test-c"
> +./test-c
> +if [ $? -ne 0 ]; then
> + my_exit 1
> +fi
> +
More information about the CRIU
mailing list